algorithmic modeling for Rhino
Tags:
There's probably a better way to do this, and maybe someone else will come along and correct me. However, you could create a vertical plane at X,0 and then test for curve-plane intersection.
Rhino.Geometry.Intersect.Intersection.CurvePlane
I don't know how it looks exactly in VB so you might have to play around a bit.
Cheers,
Chris
This should work:
Private Sub RunScript(ByVal C As Curve, ByVal x As Double, ByRef y As Object)
Dim cbb As BoundingBox = C.GetBoundingBox(True)
Dim pt0 As Point3d = cbb.PointAt(0, 0, 0)
Dim pt1 As Point3d = cbb.PointAt(1, 0, 0)
If x < pt0.X OrElse x > pt1.X Then
print("x is off the Curve")
Return
End If
Dim xplane As New Plane(New Point3d(x, 0, 0), Vector3d.XAxis)
Dim xe As Intersect.CurveIntersections = Intersect.Intersection.CurvePlane(C, xplane, 0.01)
y = xe.Item(0).PointA.Y
End Sub
This is obviously assuming that your curve isn't self-intersecting, and that for each x, there is only 1 y-value on the curve.
Hope it helps.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by