Mirror scan points function

What do you guys think?

Say I have a selection of points:

print “Select Right side of model…”

scanPoints, basePoints = wrap.selectPoints(scanMesh, baseMesh)

As an option, the user can take a set of points and have that mirrored. The result would be both set of points (left and right combined). Essentially mirror the X and use the mesh argument to determine the closest Triangle. Return list of PointOnTriangle. Some checks would need to be in place if the user’s selection crossed axis.


mirroredScanPoints = wrap.mirrorPoints(scanMesh, scanPoints)
mirroredBasePoints = wrap.mirrorPoints(baseMesh, basePoints )

Hey Sean,

Good idea! I think that can be done with current functionality of WrapX. At least for the basemesh. Let me come back with an example script later today.

Hello Sean!

I wrote a script to demonstrate how it can be achieved in current WrapX. Notice that I use wrap.selectPoints() in a simpler way than usual - with just one geom. I uploaded a new version of WrapX which supports this way of using wrap.selectPoints().

You can download it here:
http://russian3dscanner.com/downloads/R3DS_WrapX_1.3.3_64Bit_Setup.exe
http://russian3dscanner.com/downloads/R3DS_WrapX_1.3.3_64Bit_Setup.md5sum.txt

And here are release notes:
http://russian3dscanner.com/docs/WrapX/WhatsNew133.html


# function calculates mirrored points and returns united list of points
def mirrorPoints(points, geom):
    
    mirroredPoints = []
    
    for point in points:
        (x,y,z) = geom.pointOnTriangleToPoint(point)
        mirroredPoint = geom.pointToPointOnTriangle(-x,y,z)
        mirroredPoints.append(mirroredPoint)
        
    return mirroredPoints


# load geom
geom = wrap.Geom(wrap.demoModelsPath + '/HeadPolygroups_MakeHuman.obj')

# predefined points from left side of head
points = [
    wrap.PointOnTriangle(3640,0.5,0.0),
    wrap.PointOnTriangle(3753,0.3,0.0),
    wrap.PointOnTriangle(4399,0.19,0.0),
    wrap.PointOnTriangle(3132,0.0,0.6),
]

print "Just showing original points, click 'OK'"
points = wrap.selectPoints(geom,None,points)

# calculate mirrored points
pointsWithMirrored = points + mirrorPoints(points,geom)

print "Showing original and mirrored points"
wrap.selectPoints(geom,None,pointsWithMirrored)

Very cool! You guys are on it. 8)

Ok, I got another use case for you.

I have a high res mesh with a selection of polygonIndices (Ex. [1, 3, 5])

I’d like to take these polygons and create a polyGroup
Like:
New geom with the new polyGroup

highResCopy = highResGeom.createPolyGroup(polygonIndices)

Then transfer that polyGroup from the high res copy to the low res

transferedPolyGeom = wrap.transferPolygroups(highResCopy, lowResCopy)

This way I can determine polyGroups at runtime instead of having them determined when I load in the geo.
Doable?