algorithmic modeling for Rhino
When I construction an plane using grasshopper through origin and normal vctor,
as we all know you don't have to pointed X and Y axis, and you can also construction an Plane. So, at this aspect, what is the direction of X and Y axis, It is annoy me for a long time?
First the x-axis is set to be perpendicular to the supplied z-axis. Then the y-axis is computed as the cross product between the z-axis and the x-axis. The way in which perpendicularity for the x-axis is defined is key here. Rhino looks at the z-axis and determines roughly in which direction it is pointing, ie. which of the x/y/z coordinates is largest. It will also look at the second largest component and pick one out of 6 possible ways to define perpendicularity.
If you care at all about the direction of the x and y axes, you should never use the Origin+Normal constructor for planes.
Hi David, ThankYou for your replay. But from your reply, I just has two question about it
firstly, which of the x/y/x coordinates is largest, how could I understand this. secondly, 6 possible ways is refer to which six ways?
That all Thankyou
If the z component is larger than the x and y components, then the vector points more upwards than sideways. Similarly, if x is the biggest component, then the vector points more to the right or left than it does front/back or up/down.
The reason Rhino bases perpendicularity on this metric is because of symmetry and numeric robustness. This logic is defined in OpenNurbs, which is free for download if you want to see the actual algorithm. (look in ON_Vector3d.cpp, the CreatePerpendicular() method)
ps. If I get the go-ahead from Seattle HQ I can copy paste the relevant code here tomorrow, I'm just not entirely certain I am allowed to do this.
Hi, I have download OpenNurbs SDK to the local,
But I think I can't find the On_Vector3d.cpp file in OpenNurbs package you show me to download
Sorry, I got confused with the RhinoCommon naming scheme. It's ON_3dVector.cpp
ThanYou David, It is hopefull for me
the class ON_3dVector is in the file opennurbs_point.ccp
The method david is referring to is also posted here on github (might be a bit outdated).
At line 554.