Center of a triangle

Started by
3 comments, last by Jallen 23 years ago
Hi, Anyone know of a quick way to find the center of an arbitrary triangle? Thanks, Jason A. --- I write code. DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)
Advertisement
There are many different types of center...

The center of gravity of the entire triangle?
It''s at the point where the three lines joining corners to the midpoints of their opposite sides meet.

The center of gravity of the three corners?
It''s at the point where the three angular bisectors meet.

The orthocenter?
It''s at the point where the lines from the corners cast perpendicularly to the opposite sides all meet.

The circumcenter?
It''s at the point where the three perpendicular bisectors of the sides all meet.

The incenter?
I''m not entirely sure, to be honest. It might be one of the first two, but don''t bet on it.
Whichever is fastest/easiest to calculate. I just want the rough center of the triangle, its just for looks.

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)
i have no idea what this does, nor do i know if it''s the fastest or best routine, but i just average the points. i don''t know what consequences this issues, because i haven''t run into any problems yet. like this:

(this is fairly pseudo, so please don''t criticize on the syntax)
(but go ahead and criticize the algorithm, cuz i''m sure it''s not the best way to do anything.)

int numpoints = 3; //3 vertices
int x = 0;
int y = 0;
int z = 0;
for(int i = 0; i < numpoints; i++)
{
x += point.x;
y += point.y;<br> z += point.z;<br>}<br><br>x /= numpoints;<br>y /= numpoints;<br>z /= numpoints;<br><br>a2k </i>
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Cool! That works great

Thanks a million,

Jason A.

---
I write code.
DelphiGL (http://delphigl.cfxweb.net)
---I write code.DelphiGL (http://delphigl.cfxweb.net)

This topic is closed to new replies.

Advertisement