fmeobjects.FMEFace
|
Adds an inner-boundary area to this face, represented by the specified curve. |
Adds an inner-boundary area to this face, represented by the specified simple area. |
|
This method returns the bounding box of the geometry. |
|
This method returns the bounding cube of the geometry. |
|
Returns the bounds of the geometry. |
|
Remove all measures from the geometry. |
|
Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression. |
|
|
Copies the name of the 'sourceGeometry' onto this geometry. |
Copies all the traits from the given geometry that match the (optional) regular expression. |
|
|
Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression. |
Deletes the geometry's name. |
|
|
This method deletes the side specified by 'front' and indicates whether or not it existed before being deleted. |
Reduces the geometry to 2D. |
|
|
This sets the geometry's dimension to 3D. |
This method returns the appearance reference within the Library associated with this surface. |
|
Area calculation. |
|
Returns the face as an area. |
|
Returns the face as an area in local coordinates. |
|
Returns the wireframe of the surface as a |
|
Retrieve the names of the measures on this geometry. |
|
This routine retrieves the 'name' of this geometry as a |
|
Returns the normal vector of this face, normalized to the unit length. |
|
|
Retrieves the geometry trait value of the specified trait name. |
Retrieve the names of the traits on this geometry. |
|
|
This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait. |
|
Returns the type of given trait. |
Gets this face's transformation matrix. |
|
Check if this geometry or any sub part of this geometry has measures. |
|
Returns whether or not the geometry has a name. |
|
This method determines if the face has a transformation matrix or not. |
|
Returns whether or not the geometry is 3D. |
|
Check if the geometry is an aggregate or multi-part collection. |
|
Determines if face is convex. |
|
|
Works similarly to |
A face with a donut area will not be oriented if the normal of any inner boundary has the same direction as the normal of the outer boundary. |
|
|
Returns |
|
Returns |
This returns the number of faces that are contained in this simple surface. |
|
|
Offsets the surface by the coords specified by 'offsetPoint'. |
Flips the front and the back of parts of the surface as required to create a surface that is oriented. |
|
|
Removes the measure with name 'measureName' if supplied, or the default measure, if there is one. |
|
This method has 4 modes: |
Removes this face's transformation matrix. |
|
|
Renames the measure specified by 'oldMeasureName' to the new name, specified by 'newMeasureName'. |
Flips the surface such that the front and back of the surface are switched. |
|
This reverses the order of the surface's points. |
|
|
Rotates this surface about the z-axis by the specified angle, in degrees. |
|
Scale the feature by the given amounts. |
This method associates an appearance within the Library with this surface. |
|
|
Sets the area of this face. |
|
Sets the area of this face. |
|
Sets the geometry's name with a |
|
Sets a geometry trait with the specified value. |
|
This method supplies a null trait value with a type to the geometry. |
|
Sets this face's transformation matrix, replacing the existing matrix if it exists. |
|
This method checks whether the side specified by 'front' exists. |
- class FMEFace
FME Face Class
Create an instance of a Face geometry object.
init(boundary, mode)
This routine creates a new Face geometry object. The stroked boundary of the area is used. If there are any errors,
None
may be returned. If the area passed in is not in 3D, then the default value for the z coordinates is 0.0.- Parameters:
boundary (FMEArea) – The boundary as an area.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.
- Return type:
- Returns:
An instance of a Face geometry object.
init(boundary, mode, matrix)
This routine creates a new Face geometry object with the specified transformation matrix .
- Parameters:
boundary (FMEArea) – The boundary as an area.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.matrix (list[list[float]]) – transformation matrix applied to the face, formatted [[dddd][dddd][dddd]].
- Return type:
- Returns:
An instance of a Face geometry object.
init(boundary, mode)
This routine creates a new Face geometry object. The stroked boundary of the line is used. If there are any errors,
None
may be returned. If the line passed in is not in 3D, then the default value for the z coordinates is 0.0.- Parameters:
boundary (FMELine) – The boundary as a line.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
..
- Return type:
- Returns:
An instance of a face geometry object.
init(boundary, mode, matrix)
This routine creates a new Face geometry object with the specified transformation matrix.
- Parameters:
boundary (FMELine) – The boundary as a line.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.matrix (list[list[float]]) – transformation matrix applied to the face, formatted [[dddd][dddd][dddd]].
- Return type:
- Returns:
An instance of a face geometry object.
init(points, mode)
Creates a face from the list of points passed in.
- Parameters:
points (list[tuple[float]]) – The list of points to set to the face. The points are represented as (x, y, z) tuples.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
..
- Return type:
- Returns:
An instance of a face geometry object.
init(points, mode, matrix)
Creates a face from the list of points passed in.
- Parameters:
points (list[tuple[float]]) – The list of points to set to the face. The points are represented as (x, y, z) tuples.
mode (int) – The mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
..matrix (list[list[float]]) – transformation matrix applied to the face, formatted [[dddd][dddd][dddd]].
- Return type:
- Returns:
An instance of a face geometry object.
init(face)
Create a copy of the passed in Face geometry object.
- Parameters:
face (FMEFace) – The Face geometry object to create a copy of.
- Return type:
- Returns:
An instance of a face geometry object.
- __init__(*args, **kwargs)
- addInnerBoundaryCurve(innerBoundary, closeMode)
Adds an inner-boundary area to this face, represented by the specified curve. Refer to
setArea()
for the usage of the parameter closeMode. IfNone
is passed in, this face will not be modified.- Parameters:
innerBoundary (FMECurve) – The face’s inner boundary as a
FMECurve
.closeMode (int) – The face’s close mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.
- Return type:
None
- addInnerBoundarySimpleArea(innerBoundary, closeMode)
Adds an inner-boundary area to this face, represented by the specified simple area. Refer to
setArea()
for the usage of the parameter ‘closeMode’. IfNone
is passed in, this face will not be modified.- Parameters:
innerBoundary (FMECurve) – The face’s inner boundary as a
FMESimpleArea
.closeMode (int) – The face’s close mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.
- Return type:
None
- boundingBox()
This method returns the bounding box of the geometry.
- boundingCube()
This method returns the bounding cube of the geometry.
- bounds()
Returns the bounds of the geometry.
- clearMeasures()
Remove all measures from the geometry.
- Return type:
None
- copyAttributesFromFeature(sourceFeature, overwriteExisting, regexp, prefix)
Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression.
- Parameters:
sourceFeature (FMEFeature) – The feature to copy attributes from.
overwriteExisting (bool) – Existing traits will be overwritten only if overwriteExisting is
True
.regexp (str) – (Optional) The regular expression to match the attributes against. If regexp is not specified, then all attributes will be copied.
prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.
- Return type:
None
- copyNameFromGeometry(sourceGeometry)
Copies the name of the ‘sourceGeometry’ onto this geometry. If ‘sourceGeometry’s name is blank or
None
, this geometry’s name will becomeNone
.- Parameters:
sourceGeometry (FMEGeometry) – The geometry to copy the name from.
- Return type:
None
- copyTraitsFromGeometry(sourceGeometry, overwriteExisting, regexp, prefix)
Copies all the traits from the given geometry that match the (optional) regular expression.
- Parameters:
sourceGeometry (FMEGeometry) – The geometry to copy traits from.
overwriteExisting (bool) – Existing traits will be overwritten only if overwriteExisting is
True
.regexp (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.
prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.
- Return type:
None
- copyTraitsToFeature(destFeature, overwriteExisting, regexp, prefix)
Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression.
- Parameters:
destFeature (FMEFeature) – The feature to copy traits to.
overwriteExisting (bool) – Existing attributes will be overwritten only if overwriteExisting is
True
.regexp (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.
prefix (str) – (Optional) The prefix is put on all the attribute names as they are copied. If it is not specified, a prefix will not be added to the attribute names.
- Return type:
None
- deleteName()
Deletes the geometry’s name. If a name existed prior to this call then
True
is returned; otherwiseFalse
is returned.- Return type:
- Returns:
Returns a boolean indicating whether or not the name existed before deletion.
- deleteSide(front)
This method deletes the side specified by ‘front’ and indicates whether or not it existed before being deleted.
- force2D()
Reduces the geometry to 2D.
- Return type:
None
- force3D(newZ)
This sets the geometry’s dimension to 3D. All Z values are set to the value passed in, even if the geometry is already 3D.
- Parameters:
newZ (float) – The new Z value.
- Return type:
None
- getAppearanceReference(front)
This method returns the appearance reference within the Library associated with this surface. The ‘front’ parameter controls whether this query should return the front or the back appearance reference. Both can be fetched independently. If this surface is a regular surface with no geometry instance, a
FMEException
will be thrown.- Parameters:
front (bool) – Boolean indicating whether the appearance reference should be retrieved for the front or back of the surface.
- Return type:
- Returns:
The unique appearance reference for this appearance.
- Raises:
FMEException – An exception is raised if an error occurred or this surface is a regular surface with no geometry instance.
- getAsArea()
Returns the face as an area.
- Return type:
- Returns:
The face as a
FMEArea
object. Note: This method returns a terminal geometry type of theFMEArea
; i.e. one of the leaf classes in theFMEArea
inheritance graph. For example, aFMEPolygon
is returned if the geometry truly is a polygon.
- getAsAreaInLocalCoordinates()
Returns the face as an area in local coordinates.
- Return type:
- Returns:
The face as a
FMEArea
object. Note: This method returns a terminal geometry type of theFMEArea
; i.e. one of the leaf classes in theFMEArea
inheritance graph. For example, aFMEPolygon
is returned if the geometry truly is a polygon.
- getAsWireFrame()
Returns the wireframe of the surface as a
FMEMultiCurve
.None
is returned if a wireframe cannot be generated.- Return type:
FMEMultiCurve or None
- Returns:
The wireframe of the surface as a
FMEMultiCurve
.
- getMeasureNames()
Retrieve the names of the measures on this geometry.
- Return type:
- Returns:
Return a tuple storing the names of the measures on this geometry. This will return an empty tuple if there are no measures. For
FMEAggregate
,FMEMultiSurface
, andFMECompositeSurface
, this will return the union of all measure names of all of its parts.
- getName()
This routine retrieves the ‘name’ of this geometry as a
str
. This will returnNone
if it did not have a name associated with it.- Return type:
str or None
- Returns:
The geometry’s name.
- getNormal()
Returns the normal vector of this face, normalized to the unit length. The returned vector is computed using Newell’s method on the vertices contained on the outer boundary of this face. If the face is a single point, then a zero vector will be returned.
- getTrait(traitName)
Retrieves the geometry trait value of the specified trait name. Null trait values will be returned as an empty string. Binary blob traits are returned as a bytearray.
None
is returned when the trait is not found on the geometry.
- getTraitNames()
Retrieve the names of the traits on this geometry.
- getTraitNullMissingAndType(traitName)
This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait. The first boolean is
True
if ‘traitName’ maps to a null trait value on the geometry. Otherwise it isFalse
. The second boolean isTrue
if ‘traitName’ maps to a no value on the geometry. Otherwise it isFalse
. If the trait is absent,FME_ATTR_UNDEFINED
is returned for the type.The possible trait types are
FME_ATTR_UNDEFINED
,FME_ATTR_BOOLEAN
,FME_ATTR_INT8
,FME_ATTR_UINT8
,FME_ATTR_INT16
,FME_ATTR_UINT16
,FME_ATTR_INT32
,FME_ATTR_UINT32
,FME_ATTR_REAL32
,FME_ATTR_REAL64
,FME_ATTR_REAL80
,FME_ATTR_STRING
,FME_ATTR_ENCODED_STRING
,FME_ATTR_INT64
,FME_ATTR_UINT64
.
- getTraitType(traitName)
Returns the type of given trait. If the trait cannot be found,
FME_ATTR_UNDEFINED
will be returned.Returns one of
FME_ATTR_UNDEFINED
,FME_ATTR_BOOLEAN
,FME_ATTR_INT8
,FME_ATTR_UINT8
,FME_ATTR_INT16
,FME_ATTR_UINT16
,FME_ATTR_INT32
,FME_ATTR_UINT32
,FME_ATTR_REAL32
,FME_ATTR_REAL64
,FME_ATTR_REAL80
,FME_ATTR_STRING
,FME_ATTR_ENCODED_STRING
,FME_ATTR_INT64
,FME_ATTR_UINT64
.
- getTransformationMatrix()
Gets this face’s transformation matrix. If the face 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 ].
- hasMeasures()
Check if this geometry or any sub part of this geometry has measures.
- hasName()
Returns whether or not the geometry has a name.
- hasTransformationMatrix()
This method determines if the face has a transformation matrix or not.
- is3D()
Returns whether or not the geometry is 3D.
- Return type:
- Returns:
Returns
True
if the geometry is 3D andFalse
otherwise. ForFMENull
, this method will always returnTrue
. ForFMEAggregate
,FMEMultiPoint
,FMEMultiArea
,FMEMultiText
andFMEMultiCurve
, this method will returnTrue
if any one of the sub-parts is 3D. If the collection is empty or all of its members are 2D, this method will returnFalse
.
- isCollection()
Check if the geometry is an aggregate or multi-part collection.
- isConvex()
Determines if face is convex. The polygon making up the area is convex if all internal angles are less than 180 degrees and it’s not self-intersecting. Imperfectly planar 3D polygons are tolerated.
- isInPlane(tolerance, normalVector, valD, recalculateD)
Works similarly to
isPlanar()
, but checks planarity with respect to given normal or given plane (if plane equation D is specified - see below).If given normal is the zero vector, the normal used to check the planarity is computed using Newell’s method as in
isPlanar()
. valD is a reference to a value of D in the plane equation AX + BY + CZ = D. It can be used to make sure that multiple pieces lie in the same plane. If ‘recalculateD’ is set toFalse
, the passed in value of D will be used in the calculation. If ‘recalcualteD’ is set toTrue
, the passed in value is ignored and is instead automatically calculated (and returned in the second position of the returned tuple). A useful calling pattern for ensuring co-planarity is to get valD computed on the first call to the function setting ‘recalculateD’ toTrue
, and then use this value for future calls with ‘recalculateD’ toFalse
.- Parameters:
- Return type:
- Returns:
A tuple containing a boolean, tuple, and float representing: 1) Whether or not the surface is in plane; 2) The normal vector returned; and 3) The value ‘D’. Note: If recalculateD is
False
, the tuple returned will only contain the boolean and vector tuple (i.e. ‘valD’ is not returned).
- isOriented()
A face with a donut area will not be oriented if the normal of any inner boundary has the same direction as the normal of the outer boundary. Meshes and composite surfaces will return
False
if they have two parts that share an edge and those two parts are not consistently oriented with respect to each other. If the surface is improperly noded, the behaviour of this function is undefined.
- isPlanar(tolerance)
Returns
True
if this is planar within the given tolerance, andFalse
otherwise.The planarity condition is computed by the following algorithm. The normal vector <A, B, C> is determined by the vertices of this surface using Newell’s method. For the first point (x’, y’, z’) of this surface, we compute D’ = Ax’ + By’ + Cz’. Then, this surface is planar if and only if every subsequent point (x, y, z) of this surface gives a D = Ax + By + Cz, that is within the tolerance amount of D’. That is, | D - D’ | <= tolerance.
If the specified tolerance is negative, then this method always returns
True
.
- measureExists(measureName)
Returns
True
if the specified measure exists andFalse
otherwise. If the ‘measureName’ parameter is not specified then the default measure is checked.
- numParts()
This returns the number of faces that are contained in this simple surface.
- Return type:
- Returns:
The number of faces in the simple surface.
- offset(offsetPoint)
Offsets the surface by the coords specified by ‘offsetPoint’.
- Parameters:
offsetPoint (FMEPoint) – The
FMEPoint
to offset the surface by.- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- orient()
Flips the front and the back of parts of the surface as required to create a surface that is oriented. Refer to
isOriented()
for the specification of what it means to be an oriented surface. If the surface is improperly noded or non-orientable, the behaviour of this function is undefined. All measures are changed as needed, including the vertex normal measures. Note: The vertex normals are not flipped (scaled by -1).- Return type:
None
- removeMeasure(measureName)
Removes the measure with name ‘measureName’ if supplied, or the default measure, if there is one.
- Parameters:
measureName (str) – (Optional) The name of the measure to remove.
- Return type:
None
- removeTraits(regexp)
This method has 4 modes:
Remove all traits at the top level: regex == NULL
Remove some traits at the top level: regex == <string>
Remove all traits at all levels: regex ==
kFME_RecurseAll
Remove some traits at all levels: regex ==
kFME_RecurseSome
<string>
For example, specifying regex == NULL for a multi-surface will remove all traits at the root level of the multi-surface, whereas specifying regex ==
kFME_RecurseSome
<string> will remove all traits from all levels of the multi surface that match <string>. If <string> is an illegal regular expression, no traits will be removed.- Return type:
None
- removeTransformationMatrix()
Removes this face’s transformation matrix.
- Return type:
None
- renameMeasure(oldMeasureName, newMeasureName)
Renames the measure specified by ‘oldMeasureName’ to the new name, specified by ‘newMeasureName’.
- reorient()
Flips the surface such that the front and back of the surface are switched. All measures are changed as needed, including the vertex normal measures. Note: The vertex normals are not flipped (scaled by -1). Refer to
reverse()
if the vertex normals need to be flipped. Note:FMETriangleStrip
have a method calledisFlipped()
that is to be used in conjunction with the geometry to determine which side is the front. WhenisFlipped()
returnsTrue
, the front is actually the opposite side of what the coordinates of the first triangle in the strip indicate.- Return type:
None
- reverse()
This reverses the order of the surface’s points.
- Return type:
None
- rotate2D(center, angle)
Rotates this surface about the z-axis by the specified angle, in degrees. The rotation is performed relative to the center specified. A positive angle corresponds to a counter-clockwise rotation, when looking down onto the XY-plane.
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- scale(xScale, yScale, zScale)
Scale the feature by the given amounts.
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setAppearanceReference(appearanceRef, front)
This method associates an appearance within the Library with this surface. This is done by passing in the unique appearance reference for this appearance. Subsequent calls to this method on the same side, will override the previous appearance used with the new appearance passed in.
An appearance reference of ‘0’ represents the default appearance. Interpretation of the default appearance is left to the consumer of this geometry. When set at this
FMESurface
level, the appearance represents the default appearance to apply when the contained surfaces use the default appearance instead of a specific appearance. Contained surfaces may be found within nested surfaces, geometry instances that reference geometries containing surfaces, or as surfaces or multi-surfaces.The second parameter controls whether this action should take place on the front of the contained surfaces or the back. Both can be set independently. The appearanceRef should be a valid reference to a definition stored in the
FMELibrary
. If the reference was not found in the library, it will still attach the reference to the instance, but will throw aFMEException
. This is an unhealthy situation as it represents a ‘dangling reference’.- Parameters:
- Raises:
FMEException – An exception is raised if an error occurred or the reference was not found in the library and a dangling reference was attached.
- setArea(area, closeMode)
Sets the area of this face. The existing area will be replaced and the transformation matrix will be reset.The parameter ‘closeMode’ specifies how this face treates areas that are not closed in 3D.
If
FME_CLOSE_3D_AVERAGE_MODE
is specified, an additional point is added, connecting the start and end points of the area. This point is computed by the average of the start and end points, in 3D.If
FME_CLOSE_3D_EXTEND_MODE
is specified, the start and end points are connected with no additional points.If
FME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
, we use the AVERAGE mode if and only if the start and end points lie on the same coordinate plane (i.e. they share the same x-, y-, or z-coordinates).Otherwise, the EXTEND mode is used.
If the input area is
None
, then an error will be generated.
- Parameters:
area (FMEArea) – The area to set on the face.
closeMode (int) – The face’s close mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.
- Return type:
None
- setAreaInLocalCoordinates(area, closeMode)
Sets the area of this face. The transformation matrix untouched. Refer to
setArea()
for the usage of the parameter ‘closeMode’.- Parameters:
area (FMEArea) – The area to set on the face.
closeMode (int) – The face’s close mode. Must be either
FME_CLOSE_3D_AVERAGE_MODE
,FME_CLOSE_3D_EXTEND_MODE
, orFME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE
.
- Return type:
None
- setName(name)
Sets the geometry’s name with a
str
. By supplying a blank name as input, this method will act asdeleteName()
.- Parameters:
name (str) – The geometry’s new name.
- Return type:
None
- setTrait(traitName, traitValue)
Sets a geometry trait with the specified value. If the geometry trait already exists, its value and type will be changed. The following type numeric mappings are used:
PyInt ==> FME_Int32
PyFloat ==> FME_Real64
PyLong ==> FME_Int64
Binary values are to be specified as bytearray values or bytes values.
- setTraitNullWithType(traitName, traitType)
This method supplies a null trait value with a type to the geometry. If a trait with the same name already exists, it is overwritten.
Trait type must be one of
FME_ATTR_UNDEFINED
,FME_ATTR_BOOLEAN
,FME_ATTR_INT8
,FME_ATTR_UINT8
,FME_ATTR_INT16
,FME_ATTR_UINT16
,FME_ATTR_INT32
,FME_ATTR_UINT32
,FME_ATTR_REAL32
,FME_ATTR_REAL64
,FME_ATTR_REAL80
,FME_ATTR_STRING
,FME_ATTR_ENCODED_STRING
,FME_ATTR_INT64
,FME_ATTR_UINT64
.
- setTransformationMatrix(matrix)
Sets this face’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.