library: document shape module
This commit is contained in:
parent
ce1b8eeaaa
commit
a9fd726a0d
|
@ -1,3 +1,5 @@
|
|||
//! Various shape implementations
|
||||
|
||||
use super::{Point, Point2D, Vector};
|
||||
use bvh::{
|
||||
aabb::{Bounded, AABB},
|
||||
|
@ -8,6 +10,7 @@ use serde::Deserialize;
|
|||
/// All the existing `Shape` implementation.
|
||||
#[serde(tag = "type")]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[allow(missing_docs)]
|
||||
#[enum_dispatch::enum_dispatch]
|
||||
#[derive(Debug, PartialEq, Deserialize)]
|
||||
pub enum ShapeEnum {
|
||||
|
|
|
@ -13,6 +13,22 @@ pub struct Triangle {
|
|||
}
|
||||
|
||||
impl Triangle {
|
||||
/// Creates a new `Triangle` from 3 [`Point`]s.
|
||||
///
|
||||
/// [`Point`]: ../../type.Point.html
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use pathtracer::shape::Triangle;
|
||||
/// # use pathtracer::Point;
|
||||
/// #
|
||||
/// let t = Triangle::new(
|
||||
/// Point::new(1.0, 0.0, 0.0),
|
||||
/// Point::new(0.0, 1.0, 0.0),
|
||||
/// Point::new(0.0, 0.0, 1.0),
|
||||
/// );
|
||||
/// ```
|
||||
pub fn new(c0: Point, c1: Point, c2: Point) -> Self {
|
||||
Triangle {
|
||||
c0,
|
||||
|
|
Loading…
Reference in a new issue