align vectors to a planes normal
Blitz3D Forums/Blitz3D Programming/align vectors to a planes normal
| ||
In my program, I'm trying to create a mesh that represents a plane. So I need 4 coordinates that represent the plane, say: (-1, 0, -1) ( 1, 0, -1) ( 1, 0, 1) (-1, 0, 1) assuming that it is an XZ plane. To define the plane, I have a normal and a value called 'd', that is the plane's distance from the origin. plane = (nx, ny, nz, d) or nx*x + ny*y + nz*z + d = 0 I allready used TFormPoint to solve this, but I need a mathematical way nstead. Should I do a transformation, based on the plane's normal? I don't know how. Convert the normal to angles with Atan2, then use Cos/Sin to transform it back? or is there a simpler way? Could anybody please help? |
| ||
I would go for COS/SIN method. It's a little fiddly to get it right, but it does work fine. |
| ||
Okay thanks, I think it works. So far so good. This is the code: |
| ||
Nice one. Alot neater code than mine for doing this :) |