def turn_3pt(self, A, B, C, d): line_AB = LineSegment(A, B) line_BC = LineSegment(B, C) q = line_AB.Ly.angle_to(line_BC.Ly, B) Q = (line_AB.Ly + line_BC.Ly).normalized() w = math.copysign(1.0, q) R1 = -(A * Q)**2 / (A.y**2 * (-1 + B.y**2) + 2 * A.x * A.z * B.x * B.z + 2 * A.y * B.y * (A.x * B.x + A.z * B.z) + A.z**2 * (-1 + B.z**2) - A.x**2 * (B.y**2 + B.z**2)) t = math.acos(math.sqrt(math.cos(d)**2 - R1) / math.sqrt(1 - R1)) ABCz = w * (line_AB.Lz + line_BC.Lz).normalized() V = B.deviate(ABCz, t) E = line_AB.projection(V) F = line_BC.projection(V) VEa = V.angle_to(E) VFa = V.angle_to(F) assert (math.isclose(VEa, VFa, rel_tol=1e-4)) BEp = B.angle_to(E) / line_AB.length BFp = B.angle_to(F) / line_BC.length return Blip.from_vector(E), Blip.from_vector(F), VEa, BEp, BFp
def joint(self, A, B, C, wa, wb, wc, radius_max): line_AB = LineCorridor(A, B, wa / earth_radius, wb / earth_radius) line_BC = LineCorridor(B, C, wb / earth_radius, wc / earth_radius) E, F, V, VEa, AEp, BFp = line_AB.make_joint(line_BC) return Blip.from_vector(E), Blip.from_vector(F), VEa, AEp
def turn_4pt(self, A, B, C, D): line_AB = LineSegment(A, B) line_BC = LineSegment(B, C) line_CD = LineSegment(C, D) ABCa = line_AB.surface_angle(line_BC) BCDa = line_BC.surface_angle(line_CD) w1 = math.copysign(1.0, ABCa) w2 = math.copysign(1.0, BCDa) assert (0 < w1 * w2) ABCz = -(line_AB.Lz + line_BC.Lz).normalized() BCDz = -(line_BC.Lz + line_CD.Lz).normalized() ABCy = B @ ABCz BCDy = C @ BCDz # the center of the circle inscribed is V V = -(ABCy @ BCDy).normalized() * math.copysign(1.0, ABCa) E = line_AB.projection(V) F = line_BC.projection(V) G = line_CD.projection(V) VEa = V.angle_to(E) VFa = V.angle_to(F) VGa = V.angle_to(G) assert (math.isclose(VEa, VFa, rel_tol=1e-4) and math.isclose(VFa, VGa, rel_tol=1e-4) and math.isclose(VGa, VEa, rel_tol=1e-4)) AEp = A.angle_to(E) / line_AB.length BFp = B.angle_to(F) / line_BC.length CGp = C.angle_to(G) / line_CD.length return Blip.from_vector(E), Blip.from_vector(F), Blip.from_vector( G), w1 * VFa, AEp, BFp, CGp
def turn_3pt(self, A, B, C, radius) : line_AB = LineTo(A, B) line_BC = LineTo(B, C) ABCa = line_AB.surfacea(line_BC) ABCz = - (line_AB.Lz + line_BC.Lz).normalized() V = B.deviate(ABCz, radius) E = line_AB.projection(V) F = line_BC.projection(V) VEa = V.angle_to(E) VFa = V.angle_to(F) BEp = B.angle(E) / line_AB.angle_ab BFp = B.angle(F) / line_EF assert( math.isclose(VEa, VFa) ) return Blip.from_vector(E), Blip.from_vector(F), VEa