Ejemplo n.º 1
0
 def shoulddivide(self, rd, contourdelta, contourdotdiff,
                  b2dcontournormals):
     if self.vc.Len() <= contourdelta:
         return False
     if b2dcontournormals:
         nd = P2.Dot(
             P2.ZNorm(
                 P2(self.bar.nodemid.pointzone.v.x,
                    self.bar.nodemid.pointzone.v.y)),
             P2.ZNorm(
                 P2(self.cbar.nodemid.pointzone.v.x,
                    self.cbar.nodemid.pointzone.v.y)))
     else:
         nd = P3.Dot(self.bar.nodemid.pointzone.v,
                     self.cbar.nodemid.pointzone.v) / (rd * rd)
     if nd >= contourdotdiff:
         return False
     return True
Ejemplo n.º 2
0
    def DistLamPpointPZ(self, p0):
        assert self.zlo <= p0.z <= self.zhi, (self.zlo, p0.z, self.zhi)
        lv = self.p - p0
        sd = P2.DotLZ(self.vpfperpnorm, lv)
        sasq = self.rsq - sd * sd

        lvf = P2(p0.x - self.p.x, p0.y - self.p.y)
        if sasq < 0.0:
            return
        sa = math.sqrt(sasq / self.vpfsq)
        lamc = P2.Dot(self.vpf, lvf) / self.vpfsq
        if lamc + sa < 0.0:
            return
        laml = lamc - sa
        if laml < 0.0:
            self.lam = 0.0  # shouldn't happen
        elif laml < self.lam:
            self.lam = laml