TransformState

from panda3d.core import TransformState
class TransformState

Bases: NodeCachedReferenceCount

Indicates a coordinate-system transform on vertices. TransformStates are the primary means for storing transformations on the scene graph.

Transforms may be specified in one of two ways: componentwise, with a pos- hpr-scale, or with an arbitrary transform matrix. If you specify a transform componentwise, it will remember its original components.

TransformState objects are managed very much like RenderState objects. They are immutable and reference-counted automatically.

You should not attempt to create or modify a TransformState object directly. Instead, call one of the make() functions to create one for you. And instead of modifying a TransformState object, create a new one.

Inheritance diagram

Inheritance diagram of TransformState

__init__(*args, **kwargs)
cacheRef()

C++ Interface: cache_ref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

cacheUnref()

C++ Interface: cache_unref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

cache_ref()

C++ Interface: cache_ref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

cache_unref()

C++ Interface: cache_unref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

clearCache()

C++ Interface: clear_cache()

/**
  • Empties the cache of composed TransformStates. This makes every

  • TransformState forget what results when it is composed with other

  • TransformStates.

  • This will eliminate any TransformState objects that have been allocated but

  • have no references outside of the internal TransformState map. It will not

  • eliminate TransformState objects that are still in use.

  • Nowadays, this method should not be necessary, as reference-count cycles in

  • the composition cache should be automatically detected and broken.

  • The return value is the number of TransformStates freed by this operation.

*/

clear_cache()

C++ Interface: clear_cache()

/**
  • Empties the cache of composed TransformStates. This makes every

  • TransformState forget what results when it is composed with other

  • TransformStates.

  • This will eliminate any TransformState objects that have been allocated but

  • have no references outside of the internal TransformState map. It will not

  • eliminate TransformState objects that are still in use.

  • Nowadays, this method should not be necessary, as reference-count cycles in

  • the composition cache should be automatically detected and broken.

  • The return value is the number of TransformStates freed by this operation.

*/

compareTo()

C++ Interface: compare_to(TransformState self, const TransformState other) compare_to(TransformState self, const TransformState other, bool uniquify_matrix)

/**
  • Provides an arbitrary ordering among all unique TransformStates, so we can

  • store the essentially different ones in a big set and throw away the rest.

  • Note that if this returns 0, it doesn’t necessarily imply that operator ==

  • returns true; it uses a very slightly different comparison threshold.

*/

/**
  • Provides an arbitrary ordering among all unique TransformStates, so we can

  • store the essentially different ones in a big set and throw away the rest.

  • Note that if this returns 0, it doesn’t necessarily imply that operator ==

  • returns true; it uses a very slightly different comparison threshold.

  • If uniquify_matrix is true, then matrix-defined TransformStates are also

  • uniqified. If uniquify_matrix is false, then only component-defined

  • TransformStates are uniquified, which is less expensive.

*/

compare_to()

C++ Interface: compare_to(TransformState self, const TransformState other) compare_to(TransformState self, const TransformState other, bool uniquify_matrix)

/**
  • Provides an arbitrary ordering among all unique TransformStates, so we can

  • store the essentially different ones in a big set and throw away the rest.

  • Note that if this returns 0, it doesn’t necessarily imply that operator ==

  • returns true; it uses a very slightly different comparison threshold.

*/

/**
  • Provides an arbitrary ordering among all unique TransformStates, so we can

  • store the essentially different ones in a big set and throw away the rest.

  • Note that if this returns 0, it doesn’t necessarily imply that operator ==

  • returns true; it uses a very slightly different comparison threshold.

  • If uniquify_matrix is true, then matrix-defined TransformStates are also

  • uniqified. If uniquify_matrix is false, then only component-defined

  • TransformStates are uniquified, which is less expensive.

*/

componentsGiven()

C++ Interface: components_given(TransformState self)

/**
  • Returns true if the transform was specified componentwise, or false if it

  • was specified with a general 4x4 matrix. If this is true, the components

  • returned by get_pos() and get_scale() will be exactly those that were set;

  • otherwise, these functions will return computed values. If this is true,

  • the rotation may have been set either with a hpr trio or with a quaternion;

  • hpr_given() or quat_given() can resolve the difference.

*/

components_given()

C++ Interface: components_given(TransformState self)

/**
  • Returns true if the transform was specified componentwise, or false if it

  • was specified with a general 4x4 matrix. If this is true, the components

  • returned by get_pos() and get_scale() will be exactly those that were set;

  • otherwise, these functions will return computed values. If this is true,

  • the rotation may have been set either with a hpr trio or with a quaternion;

  • hpr_given() or quat_given() can resolve the difference.

*/

compose()

C++ Interface: compose(TransformState self, const TransformState other)

/**
  • Returns a new TransformState object that represents the composition of this

  • state with the other state.

  • The result of this operation is cached, and will be retained as long as

  • both this TransformState object and the other TransformState object

  • continue to exist. Should one of them destruct, the cached entry will be

  • removed, and its pointer will be allowed to destruct as well.

*/

garbageCollect()

C++ Interface: garbage_collect()

