Bare beginnings of adding bilinear patches.
Mainly as a simple test-case for split-and-dice.
This commit is contained in:
parent
f021def789
commit
4999b31bf5
39
src/surface/bilinear_patch.rs
Normal file
39
src/surface/bilinear_patch.rs
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
use super::Splitable;
|
||||||
|
use crate::math::Point;
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub struct BilinearPatch<'a> {
|
||||||
|
time_sample_count: usize,
|
||||||
|
|
||||||
|
// The control points are stored in clockwise order, like this:
|
||||||
|
// u ----->
|
||||||
|
// v 0 1
|
||||||
|
// | 3 2
|
||||||
|
// \/
|
||||||
|
control_points: &'a [[Point; 4]],
|
||||||
|
|
||||||
|
// Indicates if any of the edges *must* be split, for example if there
|
||||||
|
// are adjacent patches that were split for non-dicing reasons.
|
||||||
|
//
|
||||||
|
// Matching the ascii graph above, the edges are:
|
||||||
|
//
|
||||||
|
// 0
|
||||||
|
// -------
|
||||||
|
// 3 | | 1
|
||||||
|
// -------
|
||||||
|
// 2
|
||||||
|
must_split: [bool; 4],
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub struct BilinearSubPatch<'a> {
|
||||||
|
original: &'a BilinearPatch<'a>,
|
||||||
|
clip: [(f32, f32); 4],
|
||||||
|
must_split: [bool; 4],
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Splitable for BilinearSubPatch<'a> {
|
||||||
|
fn split(&self /* TODO: splitting criteria. */) -> Option<(Self, Self)> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
// pub mod micropoly_batch;
|
// pub mod micropoly_batch;
|
||||||
|
pub mod bilinear_patch;
|
||||||
pub mod micropoly_batch;
|
pub mod micropoly_batch;
|
||||||
pub mod triangle;
|
pub mod triangle;
|
||||||
pub mod triangle_mesh;
|
pub mod triangle_mesh;
|
||||||
|
@ -26,6 +27,11 @@ pub trait Surface: Boundable + Debug + Sync {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait Splitable: Copy {
|
||||||
|
/// Splits the surface into two pieces if necessary.
|
||||||
|
fn split(&self /* TODO: splitting criteria. */) -> Option<(Self, Self)>;
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum SurfaceIntersection {
|
pub enum SurfaceIntersection {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user