Module fmeobjects :: Class FMEMesh
[hide private]
[frames] | no frames]

Class FMEMesh


init(MultipleInvocations)

Create an instance of a Mesh geometry object.

init()

Default FMEMesh constructor.

Returns: FMEMesh

init(mesh)

Create a copy of the passed in Mesh geometry object.

Parameters

Returns: FMEMesh

Instance Methods [hide private]
 
__decIterRef__(args)
 
__incIterRef__(args)
 
__init__(MultipleInvocations)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__iter__(x)
iter(x)
bool
addMeshPart(appearanceReference, vertexIndices, vertexNormalIndices, textureCoordinateIndices)
This routine adds a new mesh part to the mesh.
bool
addMeshPartExtended(hasAFront, hasABack, frontAppRef, backAppRef, vertexIndices, vertexNormalIndices, frontTextCoordIndices, backTextCoordIndices)
This routine extends the functionality of addMeshPart(), allowing double-sided mesh parts to be added.
None
appendMesh(otherMesh)
Appends a mesh passed in to the mesh, by appending the vertices, vertex normals and texture coordinates and then by appending mesh parts with updated indices.
None
appendTextureCoordinates(coords)
Appends the texture coordinates to the end of the texture coordinate list.
None
appendVertex(x, y, z)
Appends the point to the end of the vertex list.
None
appendVertexNormal(x, y, z)
Appends the point to the end of the vertex normal list.
None
appendVertexNormals(points)
Appends the vertex normals to the end of the vertex normal list.
None
appendVertices(points)
Appends the vertices to the end of the vertex list.
FMECompositeSurface or None
getAsCompositeSurface()
Returns a composite surface representation of this mesh.
FMEMultiSurface or None
getAsMultiSurface()
Returns a multi-surface representation of this mesh.
tuple of float or None
getTextureCoordinateAt(index)
Retrieve the texture coordinate at the specified index.
list of tuples of floats
getTextureCoordinates()
Retrieves the texture coordinate list with texture coordinates in the same index position as referenced by the faces.
list of lists of floats
getTransformationMatrix()
Gets this mesh's transformation matrix.
tuple of float or None
getVertexAt(index)
Retrieve the vertex, in global coordinates (i.e., the transformation matrix is applied, if it exists), at the specified index.
tuple of float or None
getVertexNormalAt(index)
Retrieve the vertex normal, in global coordinates (i.e., the transformation matrix is applied, if it exists), at the specified index.
list of tuples of floats
getVertexNormals()
Retrieves the vertex normal list with vertex normals, in global coordinates (i.e., the transformation matrix is applied, if it exists), in the same index position as referenced by the faces.
list of tuples of floats
getVertexNormalsInLocalCoordinates()
This is the same as getVertexNormals() with the exception that the transformation matrix is not applied.
list of tuples of floats
getVertices()
Retrieves the vertex list with vertices, in global coordinates (i.e., the transformation matrix is applied, if it exists), in the same index position as referenced by the faces.
list of tuples of floats
getVerticesInLocalCoordinates()
This is the same as getVertices() with the exception that the transformation matrix is not applied.
bool
hasTextureCoordinatesQ()
Returns True if the texture coordinates stored have the specified component.
bool
hasTextureCoordinatesU()
Returns True if the texture coordinates stored have the specified component.
bool
hasTextureCoordinatesV()
Returns True if the texture coordinates stored have the specified component.
bool
hasTextureCoordinatesW()
Returns True if the texture coordinates stored have the specified component.
bool
hasTransformationMatrix()
This method determines if the mesh has a transformation matrix or not.
int
maxEdgeNumber()
Returns the maximum number of edges the mesh can contain.
int
numTextureCoordinates()
Returns the number of texture coordinates that are contained in this mesh.
int
numVertexNormals()
Returns the number of vertex normals that are contained in this mesh.
int
numVertices()
Returns the number of vertices that are contained in this mesh.
None
optimizeVertexPool()
Optimizes the mesh by removing all duplicate and unreferenced vertices, vertex normals, and texture coordinates.
None
removeDegenerateTriangleMeshParts()
Removes this mesh's transformation matrix.
None
removeTransformationMatrix()
Removes this mesh's transformation matrix.
bool
resolvePartDefaults()
This call assumes that the mesh has been triangulated.
None
setTransformationMatrix(matrix)
Sets this mesh's transformation matrix, replacing the existing matrix if it exists.

