# Transform parallelogram to square

This topic is 5040 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I got a parallelogram and a point inside the parallelogram - now I need to transform the point inside to a 2d point in a square. I tried working with diagonals and tried some stuff with matrixes but I can't get it right... For arguments sake I'll explain what I'm doing right now (I don't fully understand if this is correct): 1. Take the points of the parallelogram and call bottom left point A, bottom right B, top right C and top left D. The point inside will be called i (from intersection) 2. I transpose every point by A: A = A - A B = B - A C = C - A D = D - A i = i - A 3. Use the A->B and A->D as the axis in our scewed axis system, since all points are in the same plane, I can use the normal vector as the 3rd axis and generate a matrix accordingly: Matrix: Column1: B (was B - A) Column2: D (was D - A) Column3: (C-A)*(B-A) (= normal of plane if I'm not mistaken) 4. Invert this matrix 5. Transform the i (was i - A) using the matrix, or in code (I'm using Java): matrix.transform(i) After those steps I should have the 2d (I can ignore z as it will be 0) coordinate inside the parallelogram... right? For some reason it seems this is going astray somewhere along but I can't figure out what is going wrong exactly...

1. 1
2. 2
Rutin
23
3. 3
4. 4
frob
16
5. 5

• 9
• 33
• 13
• 12
• 10
• ### Forum Statistics

• Total Topics
632579
• Total Posts
3007168

×