Grasshopper

algorithmic modeling for Rhino

Hello everyone,

My problem is to create a set of curves with the same lenght that are gradual transformations of an arc into a straight line with the same start point as the arc.

 

I have the start point, direction and by function (R*Pi) the lenght of the resulting line and starting arch. The problem to solve is how to get the iterations inbetween (the white curves in the image). 

 

If any one could help me with a way to formulate a function to do this I'd be ever so happy. It is a bit trickier that you might think.

 

Cheers,

 

Eric

Views: 1160

Attachments:

Replies to This Discussion

Hi Eric,

could this be a method?


- Giulio
________________________
giulio@mcneel.com
McNeel Europe, Barcelona
Attachments:
Same, for Grasshopper 6.59. (There is no scripting involved)
Attachments:
Thank you so much Giulio for you quick and elegant solution! I made it into a function for anyone else that might need it.


Private Sub RunScript(ByVal angle As Double, ByVal length As Double, ByVal sPt As On3dPoint, ByRef crv As Object)

' function for straightening an arc into a line

If angle = 0 Then

Dim ePt As New on3dpoint(spt.x, spt.y + length, spt.z)
crv = New OnLine(sPt, ePt)

Else

Dim division As Double = length / angle

Dim Origin As New On3dpoint(spt.x + division, spt.y, spt.z) '
Dim xAxis As New On3dVector(-1, 0, 0)
Dim yAxis As New On3dVector(0, 1, 0)

Dim Plane As New OnPlane(Origin, xAxis, yAxis)

crv = New Onarc(plane, division, angle)

End If

End Sub

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service