Inherited from FMESimpleSurface: numParts

Inherited from FMESurface: deleteSide, getAppearanceReference, getAsWireFrame, isInPlane, isOriented, isPlanar, offset, orient, reorient, reverse, rotate2D, scale, setAppearanceReference, sideExists

Inherited from FMEGeometry: __getObject__, __new__, boundingBox, boundingCube, bounds, clearMeasures, copyAttributesFromFeature, copyNameFromGeometry, copyTraitsFromGeometry, copyTraitsToFeature, deleteName, force2D, force3D, getArea, getMeasureNames, getName, getTrait, getTraitNames, getTraitNullMissingAndType, getTraitType, hasMeasures, hasName, is3D, isCollection, measureExists, removeMeasure, removeTraits, renameMeasure, setName, setTrait, setTraitNullWithType

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__decIterRef__(args)

 
Overrides: FMESurface.__decIterRef__

__incIterRef__(args)

 
Overrides: FMESurface.__incIterRef__

__init__(MultipleInvocations)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__iter__(x)

 

iter(x)

Overrides: FMESurface.__iter__

addMeshPart(appearanceReference, vertexIndices, vertexNormalIndices, textureCoordinateIndices)

 

This routine adds a new mesh part to the mesh. The vertexNormalIndices and textureCoordinateIndices may be passed in as None if the user does not want to specify vertex normals or texture coordinates for the mesh part. The first indices of the mesh part should match the respective last indices, indicating a closed face. If this is not the case, the mesh part will be closed by the method.

Parameters:
  • appearanceReference (int) - Should refer to a valid appearance in the shared object library, but no checking is done during this call. The appearance reference of 0 implies that this part will inherit the appearance reference of the mesh.
  • vertexIndices (list of ints) - Should refer to valid vertices in the vertex list of the mesh, but no validation is done by the method.
  • vertexNormalIndices (list of ints or None) - Should refer to valid vertex normals stored in the mesh.
  • textureCoordinateIndices (list of ints or None) - Should refer to valid texture coordinates of the mesh.
Returns: bool
Boolean indicating whether or not the addition was successful.

addMeshPartExtended(hasAFront, hasABack, frontAppRef, backAppRef, vertexIndices, vertexNormalIndices, frontTextCoordIndices, backTextCoordIndices)

 

This routine extends the functionality of addMeshPart(), allowing double-sided mesh parts to be added. When both hasAFront and hasABack are True, a double sided part will be added. If one of these parameters is False, the corresponding appearance reference and texture coordinates will not be ignore.

Parameters:
  • hasAFront (bool) - Boolean indicating whether or not the mesh has a front.
  • hasABack (bool) - Boolean indicating whether or not the mesh has a back.
  • frontAppRef (int) - Appearance reference for the front of the Mesh. Should refer to a valid appearance in the shared object library, but no checking is done during this call. The appearance reference of 0 implies that this part will inherit the appearance reference of the mesh. If hasAFront is False the value of this parameter is not important, but it must be a valid int.
  • backAppRef (int) - Appearance reference for the back of the Mesh. Should refer to a valid appearance in the shared object library, but no checking is done during this call. The appearance reference of 0 implies that this part will inherit the appearance reference of the mesh. If hasAback is False the value of this parameter is not important, but it must be a valid int.
  • vertexIndices (list of ints) - Should refer to valid vertices in the vertex list of the mesh, but no validation is done by the method.
  • vertexNormalIndices (list of ints or None) - Should refer to valid vertex normals stored in the mesh.
  • frontTextCoordIndices (list of ints or None) - Should refer to valid texture coordinates of the mesh.
  • backTextCoordIndices (list of ints or None) - Should refer to valid texture coordinates of the mesh.
Returns: bool
Boolean indicating whether or not the addition was successful.

