Hello everybody,
I'm fairly new to maxscript but I have some experience with c and java.
My Problem:
Within my scenes there are planes that are placed and rotated by hand. The person who placed them now needs two values from those planes: heading and the pitch
To be more precise: The Values for pitch (or drop as it's an tectonically problem) need to be between 0-90 degrees
The Values for heading need to be between 0-360 degrees. (both eulerangles)
I don't actually need to rotate those planes in the end but I really need those values.
My solution so far:
I don't know if there is an easier way to do this in maxscript. So please point out any stupid stuff I'm doing.
1. collect all planes in the scene and convert them to poly with only one face
2. get normal vector for each plane (normalvector = polyOp.getFaceNormal 1)
3. get the "horizontal" vector for that plane (horizontalVector = normalize (cross [0,0,1] normalvector))
4. get the "vertical" vector (verticalVector = normalize (cross horizontalVector normalvector ))
5. get the vector facing to the front (frontVector = normalize ([normalvector [1], normalvector [2], 0]))
6. after all that I calculate the angle between the vertical vector and the front vector with (theAngle = acos(dot (normalize frontVector ) (normalize verticalVector )))
All the results till now were really strange. In some cases I looked like it worked correctly and in others it really wasn't right at all.
Am I missing something here? Am I using the right approach to this problem?
I can't provide any working code right now because of some strange bug in maxscript. Nevertheless would I be very thankful if anyone has an idea how this could be solved?
If you need any more code I will happily post any "non-working" snippets ;-)
Cheers,
Per