forked from 1b-agent/opencadstudio-upstream
Complete exact INTERSECT behavior
This commit is contained in:
1 parent
143703d809
commit
1e118b2e90
8 files changed
+497
-26
No files matched your search
@@ -159,6 +159,10 @@ pub fn kernel_body(solid: &Solid3D) -> Option<KernelBody> {
|
||||
kernel_acis_body(&solid.acis_data)
|
||||
}
|
||||
|
||||
pub fn kernel_region_body(region: &Region) -> Option<KernelBody> {
|
||||
kernel_acis_body(®ion.acis_data)
|
||||
}
|
||||
|
||||
pub fn kernel_surface_body(surface: &Surface) -> Option<KernelBody> {
|
||||
kernel_acis_body(&surface.acis_data)
|
||||
}
|
||||
|
||||
@@ -602,6 +602,9 @@ impl Scene {
|
||||
Some(EntityType::Solid3D(solid)) => {
|
||||
crate::scene::convert::solid3d_tess::kernel_body(solid)
|
||||
}
|
||||
Some(EntityType::Region(region)) => {
|
||||
crate::scene::convert::solid3d_tess::kernel_region_body(region)
|
||||
}
|
||||
Some(EntityType::Surface(surface)) => {
|
||||
crate::scene::convert::solid3d_tess::kernel_surface_body(surface)
|
||||
}
|
||||
|
||||
@@ -365,13 +365,18 @@ pub enum Bool {
|
||||
/// missing, and passing that on unchanged is the point: a half-done boolean
|
||||
/// looks finished.
|
||||
pub fn boolean(op: Bool, a: &Body, b: &Body) -> Option<Body> {
|
||||
boolean_result(op, a, b).ok()
|
||||
}
|
||||
|
||||
/// Combine two solids while retaining the kernel's exact refusal reason.
|
||||
pub fn boolean_result(op: Bool, a: &Body, b: &Body) -> Result<Body, brep::Snag> {
|
||||
let how = match op {
|
||||
Bool::Union => brep::Operation::Union,
|
||||
Bool::Subtract => brep::Operation::Difference,
|
||||
Bool::Intersect => brep::Operation::Intersection,
|
||||
};
|
||||
let tolerance = brep::operation_tolerance(&[a, b]);
|
||||
brep::combine(a.clone(), b.clone(), how, tolerance).ok()
|
||||
brep::combine(a.clone(), b.clone(), how, tolerance)
|
||||
}
|
||||
|
||||
// ── Tessellation ────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user