//! 2d line strip, 3d segment mesh, and nd subsimplex mesh. use std::mem; use std::sync::Arc; use na::{Translate, Point2}; use partitioning::BVT; use bounding_volume::AABB; use shape::{Segment, BaseMesh}; use math::{Point, Vector}; /// Shape commonly known as a 2d line strip or a 3d segment mesh. pub struct Polyline { mesh: BaseMesh, Segment

> } impl Clone for Polyline

{ fn clone(&self) -> Polyline

{ Polyline { mesh: self.mesh.clone() } } } impl

Polyline

where P: Point, P::Vect: Translate

{ /// Builds a new mesh. pub fn new(vertices: Arc>, indices: Arc>>, uvs: Option::Scalar>>>>, normals: Option>>) // a loosening margin for the BVT. -> Polyline

{ Polyline { mesh: BaseMesh::new(vertices, indices, uvs, normals) } } } impl

Polyline

where P: Point { /// The base representation of this mesh. #[inline] pub fn base_mesh(&self) -> &BaseMesh, Segment

> { &self.mesh } /// The vertices of this mesh. #[inline] pub fn vertices(&self) -> &Arc> { self.mesh.vertices() } /// Bounding volumes of the subsimplices. #[inline] pub fn bounding_volumes(&self) -> &[AABB

] { self.mesh.bounding_volumes() } /// The indices of this mesh. #[inline] pub fn indices(&self) -> &Arc>> { unsafe { mem::transmute(self.mesh.indices()) } } /// The texture coordinates of this mesh. #[inline] pub fn uvs(&self) -> &Option::Scalar>>>> { self.mesh.uvs() } /// The normals of this mesh. #[inline] pub fn normals(&self) -> &Option>> { self.mesh.normals() } /// The acceleration structure used for efficient collision detection and ray casting. #[inline] pub fn bvt(&self) -> &BVT> { self.mesh.bvt() } } impl Polyline

{ /// Gets the i-th mesh element. #[inline] pub fn segment_at(&self, i: usize) -> Segment

{ self.mesh.element_at(i) } }