Finding the midpoint of a triangle?

Started by
13 comments, last by Nodger 20 years, 8 months ago
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."
Advertisement
Bisect the three angles and see where the lines cross. Ta Da! Simple as
P.S. The faster the better! i need this for a realtime radiosity engine im working on.
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

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."
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."
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.
a function would be:
POINT Find_Center (TRIANGLE T){// variablesPOINT center ;// the math and rest of codecenter.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 ;} 
Mike
thank you all. i know how to do it now.
now for a cup of coffee!

As Kent Brockman says:
"ONLY TIME WILL TELL."
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]

This topic is closed to new replies.

Advertisement