/**
  • Performs a garbage-collection cycle. This must be called periodically if

  • garbage-collect-states is true to ensure that TransformStates get cleaned

  • up appropriately. It does no harm to call it even if this variable is not

  • true, but there is probably no advantage in that case.

*/

garbage_collect()

C++ Interface: garbage_collect()

/**
  • Performs a garbage-collection cycle. This must be called periodically if

  • garbage-collect-states is true to ensure that TransformStates get cleaned

  • up appropriately. It does no harm to call it even if this variable is not

  • true, but there is probably no advantage in that case.

*/

getClassType()

C++ Interface: get_class_type()

getCompositionCache()

C++ Interface: get_composition_cache(TransformState self)

getCompositionCacheNumEntries()

C++ Interface: get_composition_cache_num_entries(TransformState self)

/**
  • Returns the number of entries in the composition cache for this

  • TransformState. This is the number of other TransformStates whose

  • composition with this one has been cached. This number is not useful for

  • any practical reason other than performance analysis.

*/

getCompositionCacheResult()

C++ Interface: get_composition_cache_result(TransformState self, int n)

/**
  • Returns the result TransformState of the nth element in the composition

  • cache. Returns NULL if there doesn’t happen to be an entry in the nth

  • element.

  • In general, a->compose(a->get_composition_cache_source(n)) ==

  • a->get_composition_cache_result(n).

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getCompositionCacheSize()

C++ Interface: get_composition_cache_size(TransformState self)

/**
  • Returns the number of slots in the composition cache for this

  • TransformState. You may use this as an upper bound when walking through

  • all of the composition cache results via get_composition_cache_source() or

  • result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getCompositionCacheSource()

C++ Interface: get_composition_cache_source(TransformState self, int n)

/**
  • Returns the source TransformState of the nth element in the composition

  • cache. Returns NULL if there doesn’t happen to be an entry in the nth

  • element. See get_composition_cache_result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getGeomRendering()

C++ Interface: get_geom_rendering(TransformState self, int geom_rendering)

/**
  • Returns the union of the Geom::GeomRendering bits that will be required

  • once this TransformState is applied to a geom which includes the indicated

  • geom_rendering bits. The RenderState’s get_geom_rendering() should already

  • have been applied.

*/

getHash()

C++ Interface: get_hash(TransformState self)

/**
  • Returns a suitable hash value for phash_map.

*/

getHpr()

C++ Interface: get_hpr(TransformState self)

/**
  • Returns the rotation component of the transform as a trio of Euler angles.

  • It is an error to call this if has_components() returned false.

*/

getInverse()

C++ Interface: get_inverse(TransformState self)

/**
  • Returns the inverse of this transform. If you are going to immediately

  • compose this result with another TransformState, it is faster to do it in

  • one operation with invert_compose().

*/

getInverseMat()

C++ Interface: get_inverse_mat(TransformState self)

/**
  • Returns the inverse of the matrix, or nullptr if it’s singular.

*/

getInvertCompositionCache()

C++ Interface: get_invert_composition_cache(TransformState self)

getInvertCompositionCacheNumEntries()

C++ Interface: get_invert_composition_cache_num_entries(TransformState self)

/**
  • Returns the number of entries in the invert_composition cache for this

  • TransformState. This is similar to the composition cache, but it records

  • cache entries for the invert_compose() operation. See

  • get_composition_cache_num_entries().

*/

getInvertCompositionCacheResult()

C++ Interface: get_invert_composition_cache_result(TransformState self, int n)

/**
  • Returns the result TransformState of the nth element in the invert

  • composition cache. Returns NULL if there doesn’t happen to be an entry in

  • the nth element.

  • In general, a->invert_compose(a->get_invert_composition_cache_source(n)) ==

  • a->get_invert_composition_cache_result(n).

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getInvertCompositionCacheSize()

C++ Interface: get_invert_composition_cache_size(TransformState self)

/**
  • Returns the number of slots in the composition cache for this

  • TransformState. You may use this as an upper bound when walking through

  • all of the composition cache results via

  • get_invert_composition_cache_source() or result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getInvertCompositionCacheSource()

C++ Interface: get_invert_composition_cache_source(TransformState self, int n)

/**
  • Returns the source TransformState of the nth element in the invert

  • composition cache. Returns NULL if there doesn’t happen to be an entry in

  • the nth element. See get_invert_composition_cache_result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

getMat()

C++ Interface: get_mat(TransformState self)

/**
  • Returns the matrix that describes the transform.

*/

getMat3()

C++ Interface: get_mat3(TransformState self)

/**
  • Returns the 3x3 matrix that describes the 2-d transform. It is an error to

  • call this if is_2d() returned false.

*/

getNormQuat()

C++ Interface: get_norm_quat(TransformState self)

/**
  • Returns the rotation component of the transform as a quaternion. Unlike

  • the result of get_quat(), the return value of this method is guaranteed to

  • be normalized. It is an error to call this if has_components() returned

  • false.

*/

getNumStates()

C++ Interface: get_num_states()

/**
  • Returns the total number of unique TransformState objects allocated in the

  • world. This will go up and down during normal operations.

*/

getNumUnusedStates()

C++ Interface: get_num_unused_states()

