Question

I have a profile entity in XY plane. I have to do an extrusion along a vector. So I have to bring the profile entity perpendicular to the extrusion vector. Extrusion vector can be a arbitrary one (Xi+Yj+Zk). Could you please provide some idea about vector base manipulation to bring the profile perpendicular to the extrusion vector?

Update

......

Profile in XY plane

Global up vector : (0,0,1)

Extrusion vector : (Xe,Ye,Ze)

Local right = Extrusion vector x Global up vector = (x1,y1,z1) Local Left = Extrusion vector x Local right = (x2,y2,z2)

I assume I have to rotate the plane twice about Local right and Local Left.

So the angle is calculated for Local right = Atan(Xe.Y/Xe.Z) and the entity is rotated about Local right by calculated angle. and it is working fine

My question is how to calculate the angle for Local Left ?

If I summarize, I have to do the opposite of this one (Mapping coordinates from plane given by normal vector to XY plane)

Was it helpful?

Solution

If you have your extrusion vector and one reference vector you can cross multiply them to retrieve your 2D planes' right vector in 3D space.

I usually use the global up vector as my reference. So your extrusion vector cross multiplied with global up will result in a local right vector. Another cross multiply between your extrusion vector and your new local right vector will result in a local up vector.

Once you get both your local right and local up vectors, those will be your planes X and Y vectors in 3D space.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top