use super::Point3;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Triangle3 {
a: Point3,
b: Point3,
c: Point3,
}
impl Triangle3 {
pub fn new(a: Point3, b: Point3, c: Point3) -> Self {
Triangle3 { a, b, c }
}
#[inline]
pub fn a(&self) -> Point3 {
self.a
}
#[inline]
pub fn b(&self) -> Point3 {
self.b
}
#[inline]
pub fn c(&self) -> Point3 {
self.c
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn accessors() {
let a = Point3::new(0.0, 0.0, 0.0).unwrap();
let b = Point3::new(1.0, 0.0, 0.0).unwrap();
let c = Point3::new(0.0, 1.0, 0.0).unwrap();
let t = Triangle3::new(a, b, c);
assert_eq!(t.a(), a);
assert_eq!(t.b(), b);
assert_eq!(t.c(), c);
}
}