/**
  • Returns the total number of TransformState objects that have been allocated

  • but have no references outside of the internal TransformState cache.

  • A nonzero return value is not necessarily indicative of leaked references;

  • it is normal for two TransformState objects, both of which have references

  • held outside the cache, to have the result of their composition stored

  • within the cache. This result will be retained within the cache until one

  • of the base TransformStates is released.

  • Use list_cycles() to get an idea of the number of actual “leaked”

  • TransformState objects.

*/

getPos()

C++ Interface: get_pos(TransformState self)

// Force interrogate to make a copy as a temporary solution for #1625.

// Force interrogate to make a copy as a temporary solution for #1625.

/**
  • Returns the pos component of the transform. It is an error to call this if

  • has_pos() returned false.

*/

getPos2d()

C++ Interface: get_pos2d(TransformState self)

/**
  • Returns the pos component of the 2-d transform. It is an error to call

  • this if has_pos() or is_2d() returned false.

*/

getQuat()

C++ Interface: get_quat(TransformState self)

/**
  • Returns the rotation component of the transform as a quaternion. The

  • return value will be normalized if a normalized quaternion was given to the

  • constructor (or if the quaternion was computed implicitly); it will be non-

  • normalized if a non-normalized quaternion was given to the constructor.

  • See also get_norm_quat().

  • It is an error to call this if has_components() returned false.

*/

getRotate2d()

C++ Interface: get_rotate2d(TransformState self)

/**
  • Returns the rotation component of the 2-d transform as an angle in degrees

  • clockwise about the origin. It is an error to call this if

  • has_components() or is_2d() returned false.

*/

getScale()

C++ Interface: get_scale(TransformState self)

/**
  • Returns the scale component of the transform. It is an error to call this

  • if has_components() returned false.

*/

getScale2d()

C++ Interface: get_scale2d(TransformState self)

/**
  • Returns the scale component of the 2-d transform. It is an error to call

  • this if has_components() or is_2d() returned false.

*/

getShear()

C++ Interface: get_shear(TransformState self)

/**
  • Returns the shear component of the transform. It is an error to call this

  • if has_components() returned false.

*/

getShear2d()

C++ Interface: get_shear2d(TransformState self)

/**
  • Returns the shear component of the 2-d transform. It is an error to call

  • this if has_components() or is_2d() returned false.

*/

getStates()

C++ Interface: get_states()

getUniformScale()

C++ Interface: get_uniform_scale(TransformState self)

/**
  • Returns the scale component of the transform, as a single number. It is an

  • error to call this if has_uniform_scale() returned false.

*/

getUnique()

C++ Interface: get_unique(TransformState self)

/**
  • Returns the pointer to the unique TransformState in the cache that is

  • equivalent to this one. This may be the same pointer as this object, or it

  • may be a different pointer; but it will be an equivalent object, and it

  • will be a shared pointer. This may be called from time to time to improve

  • cache benefits.

*/

getUnusedStates()

C++ Interface: get_unused_states()

get_class_type()

C++ Interface: get_class_type()

get_composition_cache()

C++ Interface: get_composition_cache(TransformState self)

get_composition_cache_num_entries()

C++ Interface: get_composition_cache_num_entries(TransformState self)

/**
  • Returns the number of entries in the composition cache for this

  • TransformState. This is the number of other TransformStates whose

  • composition with this one has been cached. This number is not useful for

  • any practical reason other than performance analysis.

*/

get_composition_cache_result()

C++ Interface: get_composition_cache_result(TransformState self, int n)

/**
  • Returns the result TransformState of the nth element in the composition

  • cache. Returns NULL if there doesn’t happen to be an entry in the nth

  • element.

  • In general, a->compose(a->get_composition_cache_source(n)) ==

  • a->get_composition_cache_result(n).

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_composition_cache_size()

C++ Interface: get_composition_cache_size(TransformState self)

/**
  • Returns the number of slots in the composition cache for this

  • TransformState. You may use this as an upper bound when walking through

  • all of the composition cache results via get_composition_cache_source() or

  • result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_composition_cache_source()

C++ Interface: get_composition_cache_source(TransformState self, int n)

/**
  • Returns the source TransformState of the nth element in the composition

  • cache. Returns NULL if there doesn’t happen to be an entry in the nth

  • element. See get_composition_cache_result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_geom_rendering()

C++ Interface: get_geom_rendering(TransformState self, int geom_rendering)

/**
  • Returns the union of the Geom::GeomRendering bits that will be required

  • once this TransformState is applied to a geom which includes the indicated

  • geom_rendering bits. The RenderState’s get_geom_rendering() should already

  • have been applied.

*/

get_hash()

C++ Interface: get_hash(TransformState self)

/**
  • Returns a suitable hash value for phash_map.

*/

get_hpr()

C++ Interface: get_hpr(TransformState self)

/**
  • Returns the rotation component of the transform as a trio of Euler angles.

  • It is an error to call this if has_components() returned false.

*/

get_inverse()

C++ Interface: get_inverse(TransformState self)

/**
  • Returns the inverse of this transform. If you are going to immediately

  • compose this result with another TransformState, it is faster to do it in

  • one operation with invert_compose().

*/

get_inverse_mat()

C++ Interface: get_inverse_mat(TransformState self)

/**
  • Returns the inverse of the matrix, or nullptr if it’s singular.

*/

