# make the angle between two segments of a spline 90 degrees

Hello,

I am looking for a script to do the following, when we select a vertex of a spline, to convert the angle between them to 90 degrees.

would appreciate the help.

## Comment viewing options

### thank you jahman, in the

thank you jahman, in the case, I am talking about, let's consider we have a rectangle we are looking at from top view, we are looking to be able to convert the shape on the left into the shape on the right making the angle between two segments on the XY plane.

ideally, I can select a vertex and press a key, and this would convert the angle between the two segments of that vertex into a 90-degree angle. if this works by selecting all vertices with a single click that would be perfect if it's possible.

AttachmentSize
1_f.jpg 30.21 KB

### .

I can't think of a good method for an arbitrary shape.
How would you handle a shape with odd amount of segments? ;)
Let's say a triangle ;)

### the purpose of this script is

the purpose of this script is to quickly trace footprints of buildings from a 2D satellite image, and then in case these buildings have an even number of segments to make the angles 90 degrees, the rest I could just adjust manually, or delete all in all. it's just to generate schematic buildings in the background for some aerial perspective surrounding buildings of an architectural project.

there are other alternatives for that process, most of them rely on extracting data from open street maps ( which is something we do for places that have data available ) but in some cases, we have to rely on good old fashion tracing, so a script like this although not useful much elsewhere could come in handy to tidy things up a little bit :D.

would love to dive into max script at some point in the future, but for the time being, it might be a better idea to leave it to the experts :D :P.

### .

looks like it is working :)

and then

it is not :)

### oh wow, it's exactly what is

oh wow, it's exactly what is needed. thank you for the efforts, I hope this script might be useful for someone else too at any point in life :P.
if you manage to make it work please give me a head's up :D

### .

I don't have a PhD degree to make it work as it should :)
Here's a paper on the subject: Least squares based polygon squaring

Looks great. But it doesn't seem trivial to implement.

### .

There're more than one way of making them perpendicular

In case when all three knots belong to a line there're infinite valid positions on a three dimensional circle