algorithmic 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 -
Tags:
Hi 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.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
One quick fix is to do the following:
Dim plane As New Plane(2, -8, 5, 18)
Dim zaxis As Vector3d = plane.ZAxis
zaxis.Unitize()
plane.ZAxis = zaxis
I'll go about adding a unitize to the plane constructor as well.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Yup, that fixed it. The next RhinoCommon release will have a working equation constructor.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by