# An Algorithm for Finding the coordinates of the outer circle center of a triangle

Source: Internet
Author: User
//////////////////////////////////////// ///
// Calculates the coordinates of the circle center of the triangle
//////////////////////////////////////// ///
Void circle_center (point * Center, point PT [3], double * radiu)
{
Double x1, x2, X3, Y1, Y2, Y3;
Double X = 0;
Double Y = 0;

X1 = PT [0]. Pt. X;
X2 = PT [1]. Pt. X;
X3 = PT [2]. Pt. X;
Y1 = PT [0]. Pt. Y;
Y2 = PT [1]. Pt. Y;
Y3 = PT [2]. Pt. Y;

X = (y2-y1) * (Y3 * y3-y1 * Y1 + X3 * x3-x1 * X1)-(y3-y1) * (Y2 * y2-y1 * Y1 + x2 * x2-x1 * X1 )) /(2 * (x3-x1) * (y2-y1)-2 * (x2-x1) * (y3-y1 )));
Y = (x2-x1) * (X3 * x3-x1 * X1 + Y3 * y3-y1 * Y1)-(x3-x1) * (X2 * x2-x1 * X1 + y2 * y2-y1 * Y1 )) /(2 * (y3-y1) * (x2-x1)-2 * (y2-y1) * (x3-x1 )));

Center-> pt. x = X;
Center-> pt. Y = y;
* Radiu = (PT [0]. PT. x-x) * (PT [0]. PT. x-x) + (PT [0]. PT. y-y) * (PT [0]. PT. y-y );

}

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.