appendMesh(otherMesh)

 

Appends a mesh passed in to the mesh, by appending the vertices, vertex normals and texture coordinates and then by appending mesh parts with updated indices.

Parameters:
  • otherMesh (FMEMesh) - Another mesh to append to this mesh.
Returns: None

appendTextureCoordinates(coords)

 

Appends the texture coordinates to the end of the texture coordinate list. If there are already texture coordinates stored, the components that previously returned false to hasTextureCoordinates[U|V|W|Q] will be back filled with 0. Parameters set to None will be ignored.

Parameters:
  • coords (list of tuple of floats) - The list of texture coordinates. The coordinates are represented as (u, v, w, q) tuples
Returns: None

appendVertex(x, y, z)

 

Appends the point to the end of the vertex list. This method will assume that passed vertices are in local coordinates (i.e. the transformation matrix will be applied to these vertices).

Parameters:
  • x (float) - The x coordinate of the vertex to be appended.
  • y (float) - The y coordinate of the vertex to be appended.
  • z (float) - The z coordinate of the vertex to be appended.
Returns: None

appendVertexNormal(x, y, z)

 

Appends the point to the end of the vertex normal list.

Parameters:
  • x (float) - The x coordinate of the vertex to be appended.
  • y (float) - The y coordinate of the vertex to be appended.
  • z (float) - The z coordinate of the vertex to be appended.
Returns: None

appendVertexNormals(points)

 

Appends the vertex normals to the end of the vertex normal list.

Parameters:
  • points (list of tuple of float) - The list of vertices to be added. The vertices are represented as (x, y, z) tuples.
Returns: None

appendVertices(points)

 

Appends the vertices to the end of the vertex list. This method will assume that passed vertices are in local coordinates (i.e. the transformation matrix will be applied to these vertices).

Parameters:
  • points (list of tuple of float) - The list of vertices to be added. The vertices are represented as (x, y, z) tuples.
Returns: None

getAsCompositeSurface()

 

Returns a composite surface representation of this mesh. None is returned when an error is encountered.

Returns: FMECompositeSurface or None
Returns a composite surface representation of this mesh or none.

getAsMultiSurface()

 

Returns a multi-surface representation of this mesh. None is returned when an error is encountered.

Returns: FMEMultiSurface or None
Returns a multi-surface representation of this mesh or none.

getTextureCoordinateAt(index)

 

Retrieve the texture coordinate at the specified index. Only components of the texture coordinate that return true from hasTextureCoordinates[U|V|W|Q] will be fetched. A value of None means that the texture coordinate value doesn't exist at that index. An error is returned if the index is out of range.

Returns: tuple of float or None
The coordinate at the index represented as a (u, v, w, q) tuple or none.
Raises:
  • FMEException - An exception is raised if an error occurred.

getTextureCoordinates()

 

Retrieves the texture coordinate list with texture coordinates in the same index position as referenced by the faces. Only components where hasTextureCoordinates[U|V|W|Q] is true will be fetched.

Returns: list of tuples of floats
The list of coordinates represented as (u, v, w, q) tuples.
Raises:
  • FMEException - An exception is raised if an error occurred.

getTransformationMatrix()

 

Gets this mesh's transformation matrix. If the mesh does not have such a matrix, an identity matrix is returned. Only the top three rows of the matrix will be returned, as the bottom row is always [ 0 0 0 1 ].

Returns: list of lists of floats
The mesh's tranformation matrix, formatted [[dddd][dddd][dddd]].

getVertexAt(index)

 

Retrieve the vertex, in global coordinates (i.e., the transformation matrix is applied, if it exists), at the specified index. An error is returned if the index is out of range.

Returns: tuple of float or None
The vertex at the index represented as a (x, y, z) tuple or none.
Raises:
  • FMEException - An exception is raised if an error occurred.

getVertexNormalAt(index)

 

Retrieve the vertex normal, in global coordinates (i.e., the transformation matrix is applied, if it exists), at the specified index. An error is returned if the index is out of range.

