mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-26 09:05:52 +00:00
Simplify debug info
This is less useful than what we had before, but I'm about to make changes to the algorithm, and this is what the new algorithm will be able to support easily. We can add more useful info again, as required.
This commit is contained in:
parent
143db6e348
commit
80458e9bcd
@ -112,21 +112,13 @@ impl From<&DebugInfo> for Vertices {
|
|||||||
green
|
green
|
||||||
};
|
};
|
||||||
|
|
||||||
self_.push_line(
|
self_.push_cross(triangle_edge_check.origin.to_na(), normal, color);
|
||||||
[
|
|
||||||
triangle_edge_check.ray.origin,
|
|
||||||
triangle_edge_check.ray.origin
|
|
||||||
+ triangle_edge_check.ray.dir,
|
|
||||||
],
|
|
||||||
normal,
|
|
||||||
color,
|
|
||||||
);
|
|
||||||
|
|
||||||
for &hit in &triangle_edge_check.hits {
|
for &hit in &triangle_edge_check.hits {
|
||||||
let point = triangle_edge_check.ray.point_at(hit);
|
let line = hit.points().map(|point| point.to_na());
|
||||||
let color = [0., 0., 0., 1.];
|
let color = [0., 0., 0., 1.];
|
||||||
|
|
||||||
self_.push_cross(point, normal, color);
|
self_.push_line(line, normal, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use parry3d_f64::query::Ray;
|
use fj_math::{Point, Segment};
|
||||||
|
|
||||||
/// Debug info from the CAD kernel that can be visualized
|
/// Debug info from the CAD kernel that can be visualized
|
||||||
///
|
///
|
||||||
@ -36,18 +36,18 @@ impl DebugInfo {
|
|||||||
|
|
||||||
/// Record of a check to determine if a triangle edge is within a face
|
/// Record of a check to determine if a triangle edge is within a face
|
||||||
pub struct TriangleEdgeCheck {
|
pub struct TriangleEdgeCheck {
|
||||||
/// The ray used to perform the check
|
/// The origin of the ray used to perform the check
|
||||||
pub ray: Ray,
|
pub origin: Point<3>,
|
||||||
|
|
||||||
/// Where the ray hit any edges of the face
|
/// The points where the ray hit edges of the face
|
||||||
pub hits: Vec<f64>,
|
pub hits: Vec<Segment<3>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TriangleEdgeCheck {
|
impl TriangleEdgeCheck {
|
||||||
/// Construct a new instance
|
/// Construct a new instance
|
||||||
pub fn new(ray: Ray) -> Self {
|
pub fn new(origin: Point<3>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
ray,
|
origin,
|
||||||
hits: Vec::new(),
|
hits: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ use std::collections::BTreeSet;
|
|||||||
use fj_debug::{DebugInfo, TriangleEdgeCheck};
|
use fj_debug::{DebugInfo, TriangleEdgeCheck};
|
||||||
use fj_math::{Point, PolyChain, Scalar, Segment};
|
use fj_math::{Point, PolyChain, Scalar, Segment};
|
||||||
use parry2d_f64::query::{Ray as Ray2, RayCast as _};
|
use parry2d_f64::query::{Ray as Ray2, RayCast as _};
|
||||||
use parry3d_f64::query::Ray as Ray3;
|
|
||||||
|
|
||||||
use crate::geometry::Surface;
|
use crate::geometry::Surface;
|
||||||
|
|
||||||
@ -102,10 +101,8 @@ impl Polygon {
|
|||||||
dir: dir.to_na(),
|
dir: dir.to_na(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut check = TriangleEdgeCheck::new(Ray3 {
|
let mut check =
|
||||||
origin: self.surface.point_surface_to_model(&point).to_na(),
|
TriangleEdgeCheck::new(self.surface.point_surface_to_model(&point));
|
||||||
dir: self.surface.vector_surface_to_model(&dir).to_na(),
|
|
||||||
});
|
|
||||||
|
|
||||||
// We need to keep track of where our ray hits the edges. Otherwise, if
|
// We need to keep track of where our ray hits the edges. Otherwise, if
|
||||||
// the ray hits a vertex, we might count that hit twice, as every vertex
|
// the ray hits a vertex, we might count that hit twice, as every vertex
|
||||||
@ -130,7 +127,11 @@ impl Polygon {
|
|||||||
let t = (t * eps).round() / eps;
|
let t = (t * eps).round() / eps;
|
||||||
|
|
||||||
if hits.insert(t) {
|
if hits.insert(t) {
|
||||||
check.hits.push(t.into_f64());
|
let edge =
|
||||||
|
Segment::from_points(edge.points().map(|point| {
|
||||||
|
self.surface.point_surface_to_model(&point)
|
||||||
|
}));
|
||||||
|
check.hits.push(edge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user