I noticed no one used basic trig to solve this, which seems odd.
The angle from O4O1Y (which we'll call a) is cot(|O1.x-O4.x|/|O1.y-O4.y|)
The angle from xO1N3 (b) is cot(|O1.x-N3.x|/|O1.y-N3.y|)
"The length of the perimeter remains constant"? Huh? Point N3 can be dragged anywhere, so the length of the perimeter can change significantly. In my example images, the perimeter remained reasonably constant, but that's only happenstance.
Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.
True that opposite sides are constrained to be equal; but to be rectangular, must also constrain angles to be 90 degress (otherwise you may end up with a parallelogram).
Translate the top rectangle linearly so that O1 -> (0,0). Then after some changes, translate the new rectangle back to O1's original position.
With that linear translation understanding, we can assume that O1 is at (0,0). Now you can treat O2, O3, and O4 as vectors in the plane.
Define unit vectors, u1 and u2:
u1 = O2/|O2|, where |O2| is the length of O2
u2 = O4/|O4|
Notice that O2 is the projection of O3 onto the line defined by b*u1 where b is some constant.
Notice that N2 is the projection of N3 onto the line defined by c*u1 where c is some constant.
Since u1 and u2 form an orthonormal basis in the plane, then the projection is related by
|N2| = N3 .* u1 where .* is the dot product between N3 and u1 http://en.wikipedia.org/wiki/Dot_product
After calculating |N2|, then N2 = |N2| u1
Similarly, compute N4.
Translate 4 points linearly back to original O1 and you have the coordinates.
Since u1 and u2 form an orthonormal basis in the plane, then the projection is related by
|N2| = N3 .* u1 where .* is the dot product between N3 and u1
If you can move N3 to the left of O4, for example, then the dot product of N3 and u1 can be negative number.
So, to be more general allowing for any N3, then to get the coordinates of N2, you simply say: N2 = (N3 .* u1) u1
Now, the ± signs take care of themselves.
(Again, as mentioned earlier, we first translated the system where O1 is the origin).
I noticed no one used basic trig to solve this, which seems odd. The angle from O4O1Y (which we'll call a) is cot(|O1.x-O4.x|/|O1.y-O4.y|)
The angle from xO1N3 (b) is cot(|O1.x-N3.x|/|O1.y-N3.y|)
The length O1N3 is sqrt((O1.x-N3.x)^2 + (O1.y-N3.y)^2)
The length O1N4 is cos(a+b)*O1N3
So N4.x is O1.x - sin(a)*O1N4
and N4.y is O1.y - cos(a)*O1N4
The length O1N2 is sin(a+b)*O1N3
So N2.x is O1.x + cos(a)*O1N2
and N2.y is O1.y - sin(a)*O1N2
0
Featured Post
Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20.
The divisors of 12 are 1, 2, 3, 4, 6, 12
The divisors of 20 are 1, 2, 4, 5, 10 20
The highest number among the c…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg).
If you're interested in additional methods for monitoring bandwidt…