A block, the box from (−3, −3, −3) to (3, 3, 3), with a closed void inside it: everything a cube passes through as it turns a whole turn about its own long diagonal, wholly inside the block.
The cube is the box from (−1, −1, −1) to (1, 1, 1). It turns rigidly a whole turn about the line through (−1, −1, −1) and (1, 1, 1), its long diagonal. Cut from the block everything the cube passes through.
The cube's six edges that meet the diagonal's ends sweep two cones, and its six other edges, skew to the diagonal, sweep a hyperboloid of one sheet between them, of waist radius √2. The void touches nothing outside it: the result is the block with a sealed cavity, bounded by two shells.
expected
closed form
volume
201.4896051
6³ − 8π/√3: the cube's shadow about its diagonal is two cones and between them a hyperboloid of one sheet, radius² 2 + 2h² at h along the diagonal
area
248.2976169
6·6² + two cones 2·π√(8/3)·2 + the hyperboloid 2π∫√(2 + 6h²) dh over |h| ≤ 1/√3 = 2π√(2/3)(√2 + asinh 1)
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from occt's result, which passed.
† works around a missing feature. Pick an entry to see its solid, its measures and its code.
Drag to turn, scroll or pinch to zoom, right-drag to move. The solid as its STEP file has it, meshed in the browser by Open CASCADE (occt-import-js): each face colored by the kind of its surface, and the edges that bound each face drawn between them.
Drag to turn, scroll or pinch to zoom, right-drag to move. Black lines are where the surface turns sharply; red ones, seen through the solid, are open edges, where the mesh is not closed.
Time
49 ms; CPU time 120 ms; peak memory 14.6 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! The block (−3, −3, −3)–(3, 3, 3) with a sealed void: everything the cube (−1, −1, −1)–(1, 1, 1)//! passes through as it turns a whole turn about its own long diagonal, the line through//! (−1, −1, −1) and (1, 1, 1).usecrate::sketch::block;
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use cad_kernel::util::space::unit;
use std::f64::consts::TAU;
constSTOCK: V = [3., 3., 3.];
constCUBE: V = [1., 1., 1.];
pubfnbuild() -> Result<Brep, String> {
let stock = block([-STOCK[0], -STOCK[1], -STOCK[2]], STOCK)?;
let cube = block([-CUBE[0], -CUBE[1], -CUBE[2]], CUBE)?;
// the turn about the diagonal: a screw that does not advance, a whole turn over a roll of τlet path = Trajectory::Twist(Screw { origin: [-CUBE[0], -CUBE[1], -CUBE[2]],
axis: unit(CUBE), ratio: 1., advance: 0. });
// the kernel's closed swept solid cut from the block on one arrangement: turned whole, the// cube's sweep is its solid of revolution, the edges meeting the axis turned into cones and// the six skew to it into a hyperboloid (a cube's flat faces mesh exactly, at any bar)let size = stock.size();
cut_from(&stock, &cube, &path, [0., TAU], size, tolerance(size))
.map_err(|why| format!("the cube's sweep not built: {why:?}"))
}
Time
1.86 s; CPU time 1.86 s; peak memory 398.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
"""A void spun by a cube turned about its long diagonal inside a block. A block, the box from (−3,
−3, −3) to (3, 3, 3), with a closed void inside it: everything a cube passes through as it turns a
whole turn about its own long diagonal, wholly inside the block.
The cube is the box from (−1, −1, −1) to (1, 1, 1). It turns rigidly a whole turn about the line
through (−1, −1, −1) and (1, 1, 1), its long diagonal. Cut from the block everything the cube
passes through.
The cube's six edges that meet the diagonal's ends sweep two cones, and its six other edges, skew
to the diagonal, sweep a hyperboloid of one sheet between them, of waist radius √2. The void
touches nothing outside it: the result is the block with a sealed cavity, bounded by two shells."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBoxfromOCP.gp import gp_Ax1, gp_Dir, gp_Pnt
from sweep import cut, flat_contacts_turned, turned, united
BLOCK = ((-3, -3, -3), (3, 3, 3))
CUBE = ((-1, -1, -1), (1, 1, 1))
defbuild():
cube = BRepPrimAPI_MakeBox(gp_Pnt(*CUBE[0]), gp_Pnt(*CUBE[1])).Shape()
diagonal = gp_Ax1(gp_Pnt(*CUBE[0]), gp_Dir(1, 1, 1))
# Each face meets the turn square-on along the plane through the diagonal and its normal:# its own diagonal from the corner on the turn's axis.
swept = turned(cube, diagonal, 360, flat_contacts_turned(cube, diagonal), span=360)
# Turned a whole turn in one sweep, faces the cube's symmetry about its diagonal carries# onto one another sweep the same solid: united first, then cut out as one.returncut(BRepPrimAPI_MakeBox(gp_Pnt(*BLOCK[0]), gp_Pnt(*BLOCK[1])).Shape(), [united(swept)])
arris left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
kentron left no solid to show.
Time
218 ms; CPU time 309 ms; peak memory 29.2 MB
Notes
refused operation failed: a sweep running into itself: its pieces, as often as it winds round them, hold 33.517324856116375, not its 37.020789827747436
//! A block, the box from (−3, −3, −3) to (3, 3, 3), with a sealed void inside it: everything the//! cube from (−1, −1, −1) to (1, 1, 1) passes through as it turns a whole turn about its own long//! diagonal, cut.//!//! kentron's sweep of a solid (`sweep::solid`, one turn), which refuses it: the turn's axis runs//! through the cube, and kentron's sweep refuses a turn about an axis meeting the tool, as it//! refuses a whole turn (its ends would be one).usecrate::bench::{d, p};
use kentron::math::Axis;
use kentron::primitives::Cuboid;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::TAU;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = Cuboid::from_corners(p(-3.0, -3.0, -3.0), p(3.0, 3.0, 3.0)).build(m)?;
let cube = Cuboid::from_corners(p(-1.0, -1.0, -1.0), p(1.0, 1.0, 1.0)).build(m)?;
let diagonal = Axis::new(p(0.0, 0.0, 0.0), d(1.0, 1.0, 1.0));
let void = sweep::solid(m, cube, &RigidMotion::Turn { axis: diagonal, from: 0.0, to: TAU })?;
kentron::boolean::difference(m, block, void)
}
vcad left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
156 ms; CPU time 156 ms; peak memory 48.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! A block, the box from (−3, −3, −3) to (3, 3, 3), less everything the cube from (−1, −1, −1) to//! (1, 1, 1) passes through as it turns a whole turn about its long diagonal, the line through//! (−1, −1, −1) and (1, 1, 1): a sealed void.//!//! solidcraft-kernel has no sweep of a solid, so the turn is built by elementary geometry: turned//! a whole turn about an axis, a solid sweeps its shadow, the circles about the axis it meets,//! revolved. The cube holds the diagonal, so the shadow at h along it (from the centre) reaches//! out from the axis to the cube's farthest point in the plane square to it there, a corner of//! the section on one of the cube's edges. Within 1/√3 of the ends (|h| ≥ 1/√3) those are the//! three edges through the end, whose points are √2 (√3 − |h|) from the axis: two cones. Between,//! they are the six edges skew to the diagonal, such as (−1, t, 1), at distance √(2 + 2h²): a//! hyperbola, r² − 2h² = 2, which meets the cones' lines at r = √(8/3). The hyperbola's arc is//! the conic through those two points with its vertex at (√2, 0): its tangents there meet at//! (2/√(8/3), 0), and the conic's middle weight puts its midpoint at the vertex.usecrate::solids::*;
use solidcore_record::Seg2;
pubfnbuild() -> R<Body> {
let block = block((-3.0, -3.0, -3.0), (3.0, 3.0, 3.0))?;
let s3 = 3f64.sqrt();
let (r0, h0) = ((8.0f64 / 3.0).sqrt(), 1.0 / s3); // where the cones meet the hyperbolalet apex = 2.0 / r0; // where the hyperbola's tangents at (r0, ±h0) cross h = 0let vertex = 2f64.sqrt();
let w = (r0 - vertex) / (vertex - apex);
// the shadow in (r, h): out from the axis, along it from h = −√3 to √3let line = |a: (f64, f64), b: (f64, f64)| Seg2::Line { a: v2(a.0, a.1), b: v2(b.0, b.1) };
let shadow = vec![
line((0.0, -s3), (r0, -h0)),
Seg2::Conic { a: v2(r0, -h0), apex: v2(apex, 0.0), b: v2(r0, h0), w },
line((r0, h0), (0.0, s3)),
line((0.0, s3), (0.0, -s3)),
];
// a plane through the diagonal: its sketch y along the diagonal, its sketch x square to itlet diagonal = v3(1.0, 1.0, 1.0) * (1.0 / s3);
let across = v3(1.0, -1.0, 0.0) * (1.0 / 2f64.sqrt());
let plane = Plane { origin: Vec3::ZERO, x: across, y: diagonal };
let shadow = Region2 { outer: Loop2 { segs: shadow }, holes: vec![] };
let void = one(solidcraft_kernel::revolve(&plane, &[shadow], Vec2::ZERO, Vec2::Y, std::f64::consts::TAU)?)?;
cut(&block, &void)
}
brepkit left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
14 ms; CPU time 14 ms; peak memory 23.3 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
// A block from (-3, -3, -3) to (3, 3, 3) less everything the cube from (-1, -1, -1) to (1, 1, 1)// passes through as it turns a whole turn about its long diagonal.//// A whole turn sweeps the cube's shadow on a half-plane through the diagonal revolved. Along the// diagonal (t from -√3 to √3) the cube reaches √2 |t ± √3| from it, the cones its six edges at the// diagonal's ends sweep, out to t = ∓1/√3; between, its six skew edges reach √(2 + 2t²), a// hyperbola: one exact conic, its end tangents meeting at (0, √(3/2)). The shadow is drawn about// the z axis and the void turned onto the diagonal.let m = model();
let r3 = sqrt(3.0);
let edge = sqrt(8.0 / 3.0);
let shoulder = sqrt(1.5);
// the conic's weight puts its middle on the waist, (0, √2)let w = (sqrt(2.0) - edge) / (shoulder - sqrt(2.0));
let cavity = m.tool(|m| m.profile(xz()).path(0.0, -r3).line_to(edge, -1.0 / r3)
.conic_to([shoulder, 0.0], [edge, 1.0 / r3], w).line_to(0.0, r3).close().sketch("shadow")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), full_circle())
.rotate(axis_at([0.0, 0.0, 0.0], [-1.0, 1.0, 0.0]), acos(1.0 / r3) * 180.0 / 3.141592653589793));
let b = m.box(6.0, 6.0, 6.0, #{ at: [-3.0, -3.0, -3.0] });
b = b.subtract(cavity);
m
aetheris left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
12 ms; CPU time 12 ms; peak memory 16.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! The block from (−3, −3, −3) to (3, 3, 3), less everything the cube from (−1, −1, −1) to//! (1, 1, 1) passes through as it turns a whole turn about its long diagonal.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the cube as a convex polyhedron,//! its eight corners and six faces, turned a whole turn about the line through the origin along (1,//! 1, 1), and cut from the block.usecrate::solids::p;
usecrate::solids::swept::{box_tool, less_all};
usecrate::Refusal;
use brep_kernel::{make_box_brep, sweep_solid, BrepSolid, ScrewStep, SolidMotion};
use std::f64::consts::{TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let block = make_box_brep(p(-3.0, -3.0, -3.0), 6.0, 6.0, 6.0)?;
let cube = box_tool(p(-1.0, -1.0, -1.0), p(2.0, 0.0, 0.0), p(0.0, 2.0, 0.0), p(0.0, 0.0, 2.0));
let turn = SolidMotion {
steps: vec![ScrewStep {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: p(1.0, 1.0, 1.0).scale(1.0 / 3f64.sqrt()),
turn: 1.0,
advance: 0.0,
}],
from: 0.0,
to: TAU,
};
less_all(block, vec![sweep_solid(&cube, &turn)?])
}
geop left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
3.8 ms; CPU time 3.6 ms; peak memory 9.2 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! A block (the box from (−3, −3, −3) to (3, 3, 3)) with a sealed void: everything the cube from//! (−1, −1, −1) to (1, 1, 1) passes through as it turns a whole turn about its long diagonal.//!//! What the cube passes through is cadrs's sweep of a solid (one whole turn about the line through//! (−1, −1, −1) and (1, 1, 1)), cut from the block.usecrate::bench::{block, cut, p3, v3};
usecrate::shared::swept::swung;
usecrate::Refusal;
use cadrs_kernel::{Axis, BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = block(k, p3(-3.0, -3.0, -3.0), p3(3.0, 3.0, 3.0))?;
let cube = block(k, p3(-1.0, -1.0, -1.0), p3(1.0, 1.0, 1.0))?;
let swept = swung(k, cube, Axis::new(p3(-1.0, -1.0, -1.0), v3(1.0, 1.0, 1.0)), 0.0, 360.0)?;
cut(k, b, swept)
}
smlib left no solid to show.
Time
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
Time
8.3 ms; CPU time 8 ms; peak memory 8.8 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † its sweep of a solid declines it
Its volume and area are its STEP file's, as the harness measures them from the file's exact geometry (harness/mass/); its triangles are Open CASCADE's mesh of the file, for the pictures.
//! The box (−3, −3, −3)–(3, 3, 3) less everything the cube (−1, −1, −1)–(1, 1, 1) passes through//! as it turns a whole turn about its long diagonal: a sealed cavity.//!//! springrep's sweep of a solid declines this one (faces round an edge do not pair off). A whole//! turn sweeps everything whose circle about the diagonal meets the cube: its shadow on a//! half-plane through the diagonal, turned. Measured along the diagonal by h from the center, every//! section of the cube square to it holds the axis, so the shadow reaches from the axis out to the//! section's farthest corner. Those corners lie on the three edges from each end of the diagonal,//! which pass through the axis and sweep cones (ρ rising linearly to √(8/3) at |h| = 1/√3), and//! between them on the six skew edges, each at distance √2 from the axis, which sweep the//! hyperboloid ρ² = 2 + 2h²: a hyperbola's arc, exactly a rational quadratic Bézier. That meridian,//! turned whole, is the cavity.use std::f64::consts::TAU;
use springrep::boolean::difference;
use springrep::math::{Frame, Vec3};
use springrep::profile::{NamedSegment, Segment};
use springrep::sweep::revolve;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, line, outline, v2, v3};
pubfnbuild() -> Result<Brep, String> {
let block = boxed([-3.0, -3.0, -3.0], [3.0, 3.0, 3.0], "block")?;
let (end, k) = (3f64.sqrt(), 1.0 / 3f64.sqrt());
let r = (8.0f64 / 3.0).sqrt();
// the hyperbola ρ² = 2 + 2h² from h = −k to k: its tangents there meet at (2/r, 0), and its// vertex (√2, 0) is the arc's middle, which sets the apex's weightlet w = (r - 2f64.sqrt()) / (2f64.sqrt() - 2.0 / r);
let skew = NamedSegment::new(
Segment::Bezier {
ctrl: vec![v2(r, -k), v2(2.0 / r, 0.0), v2(r, k)],
weights: vec![1.0, w, 1.0],
},
"hyperboloid",
);
// sketch x out from the diagonal, y along itlet meridian = outline(vec![
line((0.0, -end), (r, -k), "cone"),
skew,
line((r, k), (0.0, end), "cone"),
line((0.0, end), (0.0, -end), "axis"),
]);
let along = v3(1.0, 1.0, 1.0) * (1.0 / end);
let out = v3(1.0, -1.0, 0.0) * (1.0 / 2f64.sqrt());
let sketch = Frame::new(Vec3::ZERO, out.cross(along), out).map_err(e)?;
let cavity = revolve(&meridian, &sketch, Vec3::ZERO, along, TAU, "cavity").map_err(e)?;
difference(&block, &cavity).map_err(e)
}
geomsolver left no solid to show.
Time
155 ms; CPU time 300 ms; peak memory 31 MB
Notes
refused solventc: `void` is in the closed class (a turn), its tool's 6 faces and 12 edges read as planes and lines, to be cut from the blank on one arrangement
solventc: [ 0.0 s] `part`: the static blank by this kernel: 216.000000 mm³, 6 faces (323.189µs)
solventc: [ 0.0 s] `void` (a turn) cut from the blank on one arrangement: 9 faces (47.081841ms)
solventc: [ 0.0 s] the solid by the Rust kernel: 9 faces, 19 edges
solventc: the mesh has 1 triangles facing against their surfaces
solventc: `part` is read by its material field, and `--stl-backend mesh` writes that reading instead: drawn from the field, not built, and not held to the export's tolerance
// A block, the box from (-3, -3, -3) to (3, 3, 3); a cube, the box from (-1, -1, -1) to (1, 1, 1),// turned rigidly a whole turn about its long diagonal, the line through (-1, -1, -1) and (1, 1, 1),// and everything it passes through cut from the block: a sealed void. Each box is its square// footprint in the top plane, about the origin, carried along z.unit mm
use std
use std.solids
use std.solids (cut)
use std.motion (turns)
use std.shapes
in std.top {
o := point
fix((0, 0)) o
outer := std.shapes.CenteredRectangle(o, w: 6mm, h: 6mm)
inner := std.shapes.CenteredRectangle(o, w: 2mm, h: 2mm)
}
part := solid(std.solids.Prism(outer.loop, from: -3mm, to: 3mm))
cube := solid(std.solids.Prism(inner.loop, from: -1mm, to: 1mm))
low := point
fix((-1, -1, -1)) low
high := point
fix((1, 1, 1)) high
diagonal := line(low, high)
spin := frame
spin turns(1) diagonal
void := solid({ p | some t in (0deg, 360deg): p in cube at(under: spin) t })
void cut part
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 3.4 MB
Notes
refused anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself
//! A void spun by a cube turned about its long diagonal inside a block.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself".into())
}