generative modeling for Rhino
What makes a plane "invalid"? I can't seem to create a "valid" Rhino.Geometry plane using the constructor "plane(a, b, c, d)". For example,
Plane p = new Plane(2,-8,5,18);
results in an invalid plane p. But if I construct the same plane using point and normal as:
Vector3d v = new Vector3d(2, -8, 5);
Point3d pt = new Point3d(1, -2, 0);
p = new Plane(pt, v);
its all good. p is now "valid". For various reasons I'd like to be able to use the first call. Thoughts?
- Brian -
this is not quite my area of expertise (I didn't understand how a plane equation worked until I looked it up just now). According to the OpenNurbs source code, the Plane.IsValid check does the following:
From this it follows that as long as you supply any doubles for the plane equation that are not all zeroes or, NaNs or RhinoMath.UnsetValue, you should end up with a valid plane. I'll need to debug into this (all the way from Grasshopper into RhinoCommon into rh_common into OpenNurbs which takes a long time.
One quick fix is to do the following:
Dim plane As New Plane(2, -8, 5, 18)
Dim zaxis As Vector3d = plane.ZAxis
plane.ZAxis = zaxis
I'll go about adding a unitize to the plane constructor as well.
Yup, that fixed it. The next RhinoCommon release will have a working equation constructor.
Thanks very much, David. This is new territory for me as well :^)