Hey Guys,
I’ve come across an issue today when using pointToPointOnTriangle.
Sample code:
basemesh = wrap.Geom(wrap.demoModelsPath + "HeadPolygroups_MakeHuman.obj", scaleFactor=1000)
baryCoord = basemesh.pointToPointOnTriangle(0,0,0)
wrap.selectPoints(basemesh,None,[baryCoord])
The issue is that pointToPointOnTriangle returns a result regardless of the distance from an (X, Y, Z) position. [See attached image]
I’m using this to test determine if a baryCentric point exists at this position. If so then use this point. Otherwise, proceed through.
It would great if you could add some sort of distance tolerance. It could default to none to keep backward compatibility. However if I define a distance tolerance and it fails, throw an exception. This way I can catch the exception and handle it on my end.
So an example might be:
baryCoord = None
basemesh = wrap.Geom(wrap.demoModelsPath + "HeadPolygroups_MakeHuman.obj", scaleFactor=1000)
try:
# Is there a triangle at this position?
baryCoord = basemesh.pointToPointOnTriangle(0,0,0, tolerance=1.0)
except:
# Nope
print "No triangle found at this position"
if baryCoord:
wrap.selectPoints(basemesh,None,baryCoord)
Thanks,
-Sean