Could someone elaborate on how to properly align object along ( or rotate to ) normal? I tried many ways but always i get unpredictable results objects are spinning around like crazy - it looks like Transform.Rotation cannot decide how x,y aligned during the transform - i’m using Transform.Rotation(Vector3d startDirection, Vector3d endDirection, Point3d rotationCenter);
@RIL I saw that you were fighting a lot with similar things maybe some thoughts? @pascal i don’t know who i should ask about that? @dale is always very helpful but i believe he can be tired cause of my never-ending questions
Hi @HaLo if normal vector does not define that why objects are rotating randomly even on the same but rotated 90deg polysrf ( objects are rotated 180 deg in this case if we assume closer one is proper)?
I’m not totally sure about the cases you provided so I’m guessing, you see the expected rotation if you use the normal of the curved Surfaces?
Rotation identifies the plane of operation with two vertices and a point. The axis of rotation is perpendicular to that plane. For 180° operations, this deteriorates to a line and a plane of possible axes of rotation. Rhino needs to catch that case and make an assumption about your intended axis. I have no idea what that involves, but I think, you should go with an orient operation (Transform.Rotation(Vector3d, Vector3d, Vector3d, Vector3d, Vector3d, Vector3d)) to make sure your object is aligned correctly.
Here is lerp from up -> normal -> down -> -normal - lerp uses small deviations on x and y when ZAxis and -Zaxis and works ok but look at the end that -normal performs unexpected rotations and ends like -normal - 90 deg on Z whats more interesting when it is done on flat surface it is ok ( we must assume that on inverted axis proper Z rotation is always Pi and now when it is -Zaxis (+ small deviations on xy ) i get this right but as soon as we’ll try to get -normal ( so we should get - normal and Pi around normal) we’ll get additional 3/2Pi - and if you’ll watch closely it does not happen for all objects for eg this in center (is rotating more than needed but it ends more or less where it should but others not)
Some of the rotation methods will implicitly use a certain plane to orient themselves. You are probably best off by using Transform.Rotation(double angleRad, Vector3d axis, Point3d rotationPoint) which completely specifies a rotation of given angle (in radians) around a given axis, oriented at a given point, i.e. without implicit assumptions.
@menno that is what i thought of but i always try to keep things simple as possible - it is very interesting topic but quaternions are new to me and it isn’t very obvious for me in case of four-dimensional vectors For now i fixed issue leaving part of the rotation to bottom and further i relate to -Zaxis to -normal and works ok however it would be nice if someone more clever and educated could tell more about this stuff here