Skip to content

Commit

Permalink
Removal of extra path segments due to bone smoothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampert committed Nov 13, 2016
1 parent 788b28b commit 1472a2b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 132 deletions.
11 changes: 9 additions & 2 deletions src/Mod/Draft/DraftGeomUtils.py
Expand Up @@ -227,7 +227,7 @@ def findEdge(anEdge,aList):
return None


def findIntersection(edge1,edge2,infinite1=False,infinite2=False,ex1=False,ex2=False,dts=True) :
def findIntersection(edge1,edge2,infinite1=False,infinite2=False,ex1=False,ex2=False,dts=True,findAll=False) :
'''findIntersection(edge1,edge2,infinite1=False,infinite2=False,dts=True):
returns a list containing the intersection point(s) of 2 edges.
You can also feed 4 points instead of edge1 and edge2. If dts is used,
Expand Down Expand Up @@ -330,10 +330,17 @@ def getLineIntersections(pt1,pt2,pt3,pt4,infinite1,infinite2):
pt4 = arc.Vertexes[-1].Point
center = arc.Curve.Center

int = []
# first check for coincident endpoints
if (pt1 in [pt3,pt4]):
if findAll:
int.append(pt1)
else:
return [pt1]
elif (pt2 in [pt3,pt4]):
if findAll:
int.append(pt2)
else:
return [pt2]

if DraftVecUtils.isNull(pt1.sub(center).cross(pt2.sub(center)).cross(arc.Curve.Axis)) :
Expand All @@ -348,7 +355,7 @@ def getLineIntersections(pt1,pt2,pt3,pt4,infinite1,infinite2):
dOnLine = (arc.Curve.Radius**2 - toLine.Length**2)**(0.5)
onLine = Vector(dirVec)
onLine.scale(dOnLine,dOnLine,dOnLine)
int = [center.add(toLine).add(onLine)]
int += [center.add(toLine).add(onLine)]
onLine = Vector(dirVec)
onLine.scale(-dOnLine,-dOnLine,-dOnLine)
int += [center.add(toLine).add(onLine)]
Expand Down

0 comments on commit 1472a2b

Please sign in to comment.