Exemple #1
0
 def ds_from_meshdata(vertices, faces, deep=True):
     for i in range(0, len(vertices)):
         meshes.append(
             MeshFactory.mesh_from_data(vertices[i], faces[i], deep))
     mesheslist.append(meshes)
     return (DatasetCollection(datasets=mesheslist))
Exemple #2
0
 array([[  1.38777878e-16,   1.00000000e+00,   2.49800181e-16],
        [ -1.11022302e-16,  -3.60822483e-16,   1.00000000e+00],
        [  1.00000000e+00,  -1.38777878e-17,   1.66533454e-16]]))

'''
print(AA[1])
'''
Out[40]: 
array([[  4.49640325e-15,   1.00000000e+00,  -3.87190280e-15],
       [ -3.94129174e-15,   3.94129174e-15,   1.00000000e+00],
       [  1.00000000e+00,  -4.38538095e-15,   4.21884749e-15]])

'''
# So the alignment works as expected. However, when we integrate the mesh class:

mesh1=MeshFactory.mesh_from_data(A)
mesh2=MeshFactory.mesh_from_data(B)

BB=Correspondence.best_pairwise_PCA_alignment(mesh1, mesh2,0)
print(BB)
'''
Out[45]: 
(array([3, 1, 2, 0]), array([[ 0.18660992, -0.95001991, -0.25027765],
        [ 0.02395067, -0.25027765,  0.96787781],
        [ 0.9821421 ,  0.18660992,  0.02395067]]))

'''

AA=Correspondence.locgpd(mesh1,mesh2,0,0,5,0)

print(AA[1])
Exemple #3
0
def print_polyfaces(polydata):
    cell_n = polydata.GetNumberOfCells()
    point_n = polydata.GetCell(1).GetNumberOfPoints()
    faces_new = zeros((cell_n, point_n), dtype=int)
    for i in range(cell_n):
        print('cell/polygon ' + str(i))
        for j in range(point_n):
            print(polydata.GetCell(i).GetPointId(j))


vertices = array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [2, 2, 1]],
                 dtype=int)
faces = array([[0, 1, 2], [1, 2, 3], [1, 3, 4], [2, 3, 0]], dtype=int)

mesh = MeshFactory.mesh_from_data(vertices, faces, False)

print(mesh)
print(mesh.vertices)
print(mesh.faces)
"""
Print output should look like this:

<auto3dgm.mesh.mesh.Mesh object at 0x1048962b0>
[[0. 0. 0.]
 [1. 0. 0.]
 [1. 1. 0.]
 [0. 1. 0.]
 [2. 2. 1.]]
[[0 1 2]
 [1 2 3]
Exemple #4
0
from auto3dgm.mesh.meshfactory import MeshFactory
from auto3dgm.mesh.subsample import Subsample
from numpy import array

vertices = array([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [2, 2, 1]])
seed = vertices[[1, 4]]

mesh = MeshFactory.mesh_from_data(vertices)

submesh_noseed = Subsample.far_point_subsample(mesh, 4)
print(submesh_noseed)
print(submesh_noseed.vertices)
print(submesh_noseed.faces)

submesh_seed = Subsample.far_point_subsample(mesh, 4, seed)
print(submesh_seed)
print(submesh_seed.vertices)
print(submesh_seed.faces)
"""

Print results for first set will be random, but second set will be stable

Print results should look something like this:
<auto3dgm.mesh.mesh.Mesh object at 0x117cd5518>
[[0 0 0]
 [2 2 1]
 [1 1 0]
 [1 0 0]]
[]
<auto3dgm.mesh.mesh.Mesh object at 0x10f5e31d0>
[[1 0 0]