get_invert_composition_cache()

C++ Interface: get_invert_composition_cache(TransformState self)

get_invert_composition_cache_num_entries()

C++ Interface: get_invert_composition_cache_num_entries(TransformState self)

/**
  • Returns the number of entries in the invert_composition cache for this

  • TransformState. This is similar to the composition cache, but it records

  • cache entries for the invert_compose() operation. See

  • get_composition_cache_num_entries().

*/

get_invert_composition_cache_result()

C++ Interface: get_invert_composition_cache_result(TransformState self, int n)

/**
  • Returns the result TransformState of the nth element in the invert

  • composition cache. Returns NULL if there doesn’t happen to be an entry in

  • the nth element.

  • In general, a->invert_compose(a->get_invert_composition_cache_source(n)) ==

  • a->get_invert_composition_cache_result(n).

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_invert_composition_cache_size()

C++ Interface: get_invert_composition_cache_size(TransformState self)

/**
  • Returns the number of slots in the composition cache for this

  • TransformState. You may use this as an upper bound when walking through

  • all of the composition cache results via

  • get_invert_composition_cache_source() or result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_invert_composition_cache_source()

C++ Interface: get_invert_composition_cache_source(TransformState self, int n)

/**
  • Returns the source TransformState of the nth element in the invert

  • composition cache. Returns NULL if there doesn’t happen to be an entry in

  • the nth element. See get_invert_composition_cache_result().

  • This has no practical value other than for examining the cache for

  • performance analysis.

*/

get_mat()

C++ Interface: get_mat(TransformState self)

/**
  • Returns the matrix that describes the transform.

*/

get_mat3()

C++ Interface: get_mat3(TransformState self)

/**
  • Returns the 3x3 matrix that describes the 2-d transform. It is an error to

  • call this if is_2d() returned false.

*/

get_norm_quat()

C++ Interface: get_norm_quat(TransformState self)

/**
  • Returns the rotation component of the transform as a quaternion. Unlike

  • the result of get_quat(), the return value of this method is guaranteed to

  • be normalized. It is an error to call this if has_components() returned

  • false.

*/

get_num_states()

C++ Interface: get_num_states()

/**
  • Returns the total number of unique TransformState objects allocated in the

  • world. This will go up and down during normal operations.

*/

get_num_unused_states()

C++ Interface: get_num_unused_states()

/**
  • Returns the total number of TransformState objects that have been allocated

  • but have no references outside of the internal TransformState cache.

  • A nonzero return value is not necessarily indicative of leaked references;

  • it is normal for two TransformState objects, both of which have references

  • held outside the cache, to have the result of their composition stored

  • within the cache. This result will be retained within the cache until one

  • of the base TransformStates is released.

  • Use list_cycles() to get an idea of the number of actual “leaked”

  • TransformState objects.

*/

get_pos()

C++ Interface: get_pos(TransformState self)

// Force interrogate to make a copy as a temporary solution for #1625.

// Force interrogate to make a copy as a temporary solution for #1625.

/**
  • Returns the pos component of the transform. It is an error to call this if

  • has_pos() returned false.

*/

get_pos2d()

C++ Interface: get_pos2d(TransformState self)

/**
  • Returns the pos component of the 2-d transform. It is an error to call

  • this if has_pos() or is_2d() returned false.

*/

get_quat()

C++ Interface: get_quat(TransformState self)

/**
  • Returns the rotation component of the transform as a quaternion. The

  • return value will be normalized if a normalized quaternion was given to the

  • constructor (or if the quaternion was computed implicitly); it will be non-

  • normalized if a non-normalized quaternion was given to the constructor.

  • See also get_norm_quat().

  • It is an error to call this if has_components() returned false.

*/

get_rotate2d()

C++ Interface: get_rotate2d(TransformState self)

/**
  • Returns the rotation component of the 2-d transform as an angle in degrees

  • clockwise about the origin. It is an error to call this if

  • has_components() or is_2d() returned false.

*/

get_scale()

C++ Interface: get_scale(TransformState self)

/**
  • Returns the scale component of the transform. It is an error to call this

  • if has_components() returned false.

*/

get_scale2d()

C++ Interface: get_scale2d(TransformState self)

/**
  • Returns the scale component of the 2-d transform. It is an error to call

  • this if has_components() or is_2d() returned false.

*/

get_shear()

C++ Interface: get_shear(TransformState self)

/**
  • Returns the shear component of the transform. It is an error to call this

  • if has_components() returned false.

*/

get_shear2d()

C++ Interface: get_shear2d(TransformState self)

/**
  • Returns the shear component of the 2-d transform. It is an error to call

  • this if has_components() or is_2d() returned false.

*/

get_states()

C++ Interface: get_states()

get_uniform_scale()

C++ Interface: get_uniform_scale(TransformState self)

/**
  • Returns the scale component of the transform, as a single number. It is an

  • error to call this if has_uniform_scale() returned false.

*/

get_unique()

C++ Interface: get_unique(TransformState self)

/**
  • Returns the pointer to the unique TransformState in the cache that is

  • equivalent to this one. This may be the same pointer as this object, or it

  • may be a different pointer; but it will be an equivalent object, and it

  • will be a shared pointer. This may be called from time to time to improve

  • cache benefits.

*/

