Grasshopper

algorithmic modeling for Rhino

# Fit Line problem

Hi everybody,
I encountered the strange problem regarding curve orientation after having used Fit Line.
As input I give a series of points, and analyzing the output curve I found that not always the first point becomes the starting point of the line(some times becomes end point!)
In attached piece of my diagram you can see seven lines, each defined by series of points and extracted their Start and End positions - in two cases the orientation of lines are inverted with respect to the order of series of points . Hope there is another solution than checking it one by one...
Janusz

.

Views: 125

Attachments:

### Replies to This Discussion

The point fitter algorithm does not take the order of the input into account at all, it just assumes the points are provided in a random order. The same is true of other operations such as curve joining, the order of the output has little to nothing to do with the order of the input.

You will have to add additional logic to flip the lines if they run counter to the point cloud. I guess extracting the first and last point of each cloud, creating a line between them and using that second line as a guide for the [Curve Flip] component may do the trick.

Thanks David!
...so, no escape ;o)

Not at the moment. I guess it makes sense to add this sort of check into the next version of the component.

you could try least square with n = 1

Attachments:

I applied workaround for that problem but thanks anyway!
I like your solution and will keep it in mind!

by djordje

by Siemen

• View All