clash_info#
This module provides data structures for storing clash detection information.
Enumerations#
OverlapType#
ClashState#
- class omni.physxclashdetectioncore.clash_info.ClashState#
An enumeration representing the various states a clash can be in.
Values:
- NEW#
Newly detected clash.
- APPROVED#
Clash has been approved/acknowledged.
- RESOLVED#
Clash has been resolved.
- CLOSED#
Clash has been closed.
- INVALID#
Clash is marked as invalid.
- ACTIVE#
Clash is currently active.
Classes#
ClashFrameInfo#
- class omni.physxclashdetectioncore.clash_info.ClashFrameInfo(
- timecode: float = 0.0,
- min_distance: float = 0.0,
- max_local_depth: float = -1.0,
- overlap_tris: int = 0,
- usd_faces_0: wp.array | None = None,
- usd_faces_1: wp.array | None = None,
- collision_outline: wp.array | None = None,
- object_0_matrix: Gf.Matrix4d | None = None,
- object_1_matrix: Gf.Matrix4d | None = None,
- device: str = 'cpu',
A class for storing information about a specific frame in a clash detection sequence.
This class contains details about a particular frame, including the timecode, minimum distance between objects, maximum local depth of a contact, number of overlapping triangles, the faces involved in the clash, collision outline, and world matrices of both objects.
- Parameters:
timecode (float) – The timecode in seconds of the frame at which the clash occurs. Defaults to 0.0.
min_distance (float) – The minimum distance between clashing objects. 0=Hard clash, otherwise soft clash. Defaults to 0.0.
max_local_depth (float) – The maximum depth of the local space of the clashing objects. -1 means no depth check. Defaults to -1.0.
overlap_tris (int) – The number of overlapping triangles at this frame. Defaults to 0.
usd_faces_0 (Optional[wp.array]) – The face indices from the first object involved in the clash. Must have dtype=wp.uint32. Defaults to None.
usd_faces_1 (Optional[wp.array]) – The face indices from the second object involved in the clash. Must have dtype=wp.uint32. Defaults to None.
collision_outline (Optional[wp.array]) – Sequence of 3D points forming the collision outline. Must have dtype=wp.float32. Defaults to None.
object_0_matrix (Optional[Gf.Matrix4d]) – World transformation matrix of the first object at this frame. Defaults to None.
object_1_matrix (Optional[Gf.Matrix4d]) – World transformation matrix of the second object at this frame. Defaults to None.
device (str) – Target device for warp arrays. Can be “cpu” or “cuda:0” etc. Defaults to “cpu”.
Class Constants:
- VERSION: int = 6#
Version of the ClashFrameInfo data structure.
- EPSILON: float = 1e-6#
Epsilon value for floating point comparisons.
Methods:
- serialize_to_dict() Dict[str, Any]#
Converts the ClashFrameInfo instance to a dictionary in JSON-serializable format.
- Returns:
Dictionary containing the serialized ClashFrameInfo data.
- Return type:
Dict[str, Any]
- classmethod deserialize_from_dict(data: Dict[str, Any]) ClashFrameInfo | None#
Deserializes a ClashFrameInfo instance from a JSON-serializable dictionary format.
- Parameters:
data (Dict[str, Any]) – Dictionary containing serialized ClashFrameInfo data.
- Returns:
New ClashFrameInfo instance if deserialization succeeds, None if it fails.
- Return type:
ClashFrameInfo | None
- check_object_0_matrix_changed(mtx: Gf.Matrix4d) bool#
Determines whether the matrix of the first object is different from the provided matrix.
- Parameters:
mtx (Gf.Matrix4d) – The matrix to compare against the object’s stored matrix.
- Returns:
Returns True if the object’s matrix differs; otherwise, False.
- Return type:
bool
- check_object_1_matrix_changed(mtx: Gf.Matrix4d) bool#
Determines whether the matrix of the second object is different from the provided matrix.
- Parameters:
mtx (Gf.Matrix4d) – The matrix to compare against the object’s stored matrix.
- Returns:
Returns True if the object’s matrix differs; otherwise, False.
- Return type:
bool
Properties:
- timecode: float#
Read-only property that returns the timecode (time in seconds) of the frame where the clash was detected.
- min_distance: float#
Gets the minimal distance between clashing objects.
- max_local_depth: float#
Gets or sets the maximum local depth between clashing objects.
- penetration_depth_px: float#
Gets or sets the penetration depth in the +X direction (1.0, 0.0, 0.0).
- penetration_depth_nx: float#
Gets or sets the penetration depth in the -X direction (-1.0, 0.0, 0.0).
- penetration_depth_py: float#
Gets or sets the penetration depth in the +Y direction (0.0, 1.0, 0.0).
- penetration_depth_ny: float#
Gets or sets the penetration depth in the -Y direction (0.0, -1.0, 0.0).
- penetration_depth_pz: float#
Gets or sets the penetration depth in the +Z direction (0.0, 0.0, 1.0).
- penetration_depth_nz: float#
Gets or sets the penetration depth in the -Z direction (0.0, 0.0, -1.0).
- overlap_tris: int#
Read-only property that returns the number of overlapping triangles detected in this frame.
- usd_faces_0: wp.array#
Read-only property that returns the indices of the faces from the first object involved in the clash.
- usd_faces_1: wp.array#
Read-only property that returns the indices of the faces from the second object involved in the clash.
- collision_outline: wp.array#
Read-only property that returns the collision outline as a flat list of floats representing segments.
- object_0_matrix: Gf.Matrix4d | None#
Gets the world transformation matrix of the first object at the timecode of the clash.
- object_1_matrix: Gf.Matrix4d | None#
Gets the world transformation matrix of the second object at the timecode of the clash.
ClashInfo#
- class omni.physxclashdetectioncore.clash_info.ClashInfo(
- identifier: int = -1,
- query_id: int = 0,
- overlap_id: str = '',
- overlap_type: OverlapType = OverlapType.NORMAL,
- present: bool = True,
- min_distance: float = 0.0,
- max_local_depth: float = 0.0,
- depth_epsilon: float = -1.0,
- tolerance: float = 0.0,
- object_a_path: str = '',
- object_a_mesh_crc: str = '',
- object_b_path: str = '',
- object_b_mesh_crc: str = '',
- start_time: float = 0.0,
- end_time: float = 0.0,
- num_records: int = 0,
- overlap_tris: int = 0,
- state: ClashState = ClashState.NEW,
- priority: int = 0,
- person_in_charge: str = '',
- creation_timestamp: datetime | None = None,
- last_modified_timestamp: datetime | None = None,
- last_modified_by: str = '',
- comment: str = '',
- clash_frame_info_items: Sequence[ClashFrameInfo] | None = None,
A class for managing and storing information about object clashes.
This class encapsulates details about object clashes such as their identifiers, overlap information, object paths, matrices, timestamps, and other metadata relevant to clash detection and management.
Class Constants:
- VERSION: int = 16#
Version of the ClashInfo data structure.
- EPSILON: float = 1e-6#
Epsilon value for floating point comparisons.
Methods:
- serialize_to_dict() Dict[str, Any]#
Converts the ClashInfo instance to a dictionary in JSON-serializable format.
- Returns:
Dictionary containing the serialized ClashInfo data.
- Return type:
Dict[str, Any]
- classmethod deserialize_from_dict(
- data: Dict[str, Any],
- reset_identifier: bool = False,
Deserializes a ClashInfo instance from a JSON-serializable dictionary format.
- Parameters:
data (Dict[str, Any]) – Dictionary containing serialized ClashInfo data.
reset_identifier (bool) – If True, resets the identifier to -1 after deserialization. Defaults to False.
- Returns:
New ClashInfo instance populated with the deserialized data. Returns None if deserialization fails.
- Return type:
ClashInfo | None
- get_frame_info_index_by_timecode(timecode: float) int#
Finds the index of the frame info closest to the given timecode.
- Parameters:
timecode (float) – The target timecode to search for.
- Returns:
Index of the closest frame info.
- Return type:
int
- check_object_a_matrix_changed(
- stage: Usd.Stage,
- frame_info_index: int = 0,
Checks whether the matrix of object A at a given frame in the specified stage is different from the stored matrix.
- Parameters:
stage (Usd.Stage) – The stage containing the object.
frame_info_index (int) – ClashFrameInfo index. Defaults to 0.
- Returns:
Returns True if the object’s matrix differs; otherwise, False.
- Return type:
bool
- check_object_b_matrix_changed(
- stage: Usd.Stage,
- frame_info_index: int = 0,
Checks whether the matrix of object B at a given frame in the specified stage is different from the stored matrix.
- Parameters:
stage (Usd.Stage) – The stage containing the object.
frame_info_index (int) – ClashFrameInfo index. Defaults to 0.
- Returns:
Returns True if the object’s matrix differs; otherwise, False.
- Return type:
bool
- update_last_modified_timestamp() None#
Updates the last modified timestamp to the current datetime.
- get_clash_frame_info(index) ClashFrameInfo | None#
Retrieves the clash frame info at the specified index.
- Parameters:
index (int) – The index of the clash frame info to retrieve.
- Returns:
The clash frame info at the specified index or None if not found.
- Return type:
ClashFrameInfo | None
- get_last_clash_frame_info() ClashFrameInfo | None#
Retrieves the last clash frame info.
- Returns:
The last clash frame info or None if not found.
- Return type:
ClashFrameInfo | None
Properties:
- identifier: int#
Gets the unique identifier of the clash. -1 means not yet assigned.
- query_id: int#
Gets the originating clash set query ID.
- overlap_id: str#
Gets the overlap ID of the clash (128-bit hash as hex string).
- overlap_type: OverlapType#
Gets the overlapping type of the clash.
- is_contact: bool#
Gets whether the clash is a contact.
- is_hard_clash: bool#
Gets whether the clash is a hard clash.
- is_soft_clash: bool#
Gets whether the clash is a soft clash.
- is_duplicate: bool#
Gets whether the clash is a duplicate (fully overlapping identical meshes).
- present: bool#
Gets the presence status of the clash in the stage during the last run.
- min_distance: float#
Gets the minimal distance between clashing objects.
- max_local_depth: float#
Gets or sets the maximum local depth between clashing objects.
- depth_epsilon: float#
Gets the depth epsilon of the clash used to classify hard clashes vs contact cases.
- penetration_depth_px: float#
Gets or sets the penetration depth in the +X direction.
- penetration_depth_nx: float#
Gets or sets the penetration depth in the -X direction.
- penetration_depth_py: float#
Gets or sets the penetration depth in the +Y direction.
- penetration_depth_ny: float#
Gets or sets the penetration depth in the -Y direction.
- penetration_depth_pz: float#
Gets or sets the penetration depth in the +Z direction.
- penetration_depth_nz: float#
Gets or sets the penetration depth in the -Z direction.
- tolerance: float#
Gets the overlapping tolerance of the clash.
- object_a_path: str#
Gets the path to object A.
- object_a_mesh_crc: str#
Gets CRC checksum representing the mesh of the first object at the time of the clash.
- object_b_path: str#
Gets the path to object B.
- object_b_mesh_crc: str#
Gets CRC checksum representing the mesh of the second object at the time of the clash.
- start_time: float#
Gets the start time of the clash in the scene’s timeline.
- end_time: float#
Gets the end time of the clash in the scene’s timeline.
- num_records: int#
Gets the number of records or instances where this clash was detected.
- overlap_tris: int#
Gets the number of overlapping triangles.
- state: ClashState#
Gets or sets the state of the clash.
- priority: int#
Gets or sets the priority of the clash.
- person_in_charge: str#
Gets or sets the name of the person responsible for addressing this clash.
- creation_timestamp: datetime#
Gets the timestamp when the clash was first detected and recorded.
- last_modified_timestamp: datetime#
Gets or sets the timestamp of the last modification made to this clash record.
- last_modified_by: str#
Gets the name of the user who last modified this clash record.
- comment: str#
Gets or sets a comment or note associated with the clash.
- clash_frame_info_items: Sequence[ClashFrameInfo] | None#
Gets or sets the clash frame info items representing detailed information about each frame.