Esempio n. 1
0
def lstNodesPLine(setBusq,lstPtsPLine):
    '''return the subset of nodes from the set `setBusq` that belong to the line defined by the successive points in list `lstPts`
    '''
    nodAux= setBusq.getNodes
    retval= list() 
    for i in range(0,len(lstPtsPLine)-1):
        segmAux= geom.LineSegment3d(lstPtsPLine[i].getPos,lstPtsPLine[i+1].getPos)
        for n in nodAux:
            p= n.getInitialPos3d
            d= p.distSegmento3d(segmAux)
            if(d<0.01):
                retval.append(n)
    retval= list(set(retval))       #elimina nudos repetidos
    return retval
Esempio n. 2
0
 def getIntersectionWith3DLine(self, p0, p1):
     retval = []
     err = 0.0
     P0proj = geom.Pos2d(p0.x, p0.y)
     P1proj = geom.Pos2d(p1.x, p1.y)
     line2d = geom.Line2d(P0proj, P1proj)
     proj = self.xyPline.getIntersectionWithLine(line2d)
     for p in proj:
         lmb = p.distPos2d(P0proj) / P1proj.distPos2d(P0proj)
         pInt = geom.LineSegment3d(p0, p1).getPoint(lmb)
         err = (pInt.x - p.x)**2 + (pInt.y - p.y)**2
         if (err > 1e-6):
             print("Error finding intersection; err= ", err)
             print("p= ", p)
             print("pInt= ", pInt)
             print("lmb= ", lmb)
         else:
             retval.append(pInt)
     return retval