refactor(cad): use direct stack dependencies
This commit is contained in:
parent
3b4fbabdba
commit
ac8183ec91
36 changed files with 87 additions and 101 deletions
|
|
@ -587,7 +587,7 @@ pub fn parse_angle_deg(value: &str) -> Option<f64> {
|
|||
/// Re-exported rather than imported at each call site so the twelve modules
|
||||
/// that already reach for `entities::common::BulgeArc` keep working, and so
|
||||
/// there is one obvious place to see that the maths moved out.
|
||||
pub use acadrust::kernel::geom2d::BulgeArc;
|
||||
pub use cadkernel::geom2d::BulgeArc;
|
||||
|
||||
/// Triangulate the solid bands a `wide_fills` returns into the flat WCS f64
|
||||
/// triangle list `RenderEntity::pick_tris` carries, so a wide polyline is
|
||||
|
|
@ -694,7 +694,7 @@ pub(crate) fn tapered_band_points(
|
|||
if bulge.abs() < 1e-9 {
|
||||
push(p1[0], p1[1], ew0 as f32);
|
||||
} else if let Some(arc) = BulgeArc::from_bulge(p0, p1, bulge) {
|
||||
let samples = arc.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE);
|
||||
let samples = arc.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE);
|
||||
let segments = samples.len().saturating_sub(1).max(1);
|
||||
for (index, s) in samples.into_iter().enumerate().skip(1) {
|
||||
let t = index as f64 / segments as f64;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ use acadrust::entities::{
|
|||
Arc as ArcEnt, Circle as CircleEnt, Ellipse as EllipseEnt, LwPolyline as LwPolylineEnt,
|
||||
Polyline2D, Spline as SplineEnt,
|
||||
};
|
||||
use acadrust::kernel::geom2d::{
|
||||
use cadkernel::geom2d::{
|
||||
characteristic_points, Arc, Circle, Curve, Ellipse, EllipseArc, Line, Polyline, PolylineVertex,
|
||||
Ray, SnapKind, Transform, XLine,
|
||||
};
|
||||
use acadrust::kernel::space::{PlanarCurve, Plane, Vec3};
|
||||
use cadkernel::space::{PlanarCurve, Plane, Vec3};
|
||||
use acadrust::types::Vector3;
|
||||
use acadrust::EntityType;
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ pub fn entity_curve_xy(entity: &EntityType) -> Option<Curve> {
|
|||
|
||||
/// World-space wire points sampled by the kernel's angular policy.
|
||||
pub fn curve_points(curve: &PlanarCurve) -> Vec<[f64; 3]> {
|
||||
curve.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE)
|
||||
curve.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
}
|
||||
|
||||
/// The snap candidates an entity's curve offers, in the two channels the
|
||||
|
|
@ -705,12 +705,12 @@ mod tests {
|
|||
/// where it happens rather than the next time somebody reaches for it.
|
||||
#[test]
|
||||
fn the_solid_layer_and_the_acis_bridge_are_reachable() {
|
||||
let solid = acadrust::kernel::brep::make::cuboid([0.0; 3], [1.0; 3])
|
||||
let solid = cadkernel::brep::make::cuboid([0.0; 3], [1.0; 3])
|
||||
.expect("the kernel builds its own primitives");
|
||||
assert!(solid.validate().is_empty());
|
||||
assert_eq!(solid.euler_characteristic(), 2);
|
||||
let document = acadrust::entities::acis::types::SatDocument::new();
|
||||
let (bodies, loss) = acadrust::acis::lift(&document);
|
||||
let (bodies, loss) = cadkernel::acis::lift(&document);
|
||||
assert!(bodies.is_empty() && loss.is_empty(), "an empty document lifts to nothing");
|
||||
}
|
||||
|
||||
|
|
@ -742,14 +742,14 @@ mod tests {
|
|||
ray.base_point = v3(1.0, 1.0, 0.0);
|
||||
ray.direction = v3(2.0, 0.0, 0.0);
|
||||
let curve = entity_curve(&EntityType::Ray(ray)).unwrap();
|
||||
assert_eq!(curve.extent(), acadrust::kernel::geom2d::Extent::Forward);
|
||||
assert_eq!(curve.extent(), cadkernel::geom2d::Extent::Forward);
|
||||
assert_eq!(curve.point_at(1.0), [3.0, 1.0, 0.0]);
|
||||
|
||||
let mut line = XLineEnt::default();
|
||||
line.base_point = v3(0.0, 0.0, 0.0);
|
||||
line.direction = v3(0.0, 3.0, 0.0);
|
||||
let curve = entity_curve(&EntityType::XLine(line)).unwrap();
|
||||
assert_eq!(curve.extent(), acadrust::kernel::geom2d::Extent::Infinite);
|
||||
assert_eq!(curve.extent(), cadkernel::geom2d::Extent::Infinite);
|
||||
assert_eq!(curve.point_at(-1.0), [0.0, -3.0, 0.0]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use acadrust::entities::{BoundaryEdge, Hatch};
|
||||
use acadrust::kernel::geom2d::{
|
||||
use cadkernel::geom2d::{
|
||||
Arc as KernelArc, Curve as KernelCurve, Ellipse as KernelEllipse,
|
||||
EllipseArc as KernelEllipseArc, Line as KernelLine, NurbsCurve as KernelNurbs,
|
||||
Parameterization, Polyline as KernelPolyline, PolylineVertex as KernelVertex,
|
||||
|
|
@ -999,7 +999,7 @@ impl FallbackTess for Hatch {
|
|||
continue;
|
||||
};
|
||||
let local = curve
|
||||
.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE);
|
||||
.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE);
|
||||
if local.len() < 2 {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ fn to_render(pline: &LwPolyline) -> RenderEntity {
|
|||
radius: arc.radius as f32,
|
||||
});
|
||||
for s in arc
|
||||
.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE)
|
||||
.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
.into_iter()
|
||||
.skip(1)
|
||||
{
|
||||
|
|
@ -410,7 +410,7 @@ fn to_render(pline: &LwPolyline) -> RenderEntity {
|
|||
crate::entities::common::BulgeArc::from_bulge([ox0, oy0], [ox1, oy1], bulge)
|
||||
{
|
||||
for s in arc
|
||||
.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE)
|
||||
.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
.into_iter()
|
||||
.skip(1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ fn tessellate_polyline2d(pl: &Polyline2D) -> RenderEntity {
|
|||
radius: arc.radius as f32,
|
||||
});
|
||||
for s in arc
|
||||
.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE)
|
||||
.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
.into_iter()
|
||||
.skip(1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
// caller translates the mesh vertices to match.
|
||||
|
||||
use acadrust::entities::{Body, Region, Solid3D, Surface};
|
||||
use acadrust::kernel::space::polygon;
|
||||
use cadkernel::space::polygon;
|
||||
use crate::t;
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use acadrust::entities::Spline;
|
||||
use crate::t;
|
||||
use acadrust::kernel::space::NurbsCurve3;
|
||||
use cadkernel::space::NurbsCurve3;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{edit_prop as edit, parse_f64, ro_prop as ro, square_grip};
|
||||
|
|
@ -171,7 +171,7 @@ pub(crate) fn measurement_polyline(spl: &Spline) -> Vec<[f64; 3]> {
|
|||
});
|
||||
match NurbsCurve3::new(degree, controls, spl.knots.clone(), weights) {
|
||||
Some(curve) => {
|
||||
curve.tessellate_angle(acadrust::kernel::tessellation::DEFAULT_ANGLE)
|
||||
curve.tessellate_angle(cadkernel::tessellation::DEFAULT_ANGLE)
|
||||
}
|
||||
None => spl.control_points.iter().map(|p| [p.x, p.y, p.z]).collect(),
|
||||
}
|
||||
|
|
@ -240,10 +240,10 @@ fn catmull_rom_polyline(pts: &[acadrust::types::Vector3], closed: bool) -> Vec<[
|
|||
}
|
||||
q
|
||||
};
|
||||
let sampled = acadrust::kernel::tessellation::sample_curve3_angle(
|
||||
let sampled = cadkernel::tessellation::sample_curve3_angle(
|
||||
point_at,
|
||||
tangent_at,
|
||||
acadrust::kernel::tessellation::DEFAULT_ANGLE,
|
||||
cadkernel::tessellation::DEFAULT_ANGLE,
|
||||
);
|
||||
out.extend(sampled.into_iter().skip(usize::from(seg > 0)));
|
||||
}
|
||||
|
|
@ -363,10 +363,10 @@ fn fit_spline_polyline(spl: &Spline) -> Vec<[f64; 3]> {
|
|||
}
|
||||
q
|
||||
};
|
||||
let sampled = acadrust::kernel::tessellation::sample_curve3_angle(
|
||||
let sampled = cadkernel::tessellation::sample_curve3_angle(
|
||||
point_at,
|
||||
tangent_at,
|
||||
acadrust::kernel::tessellation::DEFAULT_ANGLE,
|
||||
cadkernel::tessellation::DEFAULT_ANGLE,
|
||||
);
|
||||
out.extend(sampled.into_iter().skip(usize::from(i > 0)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue