MCPcopy Create free account
hub / github.com/CadQuery/cadquery / angle_cost

Function angle_cost

cadquery/occ_impl/sketch_solver.py:137–154  ·  view source on GitHub ↗
(x1, t1, x10, x2, t2, x20, val)

Source from the content-addressed store, hash-verified

135
136
137def angle_cost(x1, t1, x10, x2, t2, x20, val):
138
139 if t1 == "LINE" and t2 == "LINE":
140 v1 = gp_Vec2d(*(x1[2:] - x1[:2]))
141 v2 = gp_Vec2d(*(x2[2:] - x2[:2]))
142 elif t1 == "LINE" and t2 == "CIRCLE":
143 v1 = gp_Vec2d(*(x1[2:] - x1[:2]))
144 v2 = arc_first_tangent(x2)
145 elif t1 == "CIRCLE" and t2 == "LINE":
146 v1 = arc_last_tangent(x1)
147 v2 = gp_Vec2d(*(x2[2:] - x2[:2]))
148 elif t1 == "CIRCLE" and t2 == "CIRCLE":
149 v1 = arc_last_tangent(x1)
150 v2 = arc_first_tangent(x2)
151 else:
152 raise invalid_args(t1, t2)
153
154 return v2.Angle(v1) - val
155
156
157def length_cost(x, t, x0, val):

Callers

nothing calls this directly

Calls 3

arc_first_tangentFunction · 0.85
arc_last_tangentFunction · 0.85
invalid_argsFunction · 0.85

Tested by

no test coverage detected