Пример #1
0
s2 = sphere.clone().subdivide(4)
print('subdivide', s2.N(), 270338)
assert s2.N() == 270338

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

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

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

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

###################################### intersectWithLine
pts = sphere.intersectWithLine([-2, -2, -2], [2, 3, 4])
print('intersectWithLine', pts[0])
assert np.allclose(
    pts[0], [-0.8179885149002075, -0.522485613822937, -0.2269827425479889])
print('intersectWithLine', pts[1])
assert np.allclose(
Пример #2
0

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


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


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

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

###################################### intersectWithLine
pts = sphere.intersectWithLine([-2,-2,-2], [2,3,4])
print('intersectWithLine',pts[0])
assert np.allclose(pts[0], [-0.8179885149002075, -0.522485613822937, -0.2269827425479889])
print('intersectWithLine',pts[1])
assert np.allclose(pts[1], [-0.06572723388671875, 0.41784095764160156, 0.9014091491699219])


############################################################################
Пример #3
0
s2 = sphere.clone().subdivide(4)
assert s2.N() == 270338

###################################### 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])