I want to extract points on the same line

grasshopper
python
unhandled

(tatsuya) #1

Hi,

I would like to create a shortest path algorithm considering the cost in the road.
However, when it is an irregularly arranged curve, I do not know how to get the next point.

Is there any good idea.

I am glad that someone will help me.Thank you.

The image below is a simple shortest route using SHORTEST WALK GH.

A-star.gh (7.1 KB)


(Tim Stark) #2

Which point you want? Next from what?


#3

so you are solving for ‘cost’ instead of distance. a general approach:

  • substitute a curve (whose length = cost) in between endpoints of line segment
  • this curve can be a circle, a portion of a circle, which has the length equal to cost
  • you may have to sum curve lengths, from a tree data structure, to arrive at cost. Peter Fotiadis has an excellent script from a few days ago that deals with how to extract portions of a tree

(tatsuya) #4

Thanks.
Sorry, the explanation was not enough.

The cost of thinking is not just distance.
Finally, I want to extract a special cost from the dividing point on the line and add it.
For example, it is a road like a sunny road or climbing slope.


(Tim Stark) #5

Still no idea which points you are searching for. If you want the points st the kinks, you could use discontinuity component :slight_smile:


#6

One of the oldest, general engineering approaches I use is to back up a step, and write out a problem, in words, with what you are trying to do.

So, my idea for you is write out, and diagram if needed, the problem you are trying to solve.

Then, once you have articulated the problem, you can start sequencing this into grasshopper.

Using your example above, start simple. Decide how to solve your original problem, “cost”, get that working, then you can start on the next parameter.

To keep it simple, assuming that each segment of your road has a constant “cost / unit length” then you can multiple your cost/foot, or per meter, by the length of the curve (L, one of the outputs from shortest walk component).

Good luck!


(tatsuya) #7

Thank you !
I will try hard.


(tatsuya) #8

A little, I approached the answer.
Thank you!