mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-10 10:17:13 +00:00
Remove workaround
This commit is contained in:
parent
915266438f
commit
d35a25a236
@ -1,7 +1,5 @@
|
|||||||
use std::{cmp::Ordering, collections::HashSet};
|
use std::{cmp::Ordering, collections::HashSet};
|
||||||
|
|
||||||
use decorum::R64;
|
|
||||||
|
|
||||||
use crate::math::{Point, Scalar, Segment};
|
use crate::math::{Point, Scalar, Segment};
|
||||||
|
|
||||||
use super::topology::edges::{Cycle, Edge, Edges};
|
use super::topology::edges::{Cycle, Edge, Edges};
|
||||||
@ -149,20 +147,18 @@ impl Approximation {
|
|||||||
// Verify that there are no duplicate points
|
// Verify that there are no duplicate points
|
||||||
let mut points = HashSet::new();
|
let mut points = HashSet::new();
|
||||||
for &point in &self.points {
|
for &point in &self.points {
|
||||||
let point_r64 = point_to_r64(point);
|
if points.contains(&point) {
|
||||||
|
|
||||||
if points.contains(&point_r64) {
|
|
||||||
duplicate_points.push(point);
|
duplicate_points.push(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
points.insert(point_r64);
|
points.insert(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut segments = HashSet::new();
|
let mut segments = HashSet::new();
|
||||||
for &segment @ Segment { a, b } in &self.segments {
|
for &segment @ Segment { a, b } in &self.segments {
|
||||||
// Verify that there are no duplicate segments
|
// Verify that there are no duplicate segments
|
||||||
let ab = [point_to_r64(a), point_to_r64(b)];
|
let ab = [a, b];
|
||||||
let ba = [point_to_r64(b), point_to_r64(a)];
|
let ba = [b, a];
|
||||||
if segments.contains(&ab) {
|
if segments.contains(&ab) {
|
||||||
duplicate_segments.push(segment);
|
duplicate_segments.push(segment);
|
||||||
}
|
}
|
||||||
@ -213,14 +209,6 @@ pub struct ValidationError {
|
|||||||
pub segments_with_invalid_points: Vec<Segment<3>>,
|
pub segments_with_invalid_points: Vec<Segment<3>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn point_to_r64(point: Point<3>) -> [R64; 3] {
|
|
||||||
[
|
|
||||||
point.x().into_f64().into(),
|
|
||||||
point.y().into_f64().into(),
|
|
||||||
point.z().into_f64().into(),
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
Loading…
Reference in New Issue
Block a user