pub struct CollisionTriangle { /* private fields */ }Expand description
A collision triangle with vertex indices and edge adjacency information.
Represents a single triangle in the collision mesh along with its three edges and information about adjacent triangles. This adjacency data enables efficient collision detection and mesh traversal.
§Triangle Structure
Each triangle has:
- 3 vertex indices defining the triangle face
- 3 edges, each with adjacency to neighboring triangles
- Face index for identification
§Edge Adjacency
For each edge (1, 2, 3):
- Two vertex indices defining the edge
- Face index (redundant, same as main face_index)
- Across face index (index of triangle sharing this edge, or -1 if boundary)
§Fields
§Triangle Face
face_index- Index identifier for this trianglepadding- Alignment padding (always 0)vertex_1,vertex_2,vertex_3- Indices into the vertex array
§Edge 1
edge_1_vertex_1,edge_1_vertex_2- Vertex indices for edge 1face_index_1- Face index (same as face_index)edge_index_1- The edge’s number in the triangle (0)across_face_index_1- Index of adjacent triangle across edge 1 (-1 if none)
§Edge 2
edge_2_vertex_1,edge_2_vertex_2- Vertex indices for edge 2face_index_2- Face index (same as face_index)edge_index_2- The edge’s number in the triangle (1)across_face_index_2- Index of adjacent triangle across edge 2 (-1 if none)
§Edge 3
edge_3_vertex_1,edge_3_vertex_2- Vertex indices for edge 3face_index_3- Face index (same as face_index)edge_index_3- The edge’s number in the triangle (2)across_face_index_3- Index of adjacent triangle across edge 3 (-1 if none)
§Terminator
zero_4- Reserved field (always 0)
§Examples
for triangle in mesh.triangles() {
// Check if triangle has neighbors on all edges
let has_neighbor_1 = triangle.across_face_index_1() >= 0;
let has_neighbor_2 = triangle.across_face_index_2() >= 0;
let has_neighbor_3 = triangle.across_face_index_3() >= 0;
}Implementations§
Source§impl CollisionTriangle
impl CollisionTriangle
Sourcepub fn face_index(&self) -> &i32
pub fn face_index(&self) -> &i32
Index identifier for this triangle.
Sourcepub fn edge_1_vertex_1(&self) -> &i32
pub fn edge_1_vertex_1(&self) -> &i32
First vertex of edge 1.
Sourcepub fn edge_1_vertex_2(&self) -> &i32
pub fn edge_1_vertex_2(&self) -> &i32
Second vertex of edge 1.
Sourcepub fn face_index_1(&self) -> &i32
pub fn face_index_1(&self) -> &i32
Face index for edge 1 (same as face_index).
Sourcepub fn edge_index_1(&self) -> &i32
pub fn edge_index_1(&self) -> &i32
The edge’s number in the triangle: 0.
Sourcepub fn across_face_index_1(&self) -> &i32
pub fn across_face_index_1(&self) -> &i32
Index of triangle adjacent across edge 1 (-1 if none).
Sourcepub fn edge_2_vertex_1(&self) -> &i32
pub fn edge_2_vertex_1(&self) -> &i32
First vertex of edge 2.
Sourcepub fn edge_2_vertex_2(&self) -> &i32
pub fn edge_2_vertex_2(&self) -> &i32
Second vertex of edge 2.
Sourcepub fn face_index_2(&self) -> &i32
pub fn face_index_2(&self) -> &i32
Face index for edge 2 (same as face_index).
Sourcepub fn edge_index_2(&self) -> &i32
pub fn edge_index_2(&self) -> &i32
The edge’s number in the triangle: 1.
Sourcepub fn across_face_index_2(&self) -> &i32
pub fn across_face_index_2(&self) -> &i32
Index of triangle adjacent across edge 2 (-1 if none).
Sourcepub fn edge_3_vertex_1(&self) -> &i32
pub fn edge_3_vertex_1(&self) -> &i32
First vertex of edge 3.
Sourcepub fn edge_3_vertex_2(&self) -> &i32
pub fn edge_3_vertex_2(&self) -> &i32
Second vertex of edge 3.
Sourcepub fn face_index_3(&self) -> &i32
pub fn face_index_3(&self) -> &i32
Face index for edge 3 (same as face_index).
Sourcepub fn edge_index_3(&self) -> &i32
pub fn edge_index_3(&self) -> &i32
The edge’s number in the triangle: 2.
Sourcepub fn across_face_index_3(&self) -> &i32
pub fn across_face_index_3(&self) -> &i32
Index of triangle adjacent across edge 3 (-1 if none).
Source§impl CollisionTriangle
impl CollisionTriangle
Sourcepub fn face_index_mut(&mut self) -> &mut i32
pub fn face_index_mut(&mut self) -> &mut i32
Index identifier for this triangle.
Sourcepub fn padding_mut(&mut self) -> &mut i8
pub fn padding_mut(&mut self) -> &mut i8
Alignment padding (always 0).
Sourcepub fn vertex_1_mut(&mut self) -> &mut i32
pub fn vertex_1_mut(&mut self) -> &mut i32
First vertex index.
Sourcepub fn vertex_2_mut(&mut self) -> &mut i32
pub fn vertex_2_mut(&mut self) -> &mut i32
Second vertex index.
Sourcepub fn vertex_3_mut(&mut self) -> &mut i32
pub fn vertex_3_mut(&mut self) -> &mut i32
Third vertex index.
Sourcepub fn edge_1_vertex_1_mut(&mut self) -> &mut i32
pub fn edge_1_vertex_1_mut(&mut self) -> &mut i32
First vertex of edge 1.
Sourcepub fn edge_1_vertex_2_mut(&mut self) -> &mut i32
pub fn edge_1_vertex_2_mut(&mut self) -> &mut i32
Second vertex of edge 1.
Sourcepub fn face_index_1_mut(&mut self) -> &mut i32
pub fn face_index_1_mut(&mut self) -> &mut i32
Face index for edge 1 (same as face_index).
Sourcepub fn edge_index_1_mut(&mut self) -> &mut i32
pub fn edge_index_1_mut(&mut self) -> &mut i32
The edge’s number in the triangle: 0.
Sourcepub fn across_face_index_1_mut(&mut self) -> &mut i32
pub fn across_face_index_1_mut(&mut self) -> &mut i32
Index of triangle adjacent across edge 1 (-1 if none).
Sourcepub fn edge_2_vertex_1_mut(&mut self) -> &mut i32
pub fn edge_2_vertex_1_mut(&mut self) -> &mut i32
First vertex of edge 2.
Sourcepub fn edge_2_vertex_2_mut(&mut self) -> &mut i32
pub fn edge_2_vertex_2_mut(&mut self) -> &mut i32
Second vertex of edge 2.
Sourcepub fn face_index_2_mut(&mut self) -> &mut i32
pub fn face_index_2_mut(&mut self) -> &mut i32
Face index for edge 2 (same as face_index).
Sourcepub fn edge_index_2_mut(&mut self) -> &mut i32
pub fn edge_index_2_mut(&mut self) -> &mut i32
The edge’s number in the triangle: 1.
Sourcepub fn across_face_index_2_mut(&mut self) -> &mut i32
pub fn across_face_index_2_mut(&mut self) -> &mut i32
Index of triangle adjacent across edge 2 (-1 if none).
Sourcepub fn edge_3_vertex_1_mut(&mut self) -> &mut i32
pub fn edge_3_vertex_1_mut(&mut self) -> &mut i32
First vertex of edge 3.
Sourcepub fn edge_3_vertex_2_mut(&mut self) -> &mut i32
pub fn edge_3_vertex_2_mut(&mut self) -> &mut i32
Second vertex of edge 3.
Sourcepub fn face_index_3_mut(&mut self) -> &mut i32
pub fn face_index_3_mut(&mut self) -> &mut i32
Face index for edge 3 (same as face_index).
Sourcepub fn edge_index_3_mut(&mut self) -> &mut i32
pub fn edge_index_3_mut(&mut self) -> &mut i32
The edge’s number in the triangle: 2.
Sourcepub fn across_face_index_3_mut(&mut self) -> &mut i32
pub fn across_face_index_3_mut(&mut self) -> &mut i32
Index of triangle adjacent across edge 3 (-1 if none).
Sourcepub fn zero_4_mut(&mut self) -> &mut i32
pub fn zero_4_mut(&mut self) -> &mut i32
Reserved terminator field (always 0).
Source§impl CollisionTriangle
impl CollisionTriangle
Sourcepub fn set_face_index(&mut self, val: i32) -> &mut Self
pub fn set_face_index(&mut self, val: i32) -> &mut Self
Index identifier for this triangle.
Sourcepub fn set_padding(&mut self, val: i8) -> &mut Self
pub fn set_padding(&mut self, val: i8) -> &mut Self
Alignment padding (always 0).
Sourcepub fn set_vertex_1(&mut self, val: i32) -> &mut Self
pub fn set_vertex_1(&mut self, val: i32) -> &mut Self
First vertex index.
Sourcepub fn set_vertex_2(&mut self, val: i32) -> &mut Self
pub fn set_vertex_2(&mut self, val: i32) -> &mut Self
Second vertex index.
Sourcepub fn set_vertex_3(&mut self, val: i32) -> &mut Self
pub fn set_vertex_3(&mut self, val: i32) -> &mut Self
Third vertex index.
Sourcepub fn set_edge_1_vertex_1(&mut self, val: i32) -> &mut Self
pub fn set_edge_1_vertex_1(&mut self, val: i32) -> &mut Self
First vertex of edge 1.
Sourcepub fn set_edge_1_vertex_2(&mut self, val: i32) -> &mut Self
pub fn set_edge_1_vertex_2(&mut self, val: i32) -> &mut Self
Second vertex of edge 1.
Sourcepub fn set_face_index_1(&mut self, val: i32) -> &mut Self
pub fn set_face_index_1(&mut self, val: i32) -> &mut Self
Face index for edge 1 (same as face_index).
Sourcepub fn set_edge_index_1(&mut self, val: i32) -> &mut Self
pub fn set_edge_index_1(&mut self, val: i32) -> &mut Self
The edge’s number in the triangle: 0.
Sourcepub fn set_across_face_index_1(&mut self, val: i32) -> &mut Self
pub fn set_across_face_index_1(&mut self, val: i32) -> &mut Self
Index of triangle adjacent across edge 1 (-1 if none).
Sourcepub fn set_edge_2_vertex_1(&mut self, val: i32) -> &mut Self
pub fn set_edge_2_vertex_1(&mut self, val: i32) -> &mut Self
First vertex of edge 2.
Sourcepub fn set_edge_2_vertex_2(&mut self, val: i32) -> &mut Self
pub fn set_edge_2_vertex_2(&mut self, val: i32) -> &mut Self
Second vertex of edge 2.
Sourcepub fn set_face_index_2(&mut self, val: i32) -> &mut Self
pub fn set_face_index_2(&mut self, val: i32) -> &mut Self
Face index for edge 2 (same as face_index).
Sourcepub fn set_edge_index_2(&mut self, val: i32) -> &mut Self
pub fn set_edge_index_2(&mut self, val: i32) -> &mut Self
The edge’s number in the triangle: 1.
Sourcepub fn set_across_face_index_2(&mut self, val: i32) -> &mut Self
pub fn set_across_face_index_2(&mut self, val: i32) -> &mut Self
Index of triangle adjacent across edge 2 (-1 if none).
Sourcepub fn set_edge_3_vertex_1(&mut self, val: i32) -> &mut Self
pub fn set_edge_3_vertex_1(&mut self, val: i32) -> &mut Self
First vertex of edge 3.
Sourcepub fn set_edge_3_vertex_2(&mut self, val: i32) -> &mut Self
pub fn set_edge_3_vertex_2(&mut self, val: i32) -> &mut Self
Second vertex of edge 3.
Sourcepub fn set_face_index_3(&mut self, val: i32) -> &mut Self
pub fn set_face_index_3(&mut self, val: i32) -> &mut Self
Face index for edge 3 (same as face_index).
Sourcepub fn set_edge_index_3(&mut self, val: i32) -> &mut Self
pub fn set_edge_index_3(&mut self, val: i32) -> &mut Self
The edge’s number in the triangle: 2.
Sourcepub fn set_across_face_index_3(&mut self, val: i32) -> &mut Self
pub fn set_across_face_index_3(&mut self, val: i32) -> &mut Self
Index of triangle adjacent across edge 3 (-1 if none).
Sourcepub fn set_zero_4(&mut self, val: i32) -> &mut Self
pub fn set_zero_4(&mut self, val: i32) -> &mut Self
Reserved terminator field (always 0).
Trait Implementations§
Source§impl Clone for CollisionTriangle
impl Clone for CollisionTriangle
Source§impl Debug for CollisionTriangle
impl Debug for CollisionTriangle
Source§impl Default for CollisionTriangle
impl Default for CollisionTriangle
Source§impl<'de> Deserialize<'de> for CollisionTriangle
impl<'de> Deserialize<'de> for CollisionTriangle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CollisionTriangle
impl PartialEq for CollisionTriangle
Source§impl Serialize for CollisionTriangle
impl Serialize for CollisionTriangle
impl StructuralPartialEq for CollisionTriangle
Auto Trait Implementations§
impl Freeze for CollisionTriangle
impl RefUnwindSafe for CollisionTriangle
impl Send for CollisionTriangle
impl Sync for CollisionTriangle
impl Unpin for CollisionTriangle
impl UnsafeUnpin for CollisionTriangle
impl UnwindSafe for CollisionTriangle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.