@@ -113,13 +113,13 @@ public static HCoordinate perpendicularBisector(Coordinate a, Coordinate b)
113113 * @return the circumradius of the triangle
114114 */
115115 public static double circumradius (Coordinate a , Coordinate b , Coordinate c ) {
116- double A = a .distance (b );
117- double B = b .distance (c );
118- double C = c .distance (a );
116+ double lenAB = a .distance (b );
117+ double lenBC = b .distance (c );
118+ double lenCA = c .distance (a );
119119 double area = area (a , b , c );
120120 if (area == 0.0 )
121121 return Double .POSITIVE_INFINITY ;
122- return (A * B * C ) / (4 * area );
122+ return (lenAB * lenBC * lenCA ) / (4 * area );
123123 }
124124
125125 /**
@@ -262,7 +262,7 @@ private static double det(double m00, double m01, double m10, double m11)
262262 * the point at which the bisectors of the triangle's angles meet. It is the
263263 * centre of the triangle's <i>incircle</i>, which is the unique circle that
264264 * is tangent to each of the triangle's three sides
265- * (and hence the maximum inscribed circle ).
265+ * (and hence the Maximum Inscribed Circle ).
266266 * <p>
267267 * The incentre always lies within the triangle.
268268 *
@@ -276,14 +276,13 @@ private static double det(double m00, double m01, double m10, double m11)
276276 */
277277 public static Coordinate inCentre (Coordinate a , Coordinate b , Coordinate c )
278278 {
279- // the lengths of the sides, labelled by their opposite vertex
280- double len0 = b .distance (c );
281- double len1 = a .distance (c );
282- double len2 = a .distance (b );
283- double circum = len0 + len1 + len2 ;
284-
285- double inCentreX = (len0 * a .x + len1 * b .x + len2 * c .x ) / circum ;
286- double inCentreY = (len0 * a .y + len1 * b .y + len2 * c .y ) / circum ;
279+ double lenAB = a .distance (b );
280+ double lenBC = b .distance (c );
281+ double lenCA = c .distance (a );
282+ double circum = lenBC + lenCA + lenAB ;
283+
284+ double inCentreX = (lenBC * a .x + lenCA * b .x + lenAB * c .x ) / circum ;
285+ double inCentreY = (lenBC * a .y + lenCA * b .y + lenAB * c .y ) / circum ;
287286 return new Coordinate (inCentreX , inCentreY );
288287 }
289288
@@ -368,9 +367,9 @@ public static Coordinate angleBisector(Coordinate a, Coordinate b,
368367 * Uses the fact that the lengths of the parts of the split segment are
369368 * proportional to the lengths of the adjacent triangle sides
370369 */
371- double len0 = b .distance (a );
372- double len2 = b .distance (c );
373- double frac = len0 / (len0 + len2 );
370+ double lenBA = b .distance (a );
371+ double lenBC = b .distance (c );
372+ double frac = lenBA / (lenBA + lenBC );
374373 double dx = c .x - a .x ;
375374 double dy = c .y - a .y ;
376375
@@ -393,8 +392,7 @@ public static Coordinate angleBisector(Coordinate a, Coordinate b,
393392 */
394393 public static double area (Coordinate a , Coordinate b , Coordinate c )
395394 {
396- return Math
397- .abs (((c .x - a .x ) * (b .y - a .y ) - (b .x - a .x ) * (c .y - a .y )) / 2 );
395+ return Math .abs (((c .x - a .x ) * (b .y - a .y ) - (b .x - a .x ) * (c .y - a .y )) / 2 );
398396 }
399397
400398 /**
0 commit comments