def testPlane(self):
    mesh = IECoreScene.MeshPrimitive.createPlane(imath.Box2f(imath.V2f((- 1)), imath.V2f(1)), imath.V2i(10))
    IECoreScene.TriangulateOp()(input=mesh, copyInput=False)
    meshReversed = mesh.copy()
    IECoreScene.MeshAlgo.reverseWinding(meshReversed)
    evaluator = IECoreScene.MeshPrimitiveEvaluator(mesh)
    evaluatorReversed = IECoreScene.MeshPrimitiveEvaluator(meshReversed)
    result = evaluator.createResult()
    resultReversed = evaluatorReversed.createResult()
    for i in range(0, 1000):
        p = imath.V3f(random.uniform((- 1.0), 1.0), random.uniform((- 1.0), 1.0), 0)
        evaluator.closestPoint(p, result)
        evaluatorReversed.closestPoint(p, resultReversed)
        self.assertEqual(resultReversed.normal(), (- result.normal()))
        reversedUV = resultReversed.vec2PrimVar(meshReversed['uv'])
        uv = result.vec2PrimVar(mesh['uv'])
        self.assertAlmostEqual(reversedUV[0], uv[0], delta=0.0001)
        self.assertAlmostEqual(reversedUV[1], uv[1], delta=0.0001)
def testPlane(self):
    mesh = IECoreScene.MeshPrimitive.createPlane(imath.Box2f(imath.V2f((- 1)), imath.V2f(1)), imath.V2i(10))
    IECoreScene.TriangulateOp()(input=mesh, copyInput=False)
    meshReversed = mesh.copy()
    IECoreScene.MeshAlgo.reverseWinding(meshReversed)
    evaluator = IECoreScene.MeshPrimitiveEvaluator(mesh)
    evaluatorReversed = IECoreScene.MeshPrimitiveEvaluator(meshReversed)
    result = evaluator.createResult()
    resultReversed = evaluatorReversed.createResult()
    for i in range(0, 1000):
        p = imath.V3f(random.uniform((- 1.0), 1.0), random.uniform((- 1.0), 1.0), 0)
        evaluator.closestPoint(p, result)
        evaluatorReversed.closestPoint(p, resultReversed)
        self.assertEqual(resultReversed.normal(), (- result.normal()))
        reversedUV = resultReversed.vec2PrimVar(meshReversed['uv'])
        uv = result.vec2PrimVar(mesh['uv'])
        self.assertAlmostEqual(reversedUV[0], uv[0], delta=0.0001)
        self.assertAlmostEqual(reversedUV[1], uv[1], delta=0.0001)