pub struct PolytopeShape { /* private fields */ }Expand description
PLYT — a convex hull, version 3+. Domino’s dmPolytope.
The chunk stores fixed-size headers and variable-size payloads in two blocks; both halves are folded into this one struct, and the header’s counts are recomputed from the vectors on write. The header’s four pointer fields are filled in by the client at load time and are zero in every file, so they are not kept.
Implementations§
Source§impl PolytopeShape
impl PolytopeShape
Sourcepub fn vertices(&self) -> &[Vector3f]
pub fn vertices(&self) -> &[Vector3f]
Hull corners.
Zero-copy view of the underlying std::vector.
Sourcepub fn vertices_mut(&mut self) -> &mut [Vector3f]
pub fn vertices_mut(&mut self) -> &mut [Vector3f]
Zero-copy mutable view. Resize first — the borrow forbids it after.
pub fn set_vertices(&mut self, values: &[Vector3f])
pub fn resize_vertices(&mut self, count: usize)
Sourcepub fn face_planes(&self) -> &[Vector4f]
pub fn face_planes(&self) -> &[Vector4f]
Outward plane of each face, xyz normal and w offset.
Zero-copy view of the underlying std::vector.
Sourcepub fn face_planes_mut(&mut self) -> &mut [Vector4f]
pub fn face_planes_mut(&mut self) -> &mut [Vector4f]
Zero-copy mutable view. Resize first — the borrow forbids it after.
pub fn set_face_planes(&mut self, values: &[Vector4f])
pub fn resize_face_planes(&mut self, count: usize)
Sourcepub fn face_first_edges(&self) -> &[u8] ⓘ
pub fn face_first_edges(&self) -> &[u8] ⓘ
One entry per face: any half-edge bounding it, as the entry point for walking the face through PolytopeHalfEdge::nextEdge.
Zero-copy view of the underlying std::vector.
Sourcepub fn face_first_edges_mut(&mut self) -> &mut [u8] ⓘ
pub fn face_first_edges_mut(&mut self) -> &mut [u8] ⓘ
Zero-copy mutable view. Resize first — the borrow forbids it after.
pub fn set_face_first_edges(&mut self, values: &[u8])
pub fn resize_face_first_edges(&mut self, count: usize)
pub fn edges_len(&self) -> usize
Sourcepub fn edges(&self, index: usize) -> Option<Ref<'_, PolytopeHalfEdge>>
pub fn edges(&self, index: usize) -> Option<Ref<'_, PolytopeHalfEdge>>
Borrows element index in place. None when out of range.
pub fn edges_mut( &mut self, index: usize, ) -> Option<RefMut<'_, PolytopeHalfEdge>>
Sourcepub fn edges_iter(
&self,
) -> impl ExactSizeIterator<Item = Ref<'_, PolytopeHalfEdge>>
pub fn edges_iter( &self, ) -> impl ExactSizeIterator<Item = Ref<'_, PolytopeHalfEdge>>
Iterate the elements, borrowing each in turn.
pub fn resize_edges(&mut self, count: usize)
pub fn set_centroid(&mut self, value: Vector3f)
pub fn set_volume(&mut self, value: f32)
Sourcepub fn surface_area(&self) -> f32
pub fn surface_area(&self) -> f32
Hull surface area.
pub fn set_surface_area(&mut self, value: f32)
Sourcepub fn padding_04(&self) -> u32
pub fn padding_04(&self) -> u32
The four-byte gaps each count leaves in front of its 64-bit pointer, and the one that trails the header. Uninitialised in the files — some carry fragments of unrelated strings — so they are kept verbatim for writing.