Finding the midpoint of a triangle?
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."
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
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."
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."
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.
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 ;}
thank you all. i know how to do it now.
now for a cup of coffee!
As Kent Brockman says:
"ONLY TIME WILL TELL."
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]
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
Popular Topics
Advertisement