Jump to content


Photo

Different Centers Of A Triangle


  • Please log in to reply
3 replies to this topic

#1 P-entertainment

P-entertainment

    GMC Member

  • GMC Member
  • 1429 posts

Posted 24 July 2009 - 11:04 AM

I have searched this forum without finding those scripts (or rather calculations) so I decided to post them here if anyone else asks for them (click images for interactive demonstration of the points):

xa,ya=Point 1 in the triangle
xb,yb=Point 2 in the triangle
xc,yc=Point 3 in the triangle
A=Distance of BC
B=Distance of AC
C=Distance of AB
Incenter:
Posted Image
xi=((A*xa)+(C*xc)+(B*xb))/(A+B+C)
yi=((A*ya)+(C*yc)+(B*yb))/(A+B+C)

Centroid:
Posted Image
xe=(1/3)*(xa+xb+xc)
ye=(1/3)*(ya+yb+yc)

Orthocenter:
Posted Image
xo=(xa*xb*(ya-yb)+xb*xc*(yb-yc)+xc*xa*(yc-ya)-(ya-yb)*(yb-yc)*(yc-ya))/(xc*yb-xb*yc+xa*yc-xc*ya+xb*ya-xa*yb)
yo=(ya*yb*(xa-xb)+yb*yc*(xb-xc)+yc*ya*(xc-xa)-(xa-xb)*(xb-xc)*(xc-xa))/(yc*xb-yb*xc+ya*xc-yc*xa+yb*xa-ya*xb)

Circumpoint (Written by Tepi):
http://mathworld.wol...center_1000.gif Too bad we're not allowed to use more than 3 images ^_^
http://www.mathopenr...rcumcenter.html
t = .5*( (y1-y3)*(y2-y3) - (x2-x3)*(x3-x1) ) / ( (y1-y2)*(x3-x1) - (y1-y3)*(x2-x1) );
Px = round((x1+x2)/2 + (y1-y2)*t);
Py = round((y1+y2)/2 + (x2-x1)*t);

The Orthocenter one can probably be simplified a bit, but they all work as they should.

Edited by P-entertainment, 24 July 2009 - 11:49 AM.

  • 0

#2 The eleventh plague of Egypt

The eleventh plague of Egypt

    GMC Member

  • GMC Member
  • 1045 posts
  • Version:Unknown

Posted 26 July 2009 - 02:29 PM

Good to know, the centroid may be useful to me.
  • 0

#3 jinnyjuice

jinnyjuice

    GMC Member

  • New Member
  • 14 posts

Posted 28 July 2009 - 02:08 AM

wow thumbs up
  • 0

#4 P-entertainment

P-entertainment

    GMC Member

  • GMC Member
  • 1429 posts

Posted 31 July 2009 - 03:29 PM

No problem, currently I'm using the centroid and the circumcenter for my work :)
  • 0