Need math help

Started by
5 comments, last by Jkom329 15 years, 9 months ago
I'm trying to create/find a general formula for finding point P1 when you know point P0 and the lengths and angles of the parallelograms involved. Here is an example illustration: http://www.lycanth.com/leathrewulfe/example.png Thanks
"Wisdom is proportionate to your reference base. Intelligence is the ability to appropriately use that Wisdom."
Advertisement
I don t think it is possible to solve this, because there is no relation between the small and the large parallelogram.
Looking at you picture the large parallelogram could be anywhere?
Is there some constraint that the small parallelogram's edge's center touches the large one's edge center?

With the information you did provide I see no way to find P1
What you need to know is some kind of information to calculate the translation of the second parallelogram.

P.S.: this sounds a lot like homework
http://www.8ung.at/basiror/theironcross.html
Yes, they would be touching with the smaller adjoining the larger at midpoint on the one side. The parallelograms actually represent rooms as part of a level layout.

Actually, I decided to create a "level" editor as a workaround to me computing the next room point manually. This way I can drag and drop my "rooms" and have the positions already computed by the mouse position plus an offset. I really should have done this right from the beginning anyway.

Thanks, though.

As far as homework...I haven't had homework in over 12 years ;)
"Wisdom is proportionate to your reference base. Intelligence is the ability to appropriately use that Wisdom."
There are two ways how to do this.

1. find center of first, then find center of second, and recompute all points of second paralleogram.

2. If your picture is correct, find center of neighbouring sides, and extend vector into proper location.
We're going to create three vectors and add them. We'll call them v0, v1, v2
I'm using 30 degrees as the angle (half of 60), but I'm showing this in degrees. When you code, you'll have to convert that to radians.

v0) Find the vector going from p0 to the big square (roughly the northeast direction)
v0.x = 200 * cos(30)
v0.y = 200 * sin(30)

v1) The vector going from P0 half way down the width of the smaller rectangle (southeast direction)
v1.x = 50 * cos(30)
v1.y = 50 * sin(-30)

v2) The vector going from P1 half way down the length of the bigger rectangle (southeast direction)
v2.x = 250 * cos(30)
v2.y = 250 * sin(-30)

Then just add the vectors...
vFinal.x = v0.x + v1.x + v2.x
vFinal.y = v0.y + v1.y + v2.y

I knew it was it right in front of me and I just wasn't seeing it.

Thanks, Wild Bill!
"Wisdom is proportionate to your reference base. Intelligence is the ability to appropriately use that Wisdom."
I think v2 should be subtracted, shouldn't it? v0+v1 gives the midpoint of that one side, then subtraction of half the length vector of the larger parallelogram lines up the midpoints.

Another way to see the problem: all of the x components are positive without subtraction, which means v0.x + v1.x < v0.x + v1.x + v2.x, but that puts the x coordinate of vFinal (P1) past the x coordinate of the midpoint v0+v1. From looking at the picture, that shouldn't be right.

This topic is closed to new replies.

Advertisement