Returns: tuple of float or None
The vertex at the index represented as a (x, y, z) tuple or none.
Raises:
  • FMEException - An exception is raised if an error occurred.

getVertexNormals()

 

Retrieves the vertex normal list with vertex normals, in global coordinates (i.e., the transformation matrix is applied, if it exists), in the same index position as referenced by the faces.

Returns: list of tuples of floats
The list of vertex normals represented as (x, y, z) tuples.
Raises:
  • FMEException - An exception is raised if an error occurred.

getVertexNormalsInLocalCoordinates()

 

This is the same as getVertexNormals() with the exception that the transformation matrix is not applied.

Returns: list of tuples of floats
The list of vertex normals represented as (x, y, z) tuples.
Raises:
  • FMEException - An exception is raised if an error occurred.

getVertices()

 

Retrieves the vertex list with vertices, in global coordinates (i.e., the transformation matrix is applied, if it exists), in the same index position as referenced by the faces.

Returns: list of tuples of floats
The list of vertices represented as (x, y, z) tuples.
Raises:
  • FMEException - An exception is raised if an error occurred.

getVerticesInLocalCoordinates()

 

This is the same as getVertices() with the exception that the transformation matrix is not applied.

Returns: list of tuples of floats
The list of vertices represented as (x, y, z) tuples.
Raises:
  • FMEException - An exception is raised if an error occurred.

hasTextureCoordinatesQ()

 

Returns True if the texture coordinates stored have the specified component. Returns False if no texture coordinates are stored or the specified component of the texture coordinates is not valid for this mesh.

Returns: bool
Returns True if the texture coordinates stored have the specified component, and False otherwise.

hasTextureCoordinatesU()

 

Returns True if the texture coordinates stored have the specified component. Returns False if no texture coordinates are stored or the specified component of the texture coordinates is not valid for this mesh.

Returns: bool
Returns True if the texture coordinates stored have the specified component, and False otherwise.

hasTextureCoordinatesV()

 

Returns True if the texture coordinates stored have the specified component. Returns False if no texture coordinates are stored or the specified component of the texture coordinates is not valid for this mesh.

Returns: bool
Returns True if the texture coordinates stored have the specified component, and False otherwise.

hasTextureCoordinatesW()

 

Returns True if the texture coordinates stored have the specified component. Returns False if no texture coordinates are stored or the specified component of the texture coordinates is not valid for this mesh.

Returns: bool
Returns True if the texture coordinates stored have the specified component, and False otherwise.

hasTransformationMatrix()

 

This method determines if the mesh has a transformation matrix or not.

Returns: bool
Returns True if this mesh has a transformation matrix, and False otherwise.

maxEdgeNumber()

 

Returns the maximum number of edges the mesh can contain.

Returns: int
Returns the maximum number of edges.

numTextureCoordinates()

 

Returns the number of texture coordinates that are contained in this mesh.

Returns: int
Returns the number of texture coordinates that are contained in this mesh.

numVertexNormals()

 

Returns the number of vertex normals that are contained in this mesh.

Returns: int
Returns the number of vertex normals in this mesh.

numVertices()

 

Returns the number of vertices that are contained in this mesh.

Returns: int
Returns the number of vertices in this mesh.

optimizeVertexPool()

 

Optimizes the mesh by removing all duplicate and unreferenced vertices, vertex normals, and texture coordinates. This will modify the underlying vertex pools and update the mesh part indices. This is a potentially expensive operation and should not be called unless necessary.

Returns: None

resolvePartDefaults()

 

This call assumes that the mesh has been triangulated. It will remove any mesh parts that do not have three edges and will also remove triangles with repeated vertex indices. It will return true if any parts are removed by the call. This method assumes that duplicate indices have already been removed from the mesh.

Returns: bool
Returns True if any parts are removed by the call and False otherwise.

setTransformationMatrix(matrix)

 

Sets this mesh's transformation matrix, replacing the existing matrix if it exists. Only three rows are expected in the input array, as a bottom row of [ 0 0 0 1 ] is assumed.

Parameters:
  • matrix (list of lists of floats) - The transformation matrix, formatted [[dddd][dddd][dddd]].
Returns: None