|
-
Mar 21st, 2005, 09:00 AM
#1
Thread Starter
Not NoteMe
Mid-point for a 4 sided polygon AKA point equidistant from 4 points [RESOLVED]
I have a coordinate system defined as follows:

TL, TR, BL and BR are the top left, top right etc. points of my polygon.
The X-axis runs from along the top edge and the Y-axis runs across the polygon, from the top edge to the bottom edge.
Hopefully the diagram kindly provided by kedaman shows this clearly. In the drawing X is 0.3 and Y is 0.8
This works well, as i change the vertex points a point defined in the polygon coordinate space moves as expected.
The trouble is that DirectX texture-maps only triangles. As a result i've split all my polygons into 2 triangles, with the diagonal running from the top right to the bottom left.
The upshot of all this is that my points on my polygon don't match the rendered texture as the vertices move. Also, when the polygon is stretched it doesn't look right, since one triangle could be very stretched, but not the other.
What i think may work is splitting the polygon into 4 triangles, creating a centre point in the middle of the polygon.
Currently what i do is get the intersection between the 2 diagnoals of the polygon and treat that as the centre. This doesn't work, or look good.
What i think might work is to position the centre point such that it is an equal distance from all 4 vertices of my polygon.
This is what i need help with. Currently i'm thinking that i do it by working out 2 lines (one for each pair of lines) such that all points on the lines are equidistant from 2 points. I then find the intersection and that will be the point that's equidistant from all 4. I'm not sure if this is right though, so if anyone know how to do this another way that's fine.
Thinking about it, i'm not sure that it is possible to get a point equidistant from 4 points, however i have a feeling that the above method may look good anyway.
I'm not sure quite how to approch this problem, so any help would greatly be appreciated.
Last edited by SLH; Mar 21st, 2005 at 10:20 AM.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|