get_unused_states()

C++ Interface: get_unused_states()

hasComponents()

C++ Interface: has_components(TransformState self)

/**
  • Returns true if the transform can be described by separate pos, hpr, and

  • scale components. Most transforms we use in everyday life can be so

  • described, but some kinds of transforms (for instance, those involving a

  • skew) cannot.

  • This is not related to whether the transform was originally described

  • componentwise. Even a transform that was constructed with a 4x4 may return

  • true here if the matrix is a simple affine matrix with no skew.

  • If this returns true, you may safely call get_hpr() and get_scale() to

  • retrieve the components. (You may always safely call get_pos() whether

  • this returns true or false.)

*/

hasHpr()

C++ Interface: has_hpr(TransformState self)

/**
  • Returns true if the transform’s rotation component can be extracted out

  • separately and described as a set of Euler angles. This is generally true

  • only when has_components() is true.

*/

hasIdentityScale()

C++ Interface: has_identity_scale(TransformState self)

/**
  • Returns true if the scale is uniform 1.0, or false if the scale has some

  • real value.

*/

hasMat()

C++ Interface: has_mat(TransformState self)

/**
  • Returns true if the transform can be described as a matrix. This is

  • generally always true, unless is_invalid() is true.

*/

hasNonzeroShear()

C++ Interface: has_nonzero_shear(TransformState self)

/**
  • Returns true if the shear component is non-zero, false if it is zero or if

  • the matrix cannot be decomposed.

*/

hasPos()

C++ Interface: has_pos(TransformState self)

/**
  • Returns true if the transform’s pos component can be extracted out

  • separately. This is generally always true, unless the transform is invalid

  • (i.e. is_invalid() returns true).

*/

hasQuat()

C++ Interface: has_quat(TransformState self)

/**
  • Returns true if the transform’s rotation component can be extracted out

  • separately and described as a quaternion. This is generally true only when

  • has_components() is true.

*/

hasScale()

C++ Interface: has_scale(TransformState self)

/**
  • Returns true if the transform’s scale component can be extracted out

  • separately. This is generally true only when has_components() is true.

*/

hasShear()

C++ Interface: has_shear(TransformState self)

/**
  • Returns true if the transform’s shear component can be extracted out

  • separately. This is generally true only when has_components() is true.

*/

hasUniformScale()

C++ Interface: has_uniform_scale(TransformState self)

/**
  • Returns true if the scale is uniform across all three axes (and therefore

  • can be expressed as a single number), or false if the transform has a

  • different scale in different dimensions.

*/

has_components()

C++ Interface: has_components(TransformState self)

/**
  • Returns true if the transform can be described by separate pos, hpr, and

  • scale components. Most transforms we use in everyday life can be so

  • described, but some kinds of transforms (for instance, those involving a

  • skew) cannot.

  • This is not related to whether the transform was originally described

  • componentwise. Even a transform that was constructed with a 4x4 may return

  • true here if the matrix is a simple affine matrix with no skew.

  • If this returns true, you may safely call get_hpr() and get_scale() to

  • retrieve the components. (You may always safely call get_pos() whether

  • this returns true or false.)

*/

has_hpr()

C++ Interface: has_hpr(TransformState self)

/**
  • Returns true if the transform’s rotation component can be extracted out

  • separately and described as a set of Euler angles. This is generally true

  • only when has_components() is true.

*/

has_identity_scale()

C++ Interface: has_identity_scale(TransformState self)

/**
  • Returns true if the scale is uniform 1.0, or false if the scale has some

  • real value.

*/

has_mat()

C++ Interface: has_mat(TransformState self)

/**
  • Returns true if the transform can be described as a matrix. This is

  • generally always true, unless is_invalid() is true.

*/

has_nonzero_shear()

C++ Interface: has_nonzero_shear(TransformState self)

/**
  • Returns true if the shear component is non-zero, false if it is zero or if

  • the matrix cannot be decomposed.

*/

has_pos()

C++ Interface: has_pos(TransformState self)

/**
  • Returns true if the transform’s pos component can be extracted out

  • separately. This is generally always true, unless the transform is invalid

  • (i.e. is_invalid() returns true).

*/

has_quat()

C++ Interface: has_quat(TransformState self)

/**
  • Returns true if the transform’s rotation component can be extracted out

  • separately and described as a quaternion. This is generally true only when

  • has_components() is true.

*/

has_scale()

C++ Interface: has_scale(TransformState self)

/**
  • Returns true if the transform’s scale component can be extracted out

  • separately. This is generally true only when has_components() is true.

*/

has_shear()

C++ Interface: has_shear(TransformState self)

/**
  • Returns true if the transform’s shear component can be extracted out

  • separately. This is generally true only when has_components() is true.

*/

has_uniform_scale()

C++ Interface: has_uniform_scale(TransformState self)

/**
  • Returns true if the scale is uniform across all three axes (and therefore

  • can be expressed as a single number), or false if the transform has a

  • different scale in different dimensions.

*/

hpr
hprGiven()

C++ Interface: hpr_given(TransformState self)

