Home | Trees | Indices | Help |
|
---|
|
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
_faces Dictionary of all faces. |
|||
_edges Dictionary of all edges. |
|||
list of Face |
faces List of faces of the mesh. |
|
|
String representation. Examples: >>> m = Mesh() >>> m Mesh() >>> tmp = m.add_face(1, 2, 3) >>> tmp = m.add_face(3, 2, 4) >>> m Mesh(faces=[(1, 2, 3), (2, 4, 3)], lock=False) >>> m.lock() >>> m Mesh(faces=[(1, 2, 3), (2, 4, 3)]) >>> Mesh(faces=[(1, 2, 3),(3, 2, 4)]) Mesh(faces=[(1, 2, 3), (2, 4, 3)]) |
|
Create new face for mesh, or return existing face. List of adjacent faces is also updated. >>> m = Mesh() >>> f0 = m.add_face(0, 1, 2) >>> [list(faces) for faces in f0.adjacent_faces] [[], [], []] >>> m = Mesh() >>> f0 = m.add_face(0, 1, 2) >>> f1 = m.add_face(2, 1, 3) >>> f2 = m.add_face(2, 3, 4) >>> len(m._faces) 3 >>> len(m._edges) 9 >>> f3 = m.add_face(2, 3, 4) >>> f3 is f2 True >>> f4 = m.add_face(10, 11, 12) >>> f5 = m.add_face(12, 10, 11) >>> f6 = m.add_face(11, 12, 10) >>> f4 is f5 True >>> f4 is f6 True >>> len(m._faces) 4 >>> len(m._edges) 12 Another mesh: 0->-1 \ / \ 2-<-3 2->-3 \ / 4 >>> m = Mesh() >>> f0 = m.add_face(0, 1, 2) >>> f1 = m.add_face(1, 3, 2) >>> f2 = m.add_face(2, 3, 4) >>> list(f0.get_adjacent_faces(0)) [Face(1, 3, 2)] >>> list(f0.get_adjacent_faces(1)) [] >>> list(f0.get_adjacent_faces(2)) [] >>> list(f1.get_adjacent_faces(1)) [Face(2, 3, 4)] >>> list(f1.get_adjacent_faces(3)) [Face(0, 1, 2)] >>> list(f1.get_adjacent_faces(2)) [] >>> list(f2.get_adjacent_faces(2)) [] >>> list(f2.get_adjacent_faces(3)) [] >>> list(f2.get_adjacent_faces(4)) [Face(1, 3, 2)] >>> # add an extra face, and check changes >>> f3 = m.add_face(2, 3, 5) >>> list(f0.get_adjacent_faces(0)) [Face(1, 3, 2)] >>> list(f0.get_adjacent_faces(1)) [] >>> list(f0.get_adjacent_faces(2)) [] >>> list(f1.get_adjacent_faces(1)) # extra face here! [Face(2, 3, 4), Face(2, 3, 5)] >>> list(f1.get_adjacent_faces(3)) [Face(0, 1, 2)] >>> list(f1.get_adjacent_faces(2)) [] >>> list(f2.get_adjacent_faces(2)) [] >>> list(f2.get_adjacent_faces(3)) [] >>> list(f2.get_adjacent_faces(4)) [Face(1, 3, 2)] |
Lock the mesh. Frees memory by clearing the structures which are only used to update the face adjacency lists. Sets the faces attribute to the sorted list of all faces (sorting helps with ensuring that the strips in faces are close together). >>> m = Mesh() >>> f0 = m.add_face(3, 1, 2) >>> f1 = m.add_face(0, 1, 2) >>> f2 = m.add_face(5, 6, 2) >>> m.faces # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: ... >>> m.lock() >>> m.faces # should be sorted [Face(0, 1, 2), Face(1, 2, 3), Face(2, 5, 6)] >>> m.faces[0].index 0 >>> m.faces[1].index 1 >>> m.faces[2].index 2 >>> m._faces # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: ... >>> m._edges # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: ... >>> m.add_face(1, 2, 3) # doctest: +ELLIPSIS Traceback (most recent call last): ... AttributeError: ... |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 10 19:04:04 2011 | http://epydoc.sourceforge.net |