Hi All,
I have 2 points (A “Door” of a building and a central inner point).
I want to connect the points with a polyline, using only right angles.
I would like to be able to set the number of breaks in the line, or maximum length of each segment.
Input : your two existing points, the number of breaks you want (say N)
Divide the straight segment into N segments. You should get, with your two already existing points, N+1 points.
Extract the coordinates of the points you got at the previous step. (say (x0,y0) ; (x1,y1); etc.)
Create the lines as follow : from (x0,y0) to (x0,y1), from (x0,y1) to (x2,y1), from (x2,y1) to (x2,y3), from (x2,y3) to (x4,y3), etc. (care about the last iteration, must be (xN,yN))
The way you divide your straight segment will truly define the shape of your final line. You can make segments of equal lengths, scaled with a certain ration, etc.
You can do more complicated path, but you must be more specific in what you want as an output. As you stated it, your problem has to many degrees of freedom you can act on.
Thanks Mellouze, I’ll try that and see how it goes.
Kenny - I am looking to randomize it to some degree. I eventually want to present a few options to choose from, and maybe even optimize it to find the shortest line.
The shortest line will be the straight one.
With only right angles, there is no uniqueness of such line. Any line that only go from top to down and from right to left will be the shortest (try to do a little drawing of that).
That was the conclusion of my previous post : you need to define what you mean by this sentence you just said
Hi,
I got it working - I can create diagonal lines with a parametric number of segments - thanks for your breakdown!
I understand what you’re saying about the shortest line - straight is of course the shortest.
I tried the drawing, and was shocked to see you were right!
So I guess optimizing by length is irrelevant.
I’m still thinking about what exactly I’m looking for in randomization, I’ll update this thread when I’ve defined what I’m trying to do.
Ah, do you have any packages installed that also use the Point namespace?
This is related to a known issue #8796
Try replacing the code in that block with this: