The solid a rounded block fills as it slides along a straight line without turning.
The block is the box from (0, 0, 0) to (10, 6, 4) with every edge rounded to radius 1 and every corner to a ball of radius 1: everything within 1 of the box from (1, 1, 1) to (9, 5, 3). Its faces are six flat rectangles, twelve quarter cylinders and eight eighths of a ball.
It slides along the vector (8, 5, 3), ending as the same rounded block moved by (8, 5, 3). Make the solid of everything the block passes through.
The rounded faces touch along their lines and arcs where their normals are square to the slide, and those paths are what the flat sides of a box slid aslant would sweep, rounded: the result is everything within 1 of the box from (1, 1, 1) to (9, 5, 3) slid along (8, 5, 3).
† 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
459 ms; CPU time 1.03 s; peak memory 44.7 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a rounded block (the box's sweep, grown)
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.
Data
its STEP's
expected
rel. error
volume
694.6544527
694.6544527
3.3e-16
area
474.1145109
474.1145109
6.0e-16
agrees with
kentron, popkern, next.BREP, cadrs, springrep
mesh
19652 triangles, closed, 14 degenerate
centre of gravity
(9, 5.5, 3.5) its STEP's solid
inertia
about it, of unit density: Ixx 7213.32; Iyy 15976.4; Izz 19089.4; Ixy -4108.89; Iyz -1596.89; Izx -2485.1
//! The solid a rounded block fills as it slides without turning along (8, 5, 3): the box//! (0, 0, 0)–(10, 6, 4) with every edge rounded to radius 1 and every corner to a ball of radius 1,//! everything within 1 of the box (1, 1, 1)–(9, 5, 3).//!//! cad-kernel's sweep of a solid (`swept::closed::closed`) takes the rounded block under the slide//! (planes, cylinders and balls) but fails building it (`Unbuilt::Failed`, "a sphere has a hole in//! no piece"). So the sweep is built in the other order: the block is everything within 1 of the//! inner box, so what it passes through is everything within 1 of what the inner box passes//! through — the inner box swept by the kernel's own sweep of a solid, then grown by 1 by its//! offset.usecrate::sketch::block;
use cad_kernel::geom::{tolerance, V};
use cad_kernel::offset::{grown, Join};
use cad_kernel::swept::closed::slid;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use cad_kernel::util::space::{norm, unit};
use std::f64::consts::TAU;
constROUND: f64 = 1.;
constSLIDE: V = [8., 5., 3.];
pubfnbuild() -> Result<Brep, String> {
let inner = block([1., 1., 1.], [9., 5., 3.])?;
// the slide along (8, 5, 3): a screw that does not turn, advancing its whole length over a// roll of τlet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: unit(SLIDE), ratio: 0., advance: norm(SLIDE),
});
// the kernel's closed swept solid of the inner box (its flat faces mesh exactly, at any bar)let size = inner.size();
let swept = slid(&inner, &path, [0., TAU], size, tolerance(size))
.map_err(|why| format!("the inner box's sweep not built: {why:?}"))?;
// everything within 1 of it: the kernel's offset with round joinsgrown(&swept, ROUND, Join::Round)
}
Time
637 ms; CPU time 637 ms; peak memory 370.3 MB
Notes
wrong its STEP's faces do not close into a solid
Workaround † no sweep of a solid
Data
No measures: it built no solid to measure.
STEP
open faces on surfaces, but no solid AUTOMOTIVE_DESIGN
"""A block with every edge rounded, slid aslant. The solid a rounded block fills as it slides along
a straight line without turning.
The block is the box from (0, 0, 0) to (10, 6, 4) with every edge rounded to radius 1 and every
corner to a ball of radius 1: everything within 1 of the box from (1, 1, 1) to (9, 5, 3). Its faces
are six flat rectangles, twelve quarter cylinders and eight eighths of a ball.
It slides along the vector (8, 5, 3), ending as the same rounded block moved by (8, 5, 3). Make the
solid of everything the block passes through.
The rounded faces touch along their lines and arcs where their normals are square to the slide, and
those paths are what the flat sides of a box slid aslant would sweep, rounded: the result is
everything within 1 of the box from (1, 1, 1) to (9, 5, 3) slid along (8, 5, 3)."""fromOCP.BRepOffsetimportBRepOffset_ModefromOCP.BRepOffsetAPIimportBRepOffsetAPI_MakeOffsetShapefromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBoxfromOCP.GeomAbsimportGeomAbs_JoinTypefromOCP.gp import gp_Pnt
from bench importRefusedfrom sweep import slid, unified, united
CORE = ((1, 1, 1), (9, 5, 3)) # the box the block is everything within ROUND ofROUND = 1SLIDE = (8, 5, 3)
defbuild():
# The rounded block is everything within 1 of the box from (1, 1, 1) to (9, 5, 3), so what it# passes through is everything within 1 of what that box passes through: a point is within 1# of the box at some instant exactly when it is within 1 of the box's sweep. The box's sweep# is its sweep's flat faces, as for `box-slid-aslant`: the box where it starts and its# leading faces slid, a convex polyhedron whose pieces only touch (glued), its faces merged# into its twelve planes. OCCT's offset with rounded joins then grows it by 1: its faces# moved out, its edges grown into cylinders and its corners into balls.
core = BRepPrimAPI_MakeBox(gp_Pnt(*CORE[0]), gp_Pnt(*CORE[1])).Shape()
swept = unified(united(slid(core, SLIDE), glue=True))
grown = BRepOffsetAPI_MakeOffsetShape()
grown.PerformByJoin(swept, ROUND, 1e-7, BRepOffset_Mode.BRepOffset_Skin, False, False,
GeomAbs_JoinType.GeomAbs_Arc)
ifnot grown.IsDone():
raiseRefused("BRepOffsetAPI_MakeOffsetShape could not grow the box's sweep by 1")
return grown.Shape()
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.
Time
137 ms; CPU time 141 ms; peak memory 18.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.
Data
its STEP's
expected
rel. error
volume
694.6544527
694.6544527
1.0e-11
area
474.1145108
474.1145109
1.9e-11
agrees with
cad-kernel, popkern, next.BREP, cadrs, springrep
mesh
16768 triangles, closed, 20 degenerate
centre of gravity
(9, 5.5, 3.5) its STEP's solid
inertia
about it, of unit density: Ixx 7213.32; Iyy 15976.4; Izz 19089.4; Ixy -4108.89; Iyz -1596.89; Izx -2485.1
//! The solid a rounded block fills as it slides, without turning, along (8, 5, 3): the block is//! everything within 1 of the box from (1, 1, 1) to (9, 5, 3), the box from (0, 0, 0) to//! (10, 6, 4) with every edge rounded to radius 1.//!//! The block is the box with all twelve edges filleted (`blend::fillet`); its sweep is kentron's//! sweep of a solid (`sweep::solid`, one slide). kentron refuses it: following where the slide//! grazes the block's rounds, a point does not settle on the curve.usecrate::bench::{edges, p, v};
use kentron::blend;
use kentron::primitives::Cuboid;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let box_ = Cuboid::from_corners(p(0.0, 0.0, 0.0), p(10.0, 6.0, 4.0)).build(m)?;
let all = edges(m, box_);
let block = blend::fillet(m, box_, &all, 1.0)?;
sweep::solid(m, block, &RigidMotion::Slide { by: v(8.0, 5.0, 3.0) })
}
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.
solidcraft left no solid to show.
Time
6.02 s; CPU time 6.02 s; peak memory 63.6 MB
Notes
refused the operation failed: SMLib offset: operation: the offset is refused: the body built is not a manifold solid, as its input was: offset::offset_executive::p2::offset_brep: the body built is not a manifold solid, as its input was: refused
//! The solid a rounded block fills as it slides along (8, 5, 3) without turning: everything within//! 1 of the box from (1, 1, 1) to (9, 5, 3).//!//! solidcraft-kernel has no sweep of a solid, so the sweep is built by elementary geometry. The//! rounded block is the box grown by the ball of radius 1, and growing commutes with sliding: what//! it sweeps is everything within 1 of what the box sweeps. The box's sweep is, as in//! `box-slid-aslant`, the box and its faces that lead the slide (x = 9, y = 5 and z = 3) slid the//! whole way, each by the kernel's `sweep` along a straight path, which translates its profile;//! the grown solid is SolidCraft's offset of the whole solid (`offset_solid`), its convex edges//! rounded.usecrate::solids::*;
use solidcraft_kernel::{sweep, PathSeg};
pubfnbuild() -> R<Body> {
let slide = v3(8.0, 5.0, 3.0);
letmut swept = block((1.0, 1.0, 1.0), (9.0, 5.0, 3.0))?;
// each leading face on a plane whose normal is its outward one, its sides along the box's// edges from the corner nearest the originlet faces = [
(Plane { origin: v3(9.0, 1.0, 1.0), x: Vec3::Y, y: Vec3::Z }, rect(0.0, 0.0, 4.0, 2.0)),
(Plane { origin: v3(1.0, 5.0, 1.0), x: Vec3::Z, y: Vec3::X }, rect(0.0, 0.0, 2.0, 8.0)),
(Plane { origin: v3(1.0, 1.0, 3.0), x: Vec3::X, y: Vec3::Y }, rect(0.0, 0.0, 8.0, 4.0)),
];
for (plane, face) in &faces {
let path = [PathSeg::Line { a: plane.origin, b: plane.origin + slide }];
swept = union(&swept, &sweep(plane, face, &path)?)?;
}
solidcraft_kernel::offset_solid(&swept, 1.0, true)
}
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
81 ms; CPU time 154 ms; peak memory 29.1 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.
Data
its STEP's
expected
rel. error
volume
694.6544527
694.6544527
6.1e-11
area
474.1145108
474.1145109
7.5e-11
agrees with
cad-kernel, kentron, next.BREP, cadrs, springrep
mesh
7682 triangles, closed
centre of gravity
(9, 5.5, 3.5) its STEP's solid
inertia
about it, of unit density: Ixx 7213.32; Iyy 15976.4; Izz 19089.4; Ixy -4108.89; Iyz -1596.89; Izx -2485.1
// The solid everything within 1 of the box from (1, 1, 1) to (9, 5, 3) fills as it slides along// (8, 5, 3): everything within 1 of what the box sweeps, the zonotope of its edges and the slide.fncross(a, b) { [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]] }
fndot(a, b) { a[0] * b[0] + a[1] * b[1] + a[2] * b[2] }
// The zonotope centred at `c` with generators `g` (the sum of the segments from -g/2 to g/2): the// solid common to one slab for each pair of generators, square to both, as thick as the// generators reach across it. A box slid along a vector is one.fnzonotope(m, c, g) {
let body = ();
let first = true;
for i in0..g.len() { for j in (i + 1)..g.len() {
let n = cross(g[i], g[j]);
let l = sqrt(dot(n, n));
if l < 1e-9 { continue; }
n = [n[0] / l, n[1] / l, n[2] / l];
let reach = 0.0;
for k in g { reach += abs(dot(k, n)); }
let r = cross(n, ifabs(n[0]) < 0.9 { [1.0, 0.0, 0.0] } else { [0.0, 1.0, 0.0] });
let slab = m.box(500.0, 500.0, reach, #{ at: c, axis: n, ref: r, centred: true });
if first { body = slab; first = false; } else { body = body.intersect(m.tool(|m| slab)); }
} }
body
}
let m = model();
let z = zonotope(m, [5.0 + 4.0, 3.0 + 2.5, 2.0 + 1.5], [[8.0, 0.0, 0.0], [0.0, 4.0, 0.0], [0.0, 0.0, 2.0], [8.0, 5.0, 3.0]]);
z = z.offset_solid(1.0, #{ label: "rounded" });
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
73 ms; CPU time 73 ms; peak memory 21 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.
Data
its STEP's
expected
rel. error
volume
694.6544527
694.6544527
0.0e+00
area
474.1145109
474.1145109
2.4e-16
agrees with
cad-kernel, kentron, popkern, cadrs, springrep
mesh
8108 triangles, closed, 2 degenerate
centre of gravity
(9, 5.5, 3.5) its STEP's solid
inertia
about it, of unit density: Ixx 7213.32; Iyy 15976.4; Izz 19089.4; Ixy -4108.89; Iyz -1596.89; Izx -2485.1
//! Everything the box from (0, 0, 0) to (10, 6, 4) with every edge and corner rounded to radius 1//! (everything within 1 of the box from (1, 1, 1) to (9, 5, 3)) passes through as it slides//! without turning along (8, 5, 3).//!//! next.BREP has no sweep of a solid along a line. The rounded block is the inner box grown by 1,//! and growing commutes with sliding (a point within 1 of the inner box at some place of the slide//! is within 1 of the inner box's sweep, and back), so the sweep is the inner box's sweep grown//! by 1. The inner box's sweep is, by elementary geometry (`solids::swept::polyhedron_slid`), the//! box where it starts and where it stops and each of its faces slid along the line, united by the//! kernel; the kernel's offset grows it by 1, rounding every edge and corner.usecrate::solids::offset::parallel;
usecrate::solids::p;
usecrate::solids::swept::{box_faces, polyhedron_slid};
usecrate::Refusal;
use brep_kernel::{boolean_operation_nary, make_box_brep, BooleanOperation, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let (corner, size) = (p(1.0, 1.0, 1.0), p(8.0, 4.0, 2.0));
let inner = make_box_brep(corner, size.x, size.y, size.z)?;
let faces = box_faces(corner, p(size.x, 0.0, 0.0), p(0.0, size.y, 0.0), p(0.0, 0.0, size.z));
let slid = boolean_operation_nary(&polyhedron_slid(&inner, &faces, p(8.0, 5.0, 3.0))?,
BooleanOperation::Union)?;
Ok(parallel(&slid, 1.0)?)
}
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
74 ms; CPU time 204 ms; peak memory 12.8 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 solid a rounded block (the box from the origin to (10, 6, 4), every edge rounded to radius//! 1 and every corner to a ball) fills as it slides along (8, 5, 3).//!//! The block's twelve edges are filleted together (its corners balls); what it passes through is//! cadrs's sweep of a solid (one slide).usecrate::bench::{block, p3, v3};
usecrate::shared::fillet::fillet;
usecrate::shared::swept::slid;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Pick};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = block(k, p3(0.0, 0.0, 0.0), p3(10.0, 6.0, 4.0))?;
let edges = k.edges_but_seams(b)?;
let rounded = fillet(k, b, &edges, 1.0)?;
slid(k, rounded, v3(8.0, 5.0, 3.0))
}
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
67 ms; CPU time 67 ms; peak memory 9.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.
Data
its STEP's
expected
rel. error
volume
694.6544527
694.6544527
1.6e-16
area
474.1145109
474.1145109
1.2e-16
agrees with
cad-kernel, kentron, popkern, next.BREP, cadrs
mesh
7586 triangles, closed
centre of gravity
(9, 5.5, 3.5) its STEP's solid
inertia
about it, of unit density: Ixx 7213.32; Iyy 15976.4; Izz 19089.4; Ixy -4108.89; Iyz -1596.89; Izx -2485.1
//! The solid a rounded block fills as it slides along (8, 5, 3): everything within 1 of the box//! (1, 1, 1)–(9, 5, 3), slid. springrep's offset grows the box into the rounded block.use springrep::edit::offset;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, v3};
pubfnbuild() -> Result<Brep, String> {
let core = boxed([1.0, 1.0, 1.0], [9.0, 5.0, 3.0], "block")?;
let block = offset(&core, 1.0, "rounded").map_err(e)?;
solid(&block, &Motion::Slide(v3(8.0, 5.0, 3.0)), "swept").map_err(e)
}
geomsolver left no solid to show.
Time
644 ms; CPU time 750 ms; peak memory 54.5 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a rounded block fills as it slides aslant. The block is the box from (0, 0, 0) to// (10, 6, 4), its footprint in the top plane and the prism over it, with every edge rounded to// radius 1 (three rounds meeting in a ball at each corner). The part is the kernel's sweep of the// block slid without turning along (8, 5, 3).unit mm
use std
use std.solids
use std.rounds (round)
use std.motion (slides)
in std.top {
a := point
b := point hint((10, 0))
c := point hint((10, 6))
d := point hint((0, 6))
footprint := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((0, 0)) a
a distance(10mm) b
b distance(6mm) c
}
construction block := solid(std.solids.Prism(footprint, from: 0mm, to: 4mm))
round(r: 1mm) block
// the slide: along (8, 5, 3) from the corner, its whole length over the roll's one turnprivate path := axis
fix(dir == (8, 5, 3)) path
a coincident path
carriage := frame
carriage slides(sqrt(8^2 + 5^2 + 3^2) * 1mm) path
part := solid({ p | some t in (0deg, 360deg): p in block at(under: carriage) t })
anvilcad left no solid to show.
Time
1.4 ms; CPU time 1.2 ms; peak memory 3.3 MB
Notes
refused anvil-brep has no sweep of a solid, and the rounded block's sweep is the box's sweep grown by 1 with its edges rounded, which its offset (that keeps edges sharp) cannot make
//! A block with every edge rounded, slid aslant.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and the rounded block's sweep is the box's sweep grown by 1 with its edges rounded, which its offset (that keeps edges sharp) cannot make".into())
}