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

{ a: P, b: P } impl Segment

{ /// Creates a new segment from two points. #[inline] pub fn new(a: P, b: P) -> Segment

{ assert!(na::dimension::

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

Segment

{ /// The first point of this segment. #[inline] pub fn a(&self) -> &P { &self.a } /// The second point of this segment. #[inline] pub fn b(&self) -> &P { &self.b } } impl BaseMeshElement, P> for Segment

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

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