Grasshopper

algorithmic modeling for Rhino

Putting a list of planes into a Panel shows a set of four numbers for each plane. I assume these are the A,B,C,D values from the equation for the plane in Ax+By+Cz+D
If I use these planes into a VB component as a list of OnPlane how exactly do I access these numbers?
I want to solve for z given x and y coordinates. I'm able to do it by passing the plane twice, once as an On3dVector (returns normal) and the second time as an On3dPoint (returns origin) and reconstructing the equation, but it seems like it must be possible to get the coefficients directly via member variables.
Thanks.

Views: 197

Replies to This Discussion

Yes, you are correct in those 4 values being related to the equation of the plane. You can access them through the plane_equation property of a plane, which is a OnPlaneEquation. That OnPlaneEquation class exposes the 4 variables used for the plane equation under the properties x,y,z, and d.
Thanks, perfect! Working great.

The script ended up like this:
(n is the List of Planes, ePt a list of xy-coordinates, kPt the return variable)
Dim A As Double
Dim B As Double
Dim C As Double
Dim D As Double
Dim zVal As Double
Dim ptout As New List(Of on3dpoint)

For i As int32 =0 To 1
A = n(i).plane_equation.x
B = n(i).plane_equation.y
C = n(i).plane_equation.z
D = n(i).plane_equation.d
print(d)

zVal = ((A * ePt(i).x) + (B * ePt(i).y) + D) / (-C)

ptout.Add(New On3dPoint(ePt(i).x, ePt(i).y, zVal))
Next

kPt = ptout

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service