# Reproducing the resizing method done by the Resize Align plugin

I imagined that it would be really usefull if I could “reproduce” the resizing method used by the Resize Align plugin (by Stravant). If you do not know what I mean, here is an example bellow:

There are two parts that need to be resized so that they meet at a point,

By selecting two faces with the Resize Align plugin, it will automatically do this for you.

However I have been wanting to recreate this (not as advanced of course) so I could use it in my own scripts, mostly for my own train track creation plugin.

I would appreciate if anyone is able to share some ideas as to how the plugn actually calculates the amount to resize each part by. An idea I had was to find the outer corners, then get the distance between them and the position that they meet at and resize each part by that. In fact I might have answered my question just then while writting this, but it would be interesting to see what other methds there are. Not asking for full scripts, just the basic principles.

One simple solution could be extending them until all vertices of the given faces touch and then just putting negated parts on all the sides of the parts that are perpendicular to the faces selected. After that, just expand the negated parts as necessary and union all the parts.

I’ve personally not done any CSG/Solid modeling in real time with scripts but it should be reasonable. In fact this just inspired me to work on a few side projects.

Seems like a good idea and I am pretty sure you can do unions and such with scripts, I have never tried it though. For me I would want to avoid unions because if I want to manually resize them later, I have to separate them. Also with unions there is a chance of them corrupting I suppose.

Considering this is from 2018 I feel like the system should be quite stable. As for the issue with resizing you could just save a serialized form of the previous stages of the parts effected.

I believe a mathematical way you could solve this problem is by taking both lookVectors of the sides of the parts, finding the point where they intersect with the Cross method, finding the distance between the parts and that point, recalculating size and position and after 20m of work you should have recreated the resize plugin.