How to find the angle between two points on a Bezier curve?

In my current OpenGL project, I'm trying to make chain links hug the contours of a Bezier curve. How to find the angle between two points of a curve so that I can arrange the chain links so that they correspond to the curve.

This shows a curve and chain, I need a way to rotate links so that they follow the curve.

Does anyone know how to do this?

+3
source share
3 answers

Perhaps something like this is what you need.

How to calculate the tangent to a Bezier curve

. , , . , , , , . ? .

, . googled ( , ). , . , - , .

...

+4

A B. AB , 1. AB_norm. asin (AB_norm.y) acos (AB_norm.x), . 0 . C- :

 get_angle(Point A, Point B) {
   AB.x = B.x - A.x;
   AB.y = B.y - A.y;
   length = sqrt(AB.x * AB.x + AB.y * AB.y);

   AB_norm.y /= AB.y / length;
   angle = asin(AB_norm.y);
   // or
   // AB_norm.x /= AB.x / length;
   // angle = acos(AB_norm.x);
 }

 angle = get_angle(A, B);
 glRotatef(angle, 0.0f, 0.0f, 1.0f);
 // Draw the chain link here
0

You need math. You can find the tangent, normal, and binormal vectors, and then you can find the angle. If you are still interested, let me know, I have some details on this topic.

0
source

Source: https://habr.com/ru/post/1711884/


All Articles