Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Nodger

Finding the midpoint of a triangle?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anybody know how to find the middle point of a triangle in 3-d space? it doesnt have to be the exact middle, just near the middle. thanx in advance. As Kent Brockman says: "ONLY TIME WILL TELL."

Share this post


Link to post
Share on other sites
Advertisement
Define middle? The center of gravity? The center of the smallest enclosing circle? Center of the biggest enclosed circle?

The middle of two points is the point is their isobarycentric point, so this should be the same for three points :

xM = ( xA + xB + xC ) / 3
yM = ( yA + yB + yC ) / 3

ToohrVyk

Share this post


Link to post
Share on other sites
Sorry, but im not a bloody mathmatition. can you explain how to do it in terms of a function

As Kent Brockman says:
"ONLY TIME WILL TELL."

Share this post


Link to post
Share on other sites
Ok, I''ll rephrase the question: If I have 3 sets of 3 co-ordinates representing 3 points of a triangle in 3d space, how can i create a function that will spit out 3 co-ordinates that represent the mid-point of that triangle?

As Kent Brockman says:
"ONLY TIME WILL TELL."

Share this post


Link to post
Share on other sites
Almost exactly as was written above. If your function takes in 3 points, p1, p2, and p3, and returns another point p then it is just:

p.x=(p1.x+p2.x+p3.x)/3;

and the same for y and z.

Share this post


Link to post
Share on other sites
a function would be:

POINT Find_Center (TRIANGLE T)
{
// variables
POINT center ;

// the math and rest of code
center.x = (T.x[0] +T.x[1] +T.x[2] )/3;
center.y = (T.y[0] +T.y[1] +T.y[2] )/3;
center.z = (T.z[0] +T.z[1] +T.z[2] )/3;

return center ;
}

Share this post


Link to post
Share on other sites
thank you all. i know how to do it now.
now for a cup of coffee!

As Kent Brockman says:
"ONLY TIME WILL TELL."

Share this post


Link to post
Share on other sites
The average has some flaws. Imagine a triangle with a very short side, comparatively. The center will be biased towards it.

I would use the center defined by the medians.

Cédric

EDIT: The medians do define a center, do they?

[edited by - Cedric on August 16, 2003 11:25:36 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!