# Need math help

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

## Recommended Posts

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

##### Share on other sites
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

##### Share on other sites
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 ;)

##### Share on other sites
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.

##### Share on other sites
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)

vFinal.x = v0.x + v1.x + v2.x
vFinal.y = v0.y + v1.y + v2.y

##### Share on other sites
I knew it was it right in front of me and I just wasn't seeing it.

Thanks, Wild Bill!

##### Share on other sites
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.

1. 1
Rutin
70
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633421
• Total Posts
3011798
• ### Who's Online (See full list)

There are no registered users currently online

×