Angle betwen an edge and a geodesic line, which are both members of the same mesh?

Hi there,
The coordinates of all three vertices are of course known. I have Boost libraray installed but I'm unaware of such function. Any suggestions?

 Réponse acceptée

Mea culpa! The mesh is 2-manifold and not 2D-space. So even if a third vertex is far away (let us say P3) from P1, and P1 and P2 are relative close to each other (somewhere betwen 1x and 2x of average edge length) I can take the first equation to calculate P2_P1_P3 angle?
THX!

2 commentaires

Yes, the relative magnitudes of the vectors P2-P1 and P3-P1 don't matter to the 'atan2' function, only their direction. If R is a positive number, the expression atan2(R*sin(a),R*cos(a)) will return with the angle a in the range -pi < z <= pi, regardless of the size of R. In your case R would be the product of the two vectors' magnitudes and 'atan2' is therefore unaffected by its value. Your angle will be non-negative because the first argument is forced to be non-negative in the formula and therefore the angle must lie somewhere in the first two quadrants.

Connectez-vous pour commenter.

Plus de réponses (1)

If the three vertices you refer to are column vector vertices, P1, P2, and P3, of a triangle, and you want to find the inner angle at P1, do this:
a = atan2(norm(cross(P2-P1,P3-P1)),dot(P2-P1,P3-P1));
or if you are in two-dimensional space
a = atan2(abs(det([P2-P1,P3-P1])),dot(P2-P1,P3-P1));
The angle is returned in radians ranging from 0 to pi.

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by