def dist_sqr_at_l(self, p):
"""return squared distance and arc length at nearest point to p on biarc"""
p1, t1, cha1 = biarc.point_on_circle(self.p0, self.J, self.t0, p)
p2, t2, cha2 = biarc.point_on_circle(self.J, self.p1, self.Jt, p)
c1, k1, a1, l1, c2, k2, a2, l2 = self.circleparameters()
mind, minl = None, None
if 0 < t1 < 1:
mind = la.norm2(p1 - p)
aa1 = 2 * m.acos(cha1)
minl = aa1 / abs(k1) if k1 != 0 else t1 * l1
if 0 < t2 < 1 and (not mind or la.norm2(p2 - p) < mind):
mind = la.norm2(p2 - p)
aa2 = 2 * m.acos(cha2)
minl = l1 + (aa2 / abs(k2) if k2 != 0 else t2 * l2)
return mind, minl
###########################################################################
评论列表
文章目录