//! Definition of the triangle shape. use na::{Dimension, Point3}; use na; use shape::BaseMeshElement; /// A triangle shape. #[derive(PartialEq, Debug, Clone, RustcEncodable, RustcDecodable)] pub struct Triangle

{ a: P, b: P, c: P } impl Triangle

{ /// Creates a triangle from three points. #[inline] pub fn new(a: P, b: P, c: P) -> Triangle

{ assert!(na::dimension::

() > 1); Triangle { a: a, b: b, c: c } } } impl

Triangle

{ /// The fist point of this triangle. #[inline] pub fn a(&self) -> &P { &self.a } /// The second point of this triangle. #[inline] pub fn b(&self) -> &P { &self.b } /// The third point of this triangle. #[inline] pub fn c(&self) -> &P { &self.c } } impl BaseMeshElement, P> for Triangle

{ #[inline] fn new_with_vertices_and_indices(vs: &[P], is: &Point3) -> Triangle

{ Triangle::new(vs[is.x], vs[is.y], vs[is.z]) } }