예제 #1
0
s2 = sphere.clone().subdivide(4)
assert s2.N() == 270338

###################################### decimate
print('Test decimate')
s2 = sphere.clone().decimate(0.2)
assert s2.N() == 213

###################################### addGaussNoise
print('Test addGaussNoise')
s2 = sphere.clone().addGaussNoise(2)
assert s2.maxBoundSize() > 1.1

###################################### normalAt
print('Test normalAt')
assert np.allclose(sphere.normalAt(12),
                   [9.97668684e-01, 1.01513637e-04, 6.82437494e-02])

###################################### isInside
print('Test isInside')
assert sphere.isInside([0.1, 0.2, 0.3])

###################################### intersectWithLine
print('Test intersectWithLine')
pts = sphere.intersectWithLine([-2, -2, -2], [2, 3, 4])

assert np.allclose(
    pts[0], [-0.8179885149002075, -0.522485613822937, -0.2269827425479889])
assert np.allclose(
    pts[1], [-0.06572723388671875, 0.41784095764160156, 0.9014091491699219])
예제 #2
0
###################################### decimate
print('Test decimate')
s2 = sphere.clone().decimate(0.2)
assert s2.N() == 213


###################################### pointGaussNoise
print('Test pointGaussNoise')
s2 = sphere.clone().pointGaussNoise(2)
assert s2.maxBoundSize() > 1.1


###################################### normalAt
print('Test normalAt')
assert np.allclose(sphere.normalAt(12), [9.97668684e-01, 1.01513637e-04, 6.82437494e-02])

###################################### isInside
print('Test isInside')
assert sphere.isInside([0.1,0.2,0.3])

###################################### intersectWithLine
print('Test intersectWithLine')
pts = sphere.intersectWithLine([-2,-2,-2], [2,3,4])

assert np.allclose(pts[0], [-0.8179885149002075, -0.522485613822937, -0.2269827425479889])
assert np.allclose(pts[1], [-0.06572723388671875, 0.41784095764160156, 0.9014091491699219])


############################################################################ Assembly
asse = cone+sphere