mirror of
https://github.com/hannobraun/Fornjot
synced 2025-07-21 09:26:10 +00:00
Fix assumption that is no longer valid
This commit is contained in:
parent
e74020f960
commit
769cad1e3e
@ -61,7 +61,12 @@ pub fn triangulate(
|
||||
Handedness::LeftHanded => Winding::Cw,
|
||||
Handedness::RightHanded => Winding::Ccw,
|
||||
};
|
||||
let actual_winding = triangle.winding();
|
||||
let Some(actual_winding) = triangle.winding() else {
|
||||
unreachable!(
|
||||
"Just asserted that the triangle is valid. Therefore it must \
|
||||
have a winding."
|
||||
);
|
||||
};
|
||||
|
||||
let triangle = if actual_winding == required_winding {
|
||||
[v0, v1, v2]
|
||||
|
@ -69,7 +69,7 @@ impl<const D: usize> Triangle<D> {
|
||||
|
||||
impl Triangle<2> {
|
||||
/// # Compute the winding of the triangle
|
||||
pub fn winding(&self) -> Winding {
|
||||
pub fn winding(&self) -> Option<Winding> {
|
||||
let [pa, pb, pc] = self.points.map(|point| robust::Coord {
|
||||
x: point.u,
|
||||
y: point.v,
|
||||
@ -77,16 +77,13 @@ impl Triangle<2> {
|
||||
let orient2d = robust::orient2d(pa, pb, pc);
|
||||
|
||||
if orient2d < 0. {
|
||||
return Winding::Cw;
|
||||
return Some(Winding::Cw);
|
||||
}
|
||||
if orient2d > 0. {
|
||||
return Winding::Ccw;
|
||||
return Some(Winding::Ccw);
|
||||
}
|
||||
|
||||
unreachable!(
|
||||
"Points don't form a triangle, but this was verified in the \
|
||||
constructor."
|
||||
)
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user