Package MeatEngine :: Package Math :: Package Voronoi :: Module test
[hide private]
[frames] | no frames]

Module test

source code

Functions [hide private]
 
findCircumCenter(p1, p2, p3)
From a post by Dave Watson:...
source code
 
pointIsValid(p, rSqr) source code
Variables [hide private]
  EPSILON = 0.001
  imX = 2400
  imY = 3000
  greenGrass = (128, 255, 128)
  greyGreen = (100, 240, 100)
  backgroundColor = (255, 255, 255)
  adjacencyColor = (180, 240, 240)
Function Details [hide private]

findCircumCenter(p1, p2, p3)

source code 

From a post by Dave Watson:

This approach uses Cramer's Rule to find the intersection of two
perpendicular bisectors of triangle edges


p_0 = (((a_0 - c_0) * (a_0 + c_0) + (a_1 - c_1) * (a_1 + c_1)) / 2 * (b_1 - c_1) 
-  ((b_0 - c_0) * (b_0 + c_0) + (b_1 - c_1) * (b_1 + c_1)) / 2 * (a_1 - c_1)) 
/ D

p_1 = (((b_0 - c_0) * (b_0 + c_0) + (b_1 - c_1) * (b_1 + c_1)) / 2 * (a_0 - c_0)
-  ((a_0 - c_0) * (a_0 + c_0) + (a_1 - c_1) * (a_1 + c_1)) / 2 * (b_0 - c_0))
/ D

where D = (a_0 - c_0) * (b_1 - c_1) - (b_0 - c_0) * (a_1 - c_1)

The _squared_ circumradius is then:

r^2 = (c_0 - p_0)^2 + (c_1 - p_1)^2