algorithmic modeling for Rhino
I am using the following function to figure out if a Point is within a boundary area and outside an obstacle, mostly it works as expected but in some cases it doesn't:
Private Function Inside(ByVal Obstacle As List(Of Curve), _
ByVal Boundary As Curve, _
ByVal p As Point3d, _
Optional ByVal dt As Double = 0) _
As Boolean
Dim t As Double
If Boundary.Contains(p) = PointContainment.Outside Then
Return False
ElseIf dt > 0 Then
Boundary.ClosestPoint(p, t)
If p.DistanceTo(Boundary.PointAt(t)) < dt Then
Return False
End If
End If
For Each c As Curve In Obstacle
If c.Contains(p) = PointContainment.Inside Then
Return False
ElseIf dt > 0 Then
c.ClosestPoint(p, t)
If p.DistanceTo(c.PointAt(t)) < dt Then
Return False
End If
End If
Next
Return True
End Function
I have moved it to a VB Script node and found out that for a point that is miles within the boundary the function Curve.contains(P) returns that it is outside. (see image e.g. cell 4079) Any suggestions?
Best Richard
Tags:
Hi Richard,
any chance of getting the files needed to replicate this?
--
David Rutten
david@mcneel.com
Attached a file, would need to install SpiderWeb that is why I didn't include it at the beginning...
Any suggestion for an other methode? like limiting it to polylines or ... ?
Hmm, that want do need a general solution and not a specific...
its not such a hurry was just wondering.
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by