Exemple #1
0
def center_of_3points_arc(point1: "Vertex", point2: "Vertex",
                          point3: "Vertex") -> Vec3:
    """
    Calc center point of 3 point arc. ConstructionCircle is defined by 3 points on the circle: point1, point2 and point3.
    """
    ray1 = ConstructionRay(point1, point2)
    ray2 = ConstructionRay(point1, point3)
    midpoint1 = lerp(point1, point2)
    midpoint2 = lerp(point1, point3)
    center_ray1 = ray1.orthogonal(midpoint1)
    center_ray2 = ray2.orthogonal(midpoint2)
    return center_ray1.intersect(center_ray2)
Exemple #2
0
 def test_init_with_angle(self):
     point = (10, 10)
     ray = ConstructionRay(point, angle=0)
     ray_normal = ray.orthogonal(point)
     assert ray_normal._is_vertical is True
     ray = ConstructionRay(point, angle=-HALF_PI)
     assert ray._is_horizontal is False
     assert ray._is_vertical is True
Exemple #3
0
 def _get_point_on_dimline(point: "Vertex",
                           dimray: ConstructionRay) -> Vec3:
     """get the measure target point projection on the dimension line"""
     return dimray.intersect(dimray.orthogonal(point))
Exemple #4
0
 def test_ray2d_normal_horizontal(self):
     ray = ConstructionRay((10, 10), (20, 10))  # horizontal line
     ortho = ray.orthogonal((3, 3))
     point = ray.intersect(ortho)
     assert point.isclose(Vec3(3, 10))
Exemple #5
0
 def test_ray2d_normal(self):
     ray = ConstructionRay((-10, 3), (17, -7))
     ortho = ray.orthogonal((3, 3))
     point = ray.intersect(ortho)
     assert point.isclose(Vec3(1.4318, -1.234), abs_tol=1e-4)
Exemple #6
0
 def test_ray2d_normal_vertical(self):
     ray = ConstructionRay((10, 1), (10, -7))  # vertical line
     ortho = ray.orthogonal((3, 3))
     point = ray.intersect(ortho)
     assert point.isclose(Vec3(10, 3))