algorithmic modeling for Rhino
The answer must be really simple for this one:
I want to offset a planar curve on the XY plane (x) so that the resulting area is a percentage (y) of the original curve area. It works for polylines, but not for a polycurve... what am I missing?
(By the way, if someone has other ideas of how to approach this task, I'm all ears)
Private Sub RunScript(ByVal x As Curve, ByVal y As Double, ByRef A As Object, ByRef B As Object)
Dim masspropsx As AreaMassProperties = AreaMassProperties.Compute(x)
Dim originalArea As Double = masspropsx.AreaDim center_point As New Point3d(0, 0, 0)
Dim height_point As New Point3d(0, 0, 1)
Dim zaxis As Vector3d = height_point - center_point
Dim plane As New Plane(center_point, zaxis)Dim areaRatio As Double = 0
Dim distance As Double = 100
Dim OCurve As Curve() = NothingDo While areaRatio < 0.9
distance = distance - 0.5
OCurve = x.Offset(plane, distance, 0.1, CurveOffsetCornerStyle.None)
Dim ampOCurve As AreaMassProperties = AreaMassProperties.Compute(OCurve(0))
areaRatio = ampOCurve.Area / masspropsx.Area
LoopA = distance
B = areaRatio
Tags:
Thanks Mostapha.
I discovered the source of the issue which had to do with the geometry itself, not with the area method.
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