Calculating the position of trapezoid to place it next to another object

I made a fiddle with the code I use to make these objects, but keep in mind that in my ‘real’ code the object can change in dimensions and the cut can vary in angle.

EDIT: My code starts at line 563, above that is just the CSG library

https://jsfiddle.net/ums2gw9n/

I also made some screenshots to show what I have, the first three screenshots are what is working fine (when the angle is 90 degrees or less) and the fourth is when it stops working like I want it to, but that is because my code is not subtracting the position of the corner on the bottom that I am trying to calculate.

110 120 130 135

1 Like