#### Archived

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

# Center of a triangle

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

## Recommended Posts

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)

##### Share on other sites
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.

##### Share on other sites
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)

##### Share on other sites
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[i].y;
z += point[i].z;
}

x /= numpoints;
y /= numpoints;
z /= numpoints;

a2k

##### Share on other sites
Cool! That works great

Thanks a million,

Jason A.

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

• 9
• 13
• 41
• 15
• 14