Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8532

Line perpendicular to 4 other lines

$
0
0

@jordy1989 wrote:

Hi all,

I am struggling and need some help.
I have been trying to get a line perpendicular to 4 lines where the end point is the same.

Hereby an image:


For this example I have 4 lines. The length of the lines are not the same and the center point is not planar with the start points of the 4 lines.

What I want to do is create the white line..

Hereby an example of the grid:

What I have been trying to do is add all Directions of the lines and divide it by the number of lines.
Then I get a vector3D that should be my direction, but this seems to fail sometimes...

Dim lineList As New List(Of Line)
Dim v1 As Vector3d = Nothing
For Each g As Guid In li
     Dim crv As Curve = New DocObjects.ObjRef(g).Curve
     Dim nwLine As New Line(crv.PointAtStart, crv.PointAtEnd)
     v1 += nwLine.Direction
     lineList.Add(nwLine)
Next
v1 /= li.Count

Dim myperpendicularlines New Line(lineList(0).To, v1 + lineList(0).To)

Most of them look correct, but some got their own mind and go wander somehow:

Anyone has any suggestion?

The direction of the curves are always towards the center.

P.S. I have tried to make all lines the same length, but does not fix the wild directions:

 nwLine.Extend(10 - nwLine.Length, 0)

Posts: 8

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 8532

Trending Articles