Further study:

- Neither side of the created âsquareâ is equal to any other: It is not a Rectangle.
- The vertices
**A*** and **B*** are at least in place.
- The
**C*** vertex was projected From point **C** in the right direction but at the wrong distance.
- I have no idea how the
**D*** vertex was created. Only its vertical coordinate is okay.

One possible way to do it: (Perhaps it helps for SU developers, but hopefully they know better âŚ )

When we detect the conditions âFrom pointâ (**C**) and âSquareâ, we know which two coordinates of the cursor are âfixedâ, so we can calculate the side length of the square, as well as the **AC** distance. (Using the corresponding coordinates of the first point (**B**) and **C**).

Then, using Pythagorean theorem, we can calculate the distance of offset (**CC***) e.g.:

`CC* = sqrt(AB^2 - AC^2) = sqrt( 100^2 -61,803399^2 ) = 78,615138`

The position of **C*** can be obtained by offset the point **C** by the `vector`

. This `vector`

obtained from the position of the âForm pointâ (**C**) and the actual cursor, the length of the vector must be set to the previously calculated distance (**CC***).

##
Ruby dev note

The âFrom pointâ position is not available in the Ruby API, so Ruby developers need to work harder, but the C-side should have it.