Page 1 of 1

Project VectDg onto a surface to get a 2D vector

Posted: Thu Nov 21, 2024 4:22 am
by Jim Herron
Hello,

I have a vector in 3D space (VectDg) and I want to project it onto a IUVSurface_DG/IBRepFace_DG at a certain position. I can do this using VectDg n = IUVSurface_DG.GetNormal() and then use myVector.MakeOrtho(n).
Then I can use

Code: Select all

dirU = GetTangent(uv, true); dirV = GetTangent(uv, false);
Then du = myVector.Product(dirU) and dv = myVector.Product(dirV) will be the 2D coordinates of the projection in uv space.
Is there a simpler way?

Thank you for your answers,
Herron

Re: Project VectDg onto a surface to get a 2D vector

Posted: Thu Nov 21, 2024 4:44 am
by Eric Rayner
This should work. After the myVector.MakeOrtho(n) you vector will be tangential to the surface.

A little shorter way:

Code: Select all

IFrame_DG frame = IUVSurface_DG.GetUVAlignedFrame(uv);
VectDg vectTangential = frame.ToLocal(myVector);
vectTangential[0] and vectTangential[1] will be the coordinates in the parameters space.