Esempio n. 1
0
def kind(vertex: Point,
         first_ray_point: Point,
         second_ray_point: Point,
         dot_producer: QuaternaryPointFunction[Scalar] = dot.multiply) -> Kind:
    return Kind(
        to_sign(dot_producer(vertex, first_ray_point, vertex,
                             second_ray_point)))
Esempio n. 2
0
def orientation(
    vertex: Point,
    first_ray_point: Point,
    second_ray_point: Point,
    cross_producer: QuaternaryPointFunction[Scalar] = cross.multiply
) -> Orientation:
    return Orientation(
        to_sign(
            cross_producer(vertex, first_ray_point, vertex, second_ray_point)))
Esempio n. 3
0
def test(point: Point, first: Point, second: Point, third: Point) -> Location:
    first_dx, first_dy = first.x - point.x, first.y - point.y
    second_dx, second_dy = second.x - point.x, second.y - point.y
    third_dx, third_dy = third.x - point.x, third.y - point.y
    return Location(1 +
                    to_sign((first_dx * first_dx + first_dy * first_dy) *
                            (second_dx * third_dy - second_dy * third_dx) -
                            (second_dx * second_dx + second_dy * second_dy) *
                            (first_dx * third_dy - first_dy * third_dx) +
                            (third_dx * third_dx + third_dy * third_dy) *
                            (first_dx * second_dy - first_dy * second_dx)))
Esempio n. 4
0
def test(point: Point, first: Point, second: Point, third: Point) -> Scalar:
    point_x, point_y = rationalize(point.x), rationalize(point.y)
    first_dx, first_dy = (rationalize(first.x) - point_x,
                          rationalize(first.y) - point_y)
    second_dx, second_dy = (rationalize(second.x) - point_x,
                            rationalize(second.y) - point_y)
    third_dx, third_dy = (rationalize(third.x) - point_x,
                          rationalize(third.y) - point_y)
    return Location(1 +
                    to_sign((first_dx * first_dx + first_dy * first_dy) *
                            (second_dx * third_dy - second_dy * third_dx) -
                            (second_dx * second_dx + second_dy * second_dy) *
                            (first_dx * third_dy - first_dy * third_dx) +
                            (third_dx * third_dx + third_dy * third_dy) *
                            (first_dx * second_dy - first_dy * second_dx)))