/**
  • Returns true if the rotation was specified via a trio of Euler angles,

  • false otherwise. If this is true, get_hpr() will be exactly as set;

  • otherwise, it will return a computed value.

*/

hpr_given()

C++ Interface: hpr_given(TransformState self)

/**
  • Returns true if the rotation was specified via a trio of Euler angles,

  • false otherwise. If this is true, get_hpr() will be exactly as set;

  • otherwise, it will return a computed value.

*/

invertCompose()

C++ Interface: invert_compose(TransformState self, const TransformState other)

/**
  • Returns a new TransformState object that represents the composition of this

  • state’s inverse with the other state.

  • This is similar to compose(), but is particularly useful for computing the

  • relative state of a node as viewed from some other node.

*/

invert_compose()

C++ Interface: invert_compose(TransformState self, const TransformState other)

/**
  • Returns a new TransformState object that represents the composition of this

  • state’s inverse with the other state.

  • This is similar to compose(), but is particularly useful for computing the

  • relative state of a node as viewed from some other node.

*/

is2d()

C++ Interface: is_2d(TransformState self)

/**
  • Returns true if the transform has been constructed entirely using the 2-d

  • transform operations, e.g. make_pos2d(), and therefore operates strictly

  • in two-dimensional space on X and Y only.

*/

isIdentity()

C++ Interface: is_identity(TransformState self)

/**
  • Returns true if the transform represents the identity matrix, false

  • otherwise.

*/

isInvalid()

C++ Interface: is_invalid(TransformState self)

/**
  • Returns true if the transform represents an invalid matrix, for instance

  • the result of inverting a singular matrix, or false if the transform is

  • valid.

*/

isSingular()

C++ Interface: is_singular(TransformState self)

/**
  • Returns true if the transform represents a singular transform (that is, it

  • has a zero scale, and it cannot be inverted), or false otherwise.

*/

is_2d()

C++ Interface: is_2d(TransformState self)

/**
  • Returns true if the transform has been constructed entirely using the 2-d

  • transform operations, e.g. make_pos2d(), and therefore operates strictly

  • in two-dimensional space on X and Y only.

*/

is_identity()

C++ Interface: is_identity(TransformState self)

/**
  • Returns true if the transform represents the identity matrix, false

  • otherwise.

*/

is_invalid()

C++ Interface: is_invalid(TransformState self)

/**
  • Returns true if the transform represents an invalid matrix, for instance

  • the result of inverting a singular matrix, or false if the transform is

  • valid.

*/

is_singular()

C++ Interface: is_singular(TransformState self)

/**
  • Returns true if the transform represents a singular transform (that is, it

  • has a zero scale, and it cannot be inverted), or false otherwise.

*/

listCycles()

C++ Interface: list_cycles(ostream out)

/**
  • Detects all of the reference-count cycles in the cache and reports them to

  • standard output.

  • These cycles may be inadvertently created when state compositions cycle

  • back to a starting point. Nowadays, these cycles should be automatically

  • detected and broken, so this method should never list any cycles unless

  • there is a bug in that detection logic.

  • The cycles listed here are not leaks in the strictest sense of the word,

  • since they can be reclaimed by a call to clear_cache(); but they will not

  • be reclaimed automatically.

*/

listStates()

C++ Interface: list_states(ostream out)

/**
  • Lists all of the TransformStates in the cache to the output stream, one per

  • line. This can be quite a lot of output if the cache is large, so be

  • prepared.

*/

list_cycles()

C++ Interface: list_cycles(ostream out)

/**
  • Detects all of the reference-count cycles in the cache and reports them to

  • standard output.

  • These cycles may be inadvertently created when state compositions cycle

  • back to a starting point. Nowadays, these cycles should be automatically

  • detected and broken, so this method should never list any cycles unless

  • there is a bug in that detection logic.

  • The cycles listed here are not leaks in the strictest sense of the word,

  • since they can be reclaimed by a call to clear_cache(); but they will not

  • be reclaimed automatically.

*/

list_states()

C++ Interface: list_states(ostream out)

/**
  • Lists all of the TransformStates in the cache to the output stream, one per

  • line. This can be quite a lot of output if the cache is large, so be

  • prepared.

*/

makeHpr()

C++ Interface: make_hpr(const LVecBase3f hpr)

/**
  • Makes a new TransformState with the specified components.

*/

makeIdentity()

C++ Interface: make_identity()

/**
  • Constructs an identity transform.

*/

makeInvalid()

C++ Interface: make_invalid()

/**
  • Constructs an invalid transform; for instance, the result of inverting a

  • singular matrix.

*/

makeMat()

C++ Interface: make_mat(const LMatrix4f mat)

/**
  • Makes a new TransformState with the specified transformation matrix.

*/

makeMat3()

C++ Interface: make_mat3(const LMatrix3f mat)

/**
  • Makes a new two-dimensional TransformState with the specified 3x3

  • transformation matrix.

*/

makePos()

C++ Interface: make_pos(const LVecBase3f pos)

/**
  • Makes a new TransformState with the specified components.

*/

makePos2d()

C++ Interface: make_pos2d(const LVecBase2f pos)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

makePosHpr()

C++ Interface: make_pos_hpr(const LVecBase3f pos, const LVecBase3f hpr)

