• Create Account

# kidman171

Member Since 14 May 2012
Offline Last Active May 22 2014 06:19 PM

### In Topic: Basic SFML problem, graphics

22 May 2014 - 06:21 PM

As a side note, you should not be clearing and displaying the window inside the while-loop that you are using to poll events. You should only clear and display once per frame.

### In Topic: help computing positions of points

11 February 2014 - 07:14 PM

SeanMiddleditch,

Your solution works perfectly. Thanks so much!

### In Topic: help computing positions of points

11 February 2014 - 04:57 AM

@Nypyren - Ah I see now. The picture clarifies what you mean. That sounds like it would work as well.

@SeanMiddleditch - Good notes I will keep this in mind.

### In Topic: help computing positions of points

10 February 2014 - 10:21 PM

One alternative I can think of:

- Consider D to be a hinge.
- Place a new rect A'B'C'D' and point H' directly adjacent to DEFG and treat this as being a rotated version of ABCD.
- You now know the positions of both H' and H. Calculate the angle formed between them using D as the common vertex.
- Use that angle to rotate points A' through C' about D, back to their expected positions.

You could probably do this entirely with matrices and never actually measure an angle (I suspect), but I'm not good enough with linear algebra to verify that.

Not sure I entirely follow. I am going to try to implement SeanMiddleditch's solution tomorrow. Thanks for your response!

### In Topic: help computing positions of points

10 February 2014 - 10:18 PM

Consider the point K that is the midpoint of DC. HK is a line parallel to BD and AC and perpendicular to DC.

Think of D as being the center of a circle with radius 2. K lies on this circle and is such that HK is a tangent to the circle. Also, lies on the line DC. There's lots of information online about finding tangent lines that pass through a circle and an external point. Pick the tangent line that also intersects the midpoint of DC.

One you find that tangent line, you can trivially find the normal of it along DC. Normalize and scale by 4. That's the location of C. Use this same normal scaled by 2 and -2 relative to H to find A and B.

I understand exactly what you mean. I thought of D being the center of a circle with radius 2 earlier but I have never worked with tangents before so my thought train ended there. I will try to work out a solution with this tomorrow, it looks like a sound solution. Thanks so much!

PARTNERS