public Vector3 findClosePoint ( Vector3 pointToDelete ) { Triangle triangle = find ( pointToDelete ) ; Vector3 p1 = triangle . p1 ( ) ; Vector3 p2 = triangle . p2 ( ) ; double d1 = distanceXY ( p1 , pointToDelete ) ; double d2 = distanceXY ( p2 , pointToDelete ) ; if ( triangle . isHalfplane ( ) ) { if ( d1 <= d2 ) { return p1 ; } else { return p2 ; } } else { Vector3 p3 = triangle . p3 ( ) ; double d3 = distanceXY ( p3 , pointToDelete ) ; if ( d1 <= d2 && d1 <= d3 ) { return p1 ; } else if ( d2 <= d1 && d2 <= d3 ) { return p2 ; } else { return p3 ; } } }
return a point from the trangulation that is close to pointToDelete