/**
  • Makes a new TransformState with the specified components.

*/

makePosHprScale()

C++ Interface: make_pos_hpr_scale(const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale)

/**
  • Makes a new TransformState with the specified components.

*/

makePosHprScaleShear()

C++ Interface: make_pos_hpr_scale_shear(const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale, const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

makePosQuat()

C++ Interface: make_pos_quat(const LVecBase3f pos, const LQuaternionf quat)

/**
  • Makes a new TransformState with the specified components.

*/

makePosQuatScale()

C++ Interface: make_pos_quat_scale(const LVecBase3f pos, const LQuaternionf quat, const LVecBase3f scale)

/**
  • Makes a new TransformState with the specified components.

*/

makePosQuatScaleShear()

C++ Interface: make_pos_quat_scale_shear(const LVecBase3f pos, const LQuaternionf quat, const LVecBase3f scale, const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

makePosRotate2d()

C++ Interface: make_pos_rotate2d(const LVecBase2f pos, float rotate)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

makePosRotateScale2d()

C++ Interface: make_pos_rotate_scale2d(const LVecBase2f pos, float rotate, const LVecBase2f scale)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

makePosRotateScaleShear2d()

C++ Interface: make_pos_rotate_scale_shear2d(const LVecBase2f pos, float rotate, const LVecBase2f scale, float shear)

/**
  • Makes a new two-dimensional TransformState with the specified components.

*/

makeQuat()

C++ Interface: make_quat(const LQuaternionf quat)

/**
  • Makes a new TransformState with the specified components.

*/

makeRotate2d()

C++ Interface: make_rotate2d(float rotate)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

makeScale()

C++ Interface: make_scale(const LVecBase3f scale) make_scale(float scale)

/**
  • Makes a new TransformState with the specified components.

*/

/**
  • Makes a new TransformState with the specified components.

*/

makeScale2d()

C++ Interface: make_scale2d(const LVecBase2f scale) make_scale2d(float scale)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

/**
  • Makes a new 2-d TransformState with the specified components.

*/

makeShear()

C++ Interface: make_shear(const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

makeShear2d()

C++ Interface: make_shear2d(float shear)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_hpr()

C++ Interface: make_hpr(const LVecBase3f hpr)

/**
  • Makes a new TransformState with the specified components.

*/

make_identity()

C++ Interface: make_identity()

/**
  • Constructs an identity transform.

*/

make_invalid()

C++ Interface: make_invalid()

/**
  • Constructs an invalid transform; for instance, the result of inverting a

  • singular matrix.

*/

make_mat()

C++ Interface: make_mat(const LMatrix4f mat)

/**
  • Makes a new TransformState with the specified transformation matrix.

*/

make_mat3()

C++ Interface: make_mat3(const LMatrix3f mat)

/**
  • Makes a new two-dimensional TransformState with the specified 3x3

  • transformation matrix.

*/

make_pos()

C++ Interface: make_pos(const LVecBase3f pos)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos2d()

C++ Interface: make_pos2d(const LVecBase2f pos)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_pos_hpr()

C++ Interface: make_pos_hpr(const LVecBase3f pos, const LVecBase3f hpr)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_hpr_scale()

C++ Interface: make_pos_hpr_scale(const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_hpr_scale_shear()

C++ Interface: make_pos_hpr_scale_shear(const LVecBase3f pos, const LVecBase3f hpr, const LVecBase3f scale, const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_quat()

C++ Interface: make_pos_quat(const LVecBase3f pos, const LQuaternionf quat)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_quat_scale()

C++ Interface: make_pos_quat_scale(const LVecBase3f pos, const LQuaternionf quat, const LVecBase3f scale)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_quat_scale_shear()

C++ Interface: make_pos_quat_scale_shear(const LVecBase3f pos, const LQuaternionf quat, const LVecBase3f scale, const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

make_pos_rotate2d()

C++ Interface: make_pos_rotate2d(const LVecBase2f pos, float rotate)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_pos_rotate_scale2d()

C++ Interface: make_pos_rotate_scale2d(const LVecBase2f pos, float rotate, const LVecBase2f scale)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_pos_rotate_scale_shear2d()

C++ Interface: make_pos_rotate_scale_shear2d(const LVecBase2f pos, float rotate, const LVecBase2f scale, float shear)

/**
  • Makes a new two-dimensional TransformState with the specified components.

*/

make_quat()

C++ Interface: make_quat(const LQuaternionf quat)

/**
  • Makes a new TransformState with the specified components.

*/

make_rotate2d()

C++ Interface: make_rotate2d(float rotate)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_scale()

C++ Interface: make_scale(const LVecBase3f scale) make_scale(float scale)

/**
  • Makes a new TransformState with the specified components.

*/

/**
  • Makes a new TransformState with the specified components.

*/

make_scale2d()

C++ Interface: make_scale2d(const LVecBase2f scale) make_scale2d(float scale)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

/**
  • Makes a new 2-d TransformState with the specified components.

*/

make_shear()

C++ Interface: make_shear(const LVecBase3f shear)

/**
  • Makes a new TransformState with the specified components.

*/

make_shear2d()

C++ Interface: make_shear2d(float shear)

/**
  • Makes a new 2-d TransformState with the specified components.

*/

mat
nodeRef()

C++ Interface: node_ref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

nodeUnref()

C++ Interface: node_unref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

node_ref()

C++ Interface: node_ref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

node_unref()

C++ Interface: node_unref(TransformState self)

/**
  • Overrides this method to update PStats appropriately.

*/

norm_quat
output()

C++ Interface: output(TransformState self, ostream out)

/**

*/

pos

Force interrogate to make a copy as a temporary solution for #1625.

quat
quatGiven()

C++ Interface: quat_given(TransformState self)

/**
  • Returns true if the rotation was specified via a quaternion, false

  • otherwise. If this is true, get_quat() will be exactly as set; otherwise,

  • it will return a computed value.

*/

quat_given()

C++ Interface: quat_given(TransformState self)

/**
  • Returns true if the rotation was specified via a quaternion, false

  • otherwise. If this is true, get_quat() will be exactly as set; otherwise,

  • it will return a computed value.

*/

scale
setHpr()

C++ Interface: set_hpr(TransformState self, const LVecBase3f hpr)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

setPos()

C++ Interface: set_pos(TransformState self, const LVecBase3f pos)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its pos component replaced with the indicated value.

*/

setPos2d()

C++ Interface: set_pos2d(TransformState self, const LVecBase2f pos)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its pos component replaced with the indicated value.

*/

setQuat()

C++ Interface: set_quat(TransformState self, const LQuaternionf quat)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

setRotate2d()

C++ Interface: set_rotate2d(TransformState self, float rotate)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

setScale()

C++ Interface: set_scale(TransformState self, const LVecBase3f scale)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its scale component replaced with the indicated value,

  • if possible.

*/

setScale2d()

C++ Interface: set_scale2d(TransformState self, const LVecBase2f scale)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its scale component replaced with the indicated value,

  • if possible.

*/

setShear()

C++ Interface: set_shear(TransformState self, const LVecBase3f shear)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its shear component replaced with the indicated value,

  • if possible.

*/

setShear2d()

C++ Interface: set_shear2d(TransformState self, float shear)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its shear component replaced with the indicated value,

  • if possible.

*/

set_hpr()

C++ Interface: set_hpr(TransformState self, const LVecBase3f hpr)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

set_pos()

C++ Interface: set_pos(TransformState self, const LVecBase3f pos)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its pos component replaced with the indicated value.

*/

set_pos2d()

C++ Interface: set_pos2d(TransformState self, const LVecBase2f pos)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its pos component replaced with the indicated value.

*/

set_quat()

C++ Interface: set_quat(TransformState self, const LQuaternionf quat)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

set_rotate2d()

C++ Interface: set_rotate2d(TransformState self, float rotate)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its rotation component replaced with the indicated

  • value, if possible.

*/

set_scale()

C++ Interface: set_scale(TransformState self, const LVecBase3f scale)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its scale component replaced with the indicated value,

  • if possible.

*/

set_scale2d()

C++ Interface: set_scale2d(TransformState self, const LVecBase2f scale)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its scale component replaced with the indicated value,

  • if possible.

*/

set_shear()

C++ Interface: set_shear(TransformState self, const LVecBase3f shear)

/**
  • Returns a new TransformState object that represents the original

  • TransformState with its shear component replaced with the indicated value,

  • if possible.

*/

set_shear2d()

C++ Interface: set_shear2d(TransformState self, float shear)

/**
  • Returns a new TransformState object that represents the original 2-d

  • TransformState with its shear component replaced with the indicated value,

  • if possible.

*/

shear
validateCompositionCache()

C++ Interface: validate_composition_cache(TransformState self)

/**
  • Returns true if the composition cache and invert composition cache for this

  • particular TransformState are self-consistent and valid, false otherwise.

*/

validateStates()

C++ Interface: validate_states()

/**
  • Ensures that the cache is still stored in sorted order, and that none of

  • the cache elements have been inadvertently deleted. Returns true if so,

  • false if there is a problem (which implies someone has modified one of the

  • supposedly-const TransformState objects).

*/

validate_composition_cache()

C++ Interface: validate_composition_cache(TransformState self)

/**
  • Returns true if the composition cache and invert composition cache for this

  • particular TransformState are self-consistent and valid, false otherwise.

*/

validate_states()

C++ Interface: validate_states()

/**
  • Ensures that the cache is still stored in sorted order, and that none of

  • the cache elements have been inadvertently deleted. Returns true if so,

  • false if there is a problem (which implies someone has modified one of the

  • supposedly-const TransformState objects).

*/

write()

C++ Interface: write(TransformState self, ostream out, int indent_level)

/**

*/

writeCompositionCache()

C++ Interface: write_composition_cache(TransformState self, ostream out, int indent_level)

/**
  • Writes a brief description of the composition cache and invert composition

  • cache to the indicated ostream. This is not useful except for performance

  • analysis, to examine the cache structure.

*/

write_composition_cache()

C++ Interface: write_composition_cache(TransformState self, ostream out, int indent_level)

/**
  • Writes a brief description of the composition cache and invert composition

  • cache to the indicated ostream. This is not useful except for performance

  • analysis, to examine the cache structure.

*/