How to create a plane?

How can I create exactly the same Plane in Grasshoper or code ie. C# with data below?
so when I deconstruct will see:

Origin Point3D(X=0,Y=0,Z=0) 
AxisX Vector3D(X=-1,Y=-3.37863234830224E-15,Z=4.13749464096075E-31)
AxisY Vector3D(X=-1.05292222451328E-30,Y=4.34102186154216E-16,Z=1)
AxisZ Vector3D(X=3.37863234830224E-15,Y=-1,Z=4.34102186154216E-16)


Origin  Point3D(X=69.2710806537937,Y=-18.0445989974138,Z=31.6)
    AxisX Vector3D(X=1,Y=-3.25617171292001E-15,Z=0)
    AxisY Vector3D(X=-1.01475840219424E-30,Y=-3.11641550771978E-16,Z=1)
    AxisZ Vector3D(X=3.25617171292001E-15,Y=1,Z=3.11641550771978E-16)

If needed we can round to 6 decimal places

This code works.
I’ve replaced numbers with simpler ones.

Rhino.Geometry.Point3d origin = new Rhino.Geometry.Point3d(0, 0, 0);
Rhino.Geometry.Vector3d AxisX,AxisY,AxisZ;           
AxisX = new Rhino.Geometry.Vector3d(-1, 15, 20);
AxisY = new Rhino.Geometry.Vector3d(2, 7, 3);
AxisZ = new Rhino.Geometry.Vector3d(-8, 9,-5);

Rhino.Geometry.Plane plane = new Rhino.Geometry.Plane(origin, AxisX, AxisY);

double number=Double.Parse("1.234567E-06", System.Globalization.NumberStyles.Float);

There are many plane constructors, see here: https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_Plane.htm
I’ve used the Plane(Point3d, Vector3d, Vector3d)

Last row is a standard c# method to convert a string (in scientific notation) to double/float.

1 Like

thanks @maje90
Unfortunately, it does now work … AxisX, Axis Y is correct but Axis Z is not… I need all Axes to be correct so it close but not sure if I can achieve all to be the same… hmm :thinking:


ConstructPlane.gh (6.1 KB)

A “Plane” is defined by just an origin, X and Y vectors. Z vector is not needed.
You are seeing “0” because your numbers are so small that the small decimals are not shown, but the number is actually what you want. (E-31 is also really really small…)

As you did, it seems the “Double.Parse” is not needed…

The plane constructor will only construct “valid” planes. For that your plane needs to be “right-handed”, if local x-Axis = (-1) * global X and local y = global Z, the cross-product will automatically yield z-Axis = global Y.

As far as I can see, if you modify a plane that way, it will become null. Which probably makes sense, i don’t know what you would do with a “non-cartesian” frame…

Plane plane = new Plane(new Point3d(),
  new Vector3d(-1, 0, 0),
  new Vector3d(0, 0, 1));
plane.ZAxis = new Vector3d(0, -1, 0);

A = plane;
1 Like

Are you sure you need a plane? From the discussion. It seems you need an axis coordinates system. A general axis system doesn’t need to be right handed nor to have unit vector nor to have perpendicular vector.

1 Like

thanks a lot for your reply,
this was exactly was I was looking for…
so I was following in my program ‘axis coordinates system’ and rhino follows ‘cartesian’
and these two are not exchangeable… .this is why I could not create plane from my system,
I will adjust my system to follow Rhino approach to so we can exchange data… thanks all for help