I made a little experiment to test the angle from two vectors at xy plane and rotate the plane 3-dimensionally to evaluate which is the exact projection direction.
As you can see, the projection direction isn’t toward z-direction.
Much appreciated in advance.
The method you reference is designed to calculate the angle between two 3D vectors that lie on a plane.
The inputs you need to provide are the two vectors and the plane on which they lie.
The source code behind Vector3d.VectorAngle projects the two vectors onto the input plane, for accuracy. Then, the dot-product between the projected vectors is calculated. The dot-product is then passed to Math.Acos to determine the angle in radians.
Thank you very much for your answer.
Probably, I didn’t describe well for my question earlier. I’m wondering how you calculate the angle between two vectors while the input plane isn’t lying on these two vectors.
For example, at the video, blue vectors always lie on xy plane with angle 90 degree, the input plane is then rotated 3- dimensionally. It’s not clear for me which direction to project vectors on the rotated plane.
Thanks for your answer.
If the direction of projection implies the normal of the plane, in this case, it should be toward to z-direction as two blue vectors lie on xy plane with 90 degree. But as you can see the second panel and third panel were showing different results.
Hi Shaun - I guess then that you can calculate the points at the base and tip of the vectors and use Plane.ClosestPoint, then generate new vectors from these projected points and measure the angle.
@shaunwu25 - the link from Dale above gets you a function that does what I just said, but automatically…
@pascal YES! it’s as you described. I’m wondering, then the description of rhinocommon SDK would still be corrected? Since the two vectors are finding the closest points on an arbitrary plane rather than “project” onto it with a certain direction. It’s quite misleading for me.