mirror of
https://github.com/hannobraun/Fornjot
synced 2025-10-09 17:38:22 +00:00
Move debug info to sub-module within fj-interop
This commit is contained in:
parent
e6fe96742f
commit
6957978221
@ -1,5 +1,5 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_math::Triangle;
|
||||
use nalgebra::{vector, Point};
|
||||
|
||||
|
@ -10,7 +10,7 @@ use std::path::PathBuf;
|
||||
use std::{collections::HashMap, time::Instant};
|
||||
|
||||
use fj_host::Model;
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::algorithms::triangulate;
|
||||
use fj_math::{Aabb, Scalar, Triangle};
|
||||
use fj_operations::ToShape as _;
|
||||
|
49
fj-interop/src/debug.rs
Normal file
49
fj-interop/src/debug.rs
Normal file
@ -0,0 +1,49 @@
|
||||
//! Debug information definitions for the Fornjot ecosystem
|
||||
//!
|
||||
//! Defines debug information that is used by other crates within the Fornjot
|
||||
//! ecosystem. The types in here aren't very useful in themselves, but they
|
||||
//! define an interface that other crates use to communicate between each other.
|
||||
|
||||
use fj_math::{Point, Segment};
|
||||
|
||||
/// Debug info from the CAD kernel that can be visualized
|
||||
#[derive(Default)]
|
||||
pub struct DebugInfo {
|
||||
/// Rays being used during face triangulation
|
||||
pub triangle_edge_checks: Vec<TriangleEdgeCheck>,
|
||||
}
|
||||
|
||||
impl DebugInfo {
|
||||
/// Construct an empty instance of `DebugInfo`
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Clear all information within this instance
|
||||
///
|
||||
/// The resulting instance is the same, as if created by [`DebugInfo::new`],
|
||||
/// but calling `clear` might be more efficient in regard to heap
|
||||
/// allocations.
|
||||
pub fn clear(&mut self) {
|
||||
self.triangle_edge_checks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// Record of a check to determine if a triangle edge is within a face
|
||||
pub struct TriangleEdgeCheck {
|
||||
/// The origin of the ray used to perform the check
|
||||
pub origin: Point<3>,
|
||||
|
||||
/// The points where the ray hit edges of the face
|
||||
pub hits: Vec<Segment<3>>,
|
||||
}
|
||||
|
||||
impl TriangleEdgeCheck {
|
||||
/// Construct a new instance
|
||||
pub fn new(origin: Point<3>) -> Self {
|
||||
Self {
|
||||
origin,
|
||||
hits: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
@ -1,52 +1,5 @@
|
||||
//! Debug information definitions for the Fornjot ecosystem
|
||||
//!
|
||||
//! This crate contains debug information that is used by other crates within
|
||||
//! the Fornjot ecosystem. The types in here aren't very useful in themselves,
|
||||
//! but they define an interface that other crates use to communicate between
|
||||
//! each other.
|
||||
//! Data types for interoperation within the Fornjot ecosystem
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use fj_math::{Point, Segment};
|
||||
|
||||
/// Debug info from the CAD kernel that can be visualized
|
||||
#[derive(Default)]
|
||||
pub struct DebugInfo {
|
||||
/// Rays being used during face triangulation
|
||||
pub triangle_edge_checks: Vec<TriangleEdgeCheck>,
|
||||
}
|
||||
|
||||
impl DebugInfo {
|
||||
/// Construct an empty instance of `DebugInfo`
|
||||
pub fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
/// Clear all information within this instance
|
||||
///
|
||||
/// The resulting instance is the same, as if created by [`DebugInfo::new`],
|
||||
/// but calling `clear` might be more efficient in regard to heap
|
||||
/// allocations.
|
||||
pub fn clear(&mut self) {
|
||||
self.triangle_edge_checks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// Record of a check to determine if a triangle edge is within a face
|
||||
pub struct TriangleEdgeCheck {
|
||||
/// The origin of the ray used to perform the check
|
||||
pub origin: Point<3>,
|
||||
|
||||
/// The points where the ray hit edges of the face
|
||||
pub hits: Vec<Segment<3>>,
|
||||
}
|
||||
|
||||
impl TriangleEdgeCheck {
|
||||
/// Construct a new instance
|
||||
pub fn new(origin: Point<3>) -> Self {
|
||||
Self {
|
||||
origin,
|
||||
hits: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
pub mod debug;
|
||||
|
@ -1,7 +1,7 @@
|
||||
mod polygon;
|
||||
mod ray;
|
||||
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_math::{Scalar, Triangle};
|
||||
use parry2d_f64::utils::point_in_triangle::{corner_direction, Orientation};
|
||||
use spade::HasPosition;
|
||||
@ -121,7 +121,7 @@ impl HasPosition for geometry::Point<2> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_math::{Scalar, Triangle};
|
||||
|
||||
use crate::{geometry::Surface, shape::Shape, topology::Face};
|
||||
|
@ -1,4 +1,4 @@
|
||||
use fj_interop::{DebugInfo, TriangleEdgeCheck};
|
||||
use fj_interop::debug::{DebugInfo, TriangleEdgeCheck};
|
||||
use fj_math::{Point, PolyChain, Segment};
|
||||
|
||||
use crate::geometry::Surface;
|
||||
@ -218,7 +218,7 @@ impl Polygon {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_math::{Point, PolyChain};
|
||||
|
||||
use crate::geometry::Surface;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::{
|
||||
geometry::Surface,
|
||||
shape::Shape,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::{
|
||||
shape::{Handle, Shape},
|
||||
topology::{Cycle, Edge, Face, Vertex},
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::{
|
||||
shape::Shape,
|
||||
topology::{Cycle, Edge, Face, Vertex},
|
||||
|
@ -13,7 +13,7 @@ mod sketch;
|
||||
mod sweep;
|
||||
mod transform;
|
||||
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::shape::Shape;
|
||||
use fj_math::{Aabb, Scalar};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::{
|
||||
geometry::Surface,
|
||||
shape::Shape,
|
||||
|
@ -1,4 +1,4 @@
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::{algorithms::sweep_shape, shape::Shape};
|
||||
use fj_math::{Aabb, Scalar, Vector};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use fj_interop::DebugInfo;
|
||||
use fj_interop::debug::DebugInfo;
|
||||
use fj_kernel::shape::Shape;
|
||||
use fj_math::{Aabb, Scalar, Transform};
|
||||
use parry3d_f64::math::Isometry;
|
||||
|
Loading…
x
Reference in New Issue
Block a user