A curved block with a notch cut into it by a ball on a leaning stem, swung partway into it.
The block is a sector of a ring about the z axis: everything with distance from the z axis between 8 and 12, with z between −1 and 1, and with polar angle between 0° and 60° (measured from +x toward +y).
The tool is the union of a ball of radius 0.8 centered at (10, 0, 0) and a stem, a solid cylinder of radius 0.4 whose axis runs from the ball's center 3 along the direction (0, sin 20°, cos 20°), leaning 20° from upright toward +y, its far end flat. The stem stands out through the block's top. Where the stem leaves the ball the tool has a concave seam.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +30°: it starts clear of the block and stops halfway across it. Cut from the block everything the tool passes through.
expected
closed form
volume
71.03324856
no closed form: cad-kernel and cadrs agree to 2e-11; the mean of their values
area
164.1729535
no closed form: cad-kernel and cadrs agree to 7e-12; the mean of their values
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from next.BREP'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
2.95 s; CPU time 6.32 s; peak memory 23.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.
Data
its STEP's
expected
rel. error
volume
71.03324855
71.03324856
2.1e-11
area
164.1729535
164.1729535
1.6e-11
agrees with
kentron, next.BREP, cadrs, springrep, geomsolver
mesh
10900 triangles, closed
centre of gravity
(8.18612, 5.19966, -0.0140783) its STEP's solid
inertia
about it, of unit density: Ixx 525.468; Iyy 277.097; Izz 752.151; Ixy 234.824; Iyz -2.27039; Izx 1.23059
//! A ring sector (radii 8 to 12 about z, z from −1 to 1, polar angle 0° to 60°) notched by a ball//! of radius 0.8 about (10, 0, 0) united with a stem, the cylinder of radius 0.4 running 3 from the//! ball's centre along (0, sin 20°, cos 20°), turned rigidly about z, right-handed, from −140° to//! +30°: it starts clear and stops halfway across.usecrate::sketch::polygon;
use cad_kernel::boolean::{combined, Op};
use cad_kernel::build::{disc, prism, revolve, sphere};
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 std::f64::consts::FRAC_PI_3;
constUP: V = [0., 0., 1.];
constCENTRE: V = [10., 0., 0.];
constBALL: f64 = 0.8;
constSTEM: f64 = 0.4;
constSTEM_LENGTH: f64 = 3.;
/// How far the stem leans from upright toward +y, in degrees.constLEAN: f64 = 20.;
/// The turn's start and stop, in degrees.constFROM: f64 = -140.;
constTO: f64 = 30.;
/// How closely the tool is meshed for the sweep's membership reads: a two-hundredth of the stem's/// radius.constBAR: f64 = 0.002;
/// The ring sector: its section in the half-plane at 0° turned 60° about z.fnsector() -> Result<Brep, String> {
let section = polygon(&[[8., 0., -1.], [12., 0., -1.], [12., 0., 1.], [8., 0., 1.]]);
revolve(§ion, [0.; 3], UP, FRAC_PI_3)
}
pubfnbuild() -> Result<Brep, String> {
let blank = sector()?;
let lean = LEAN.to_radians();
let along = [0., lean.sin(), lean.cos()];
// the ball's poles on the stem's axis, so the one it leaves by is buried in the stemlet ball = sphere(CENTRE, along, BALL)?;
let stem = prism(&disc(CENTRE, along, STEM), 0., STEM_LENGTH)?;
let tool = combined(&ball, &stem, Op::Union, 0.)?;
// the turn about z: a screw that does not advance, a radian a radian of the rolllet path = Trajectory::Twist(Screw { origin: [0.; 3], axis: UP, ratio: 1., advance: 0. });
// the kernel's closed swept solid cut from the sector on one arrangement: the ball's great// circle through the axis turned into a torus, the stem's side (about an axis leaning to the// turn's) touching along a curve turned into a surface of revolution, its flat end's rim a// sharp circle leaning to the axislet size = blank.size().max(tool.size());
cut_from(&blank, &tool, &path, [FROM.to_radians(), TO.to_radians()], BAR, tolerance(size))
.map_err(|why| format!("the tool's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
607 ms; CPU time 606 ms; peak memory 356.5 MB
Notes
refused occt has no sweep of a solid: it turns faces, and the stem's side, whose axis runs past the turn's without meeting it, touches what it sweeps along a curve that is no section of it by a plane, which occt has no operation to find
"""A ball on a leaning stem swung partway into a block. A curved block with a notch cut into it by
a ball on a leaning stem, swung partway into it.
The block is a sector of a ring about the z axis: everything with distance from the z axis between
8 and 12, with z between −1 and 1, and with polar angle between 0° and 60° (measured from +x toward
+y).
The tool is the union of a ball of radius 0.8 centered at (10, 0, 0) and a stem, a solid cylinder
of radius 0.4 whose axis runs from the ball's center 3 along the direction (0, sin 20°, cos 20°),
leaning 20° from upright toward +y, its far end flat. The stem stands out through the block's top.
Where the stem leaves the ball the tool has a concave seam.
It turns rigidly about the z axis, right-handed (from +x toward +y), from −140° to +30°: it starts
clear of the block and stops halfway across it. Cut from the block everything the tool passes
through."""from bench importRefuseddefbuild():
# A turn about the z axis meets the ball square-on along its great circle in the plane# through the axis and its centre, which a plane would cut out. But the stem's axis runs# past the turn's without meeting it: at the point of the stem's side at height s along its# axis and angle t round it, the normal is square to the velocity where a relation in s and# t holds that is no plane section, no line and no circle of the cylinder. OCCT sweeps no# solid (BRepPrimAPI_MakeRevol: "Solids are not Processed"), and a face it turns sweeps to a# solid only once split along its contact, which for the stem is that curve: finding it# would be computing the envelope outside the kernel.raiseRefused("occt has no sweep of a solid: it turns faces, and the stem's side, whose ""axis runs past the turn's without meeting it, touches what it sweeps along a ""curve that is no section of it by a plane, which occt has no operation to ""find")
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
178 ms; CPU time 228 ms; peak memory 27.5 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 curved block, the sector of the ring about the z axis between radii 8 and 12, z from −1 to 1//! and polar angle from 0° to 60°, notched by a ball on a leaning stem swung partway into it: the//! ball of radius 0.8 about (10, 0, 0) and the solid cylinder of radius 0.4 from its centre 3//! along (0, sin 20°, cos 20°), united, turned right-handed about the z axis from −140° to +30°.//! Everything the tool passes through, cut.//!//! The tool passes through a point when the ball or the stem does, so its sweep is the union of//! theirs, each kentron's sweep of a solid (`sweep::solid`, one turn); cut from the block.usecrate::bench::{frame, p};
usecrate::shared::swept::ring_sector;
use kentron::math::{Axis, Direction, Vector};
use kentron::primitives::{Cylinder, Sphere};
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = ring_sector(m)?;
let lean = 20f64.to_radians();
let axis = Direction::from_vector(Vector::new(0.0, lean.sin(), lean.cos()));
let ball = Sphere::new(0.8).with_frame(frame(p(10.0, 0.0, 0.0), axis)).build(m)?;
let stem = Cylinder::new(0.4, 3.0).with_frame(frame(p(10.0, 0.0, 0.0), axis)).build(m)?;
let turn = RigidMotion::Turn { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), from: (-140f64).to_radians(), to: 30f64.to_radians() };
let ball_swept = sweep::solid(m, ball, &turn)?;
let stem_swept = sweep::solid(m, stem, &turn)?;
let swept = kentron::boolean::union(m, ball_swept, stem_swept)?;
kentron::boolean::difference(m, block, swept)
}
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
1.8 ms; CPU time 1.6 ms; peak memory 4.6 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: the stem, a cylinder about a line skew to the turn's axis, touches its sweep along curves that are none of its lines or circles, so what it cuts is bounded by an envelope
//! Refused. The tool is a ball on a stem, a cylinder whose axis leans 20° across the turn: a line//! skew to the z axis. Turned about the z axis, a cylinder about a skew line touches its sweep//! along curves that are none of its lines or circles (where its normal is square to the turn's//! velocity), so the notch's walls are the revolves of an envelope. solidcraft-kernel has no//! sweep of a solid and no envelope, and that contact computed here would be geometry made//! outside the kernel.usecrate::Refusal;
usecrate::solids::Body;
pubfnbuild() -> Result<Body, Refusal> {
Err("no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: the stem, a cylinder about a \
line skew to the turn's axis, touches its sweep along curves that are none of its lines \
or circles, so what it cuts is bounded by an envelope"
.into())
}
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.
popkern left no solid to show.
Time
3.4 ms; CPU time 3.2 ms; peak memory 11.6 MB
Notes
refused popkern has no sweep of a solid, and this motion's envelope is not one its extrudes, revolves and booleans make exactly
// A ball on a leaning stem swung partway into a block.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and the// envelope this motion leaves is not one its extrudes, revolves and booleans make exactly: the// tool is not symmetric about the planes of its motion, or the motion is a screw or a curve.throw"popkern has no sweep of a solid, and this motion's envelope is not one its extrudes, revolves and booleans make exactly";
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
821 ms; CPU time 820 ms; peak memory 336 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
71.03324857
71.03324856
2.4e-10
area
164.1729535
164.1729535
4.8e-11
agrees with
cad-kernel, kentron, cadrs, springrep, geomsolver
mesh
19218 triangles, closed, 2 degenerate
centre of gravity
(8.18612, 5.19966, -0.0140783) its STEP's solid
inertia
about it, of unit density: Ixx 525.468; Iyy 277.097; Izz 752.151; Ixy 234.824; Iyz -2.27039; Izx 1.23059
//! A ring sector notched by a ball on a leaning stem swung partway into it.//!//! What a union sweeps is the union of what its parts sweep. Through the kernel's whole sweep of a//! solid (`sweep_solid`): the ball, a solid of revolution about the vertical line through (10, 0, 0)//! whose meridian is the half disc of radius 0.8, and the stem, one about the line through (10, 0, 0)//! along (0, sin 20°, cos 20°) whose meridian is the rectangle out to radius 0.4 from 0 to 3 along//! it; each turned about the z axis from −140° to +30°; both cut from the block (the rectangle 8 ≤ x//! ≤ 12, |z| ≤ 1 revolved from 0° to 60°).usecrate::solids::p;
usecrate::Refusal;
#[allow(unused_imports)]use brep_kernel::{
boolean_operation_nary, make_box_brep, make_cylinder_brep, revolve_profile_brep,
sweep_solid, BooleanOperation, BrepSolid, OutlinePiece, ScrewStep, SolidMotion,
SolidTool, Vec3,
};
#[allow(unused_imports)]use std::f64::consts::{FRAC_PI_2, PI, TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let section = [p(8.0, 0.0, -1.0), p(12.0, 0.0, -1.0), p(12.0, 0.0, 1.0), p(8.0, 0.0, 1.0)];
let block = revolve_profile_brep(&crate::solids::polygon(§ion)?, p(0.0, 0.0, 0.0), p(0.0, 0.0, 1.0), 60f64.to_radians())?;
letmut operands = vec![block];
let tool0 = SolidTool::Revolved {
axis_origin: p(10.0, 0.0, 0.0),
axis_direction: p(0.0, 0.0, 1.0),
radial: p(1.0, 0.0, 0.0),
meridian: vec![
OutlinePiece::Arc { centre: [0.0, 0.0], radius: 0.8, start: -FRAC_PI_2, end: FRAC_PI_2 },
OutlinePiece::Line { from: [0.0, 0.8], to: [0.0, -0.8] },
],
};
let motion0 = SolidMotion {
steps: vec![
ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, 0.0, 1.0), turn: 1.0, advance: 0.0 },
],
from: (-140f64).to_radians(),
to: 30f64.to_radians(),
};
operands.push(sweep_solid(&tool0, &motion0)?);
let tool1 = SolidTool::Revolved {
axis_origin: p(10.0, 0.0, 0.0),
axis_direction: p(0.0, 20f64.to_radians().sin(), 20f64.to_radians().cos()),
radial: p(1.0, 0.0, 0.0),
meridian: vec![
OutlinePiece::Line { from: [0.0, 0.0], to: [0.4, 0.0] },
OutlinePiece::Line { from: [0.4, 0.0], to: [0.4, 3.0] },
OutlinePiece::Line { from: [0.4, 3.0], to: [0.0, 3.0] },
OutlinePiece::Line { from: [0.0, 3.0], to: [0.0, 0.0] },
],
};
let motion1 = SolidMotion {
steps: vec![
ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: p(0.0, 0.0, 1.0), turn: 1.0, advance: 0.0 },
],
from: (-140f64).to_radians(),
to: 30f64.to_radians(),
};
operands.push(sweep_solid(&tool1, &motion1)?);
Ok(boolean_operation_nary(&operands, BooleanOperation::Subtract)?)
}
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
173 ms; CPU time 445 ms; peak memory 25.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.
//! A curved block (the ring sector between radii 8 and 12, heights ±1, polar angles 0° to 60°)//! notched by a ball (radius 0.8 about (10, 0, 0)) on a stem (a cylinder of radius 0.4 from the//! ball's centre 3 along (0, sin 20°, cos 20°)) turned about the z axis from −140° to +30°.//!//! The tool is the ball and the stem united; what it passes through (one turn) is cut from the//! block (cadrs's cylindrical box) by cadrs's cut by a swept solid (the exact sweep cut from it//! where it can be, else meshed).usecrate::bench::{ball, cylinder, p3, union, v3};
usecrate::shared::swept::{cut_swept, ring_sector, swing, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let block = ring_sector(k, (8.0, 12.0), (-1.0, 1.0), (0.0, 60.0))?;
let a = 20f64.to_radians();
let b = ball(k, p3(10.0, 0.0, 0.0), 0.8)?;
let stem = cylinder(k, p3(10.0, 0.0, 0.0), v3(0.0, a.sin(), a.cos()), 0.4, 3.0)?;
let tool = union(k, b, stem)?;
cut_swept(k, block, tool, &swing(z_axis(), -140.0, 30.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
774 ms; CPU time 773 ms; peak memory 10.4 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
71.03324855
71.03324856
5.0e-12
area
164.1729535
164.1729535
8.4e-12
agrees with
cad-kernel, kentron, next.BREP, cadrs, geomsolver
mesh
11533 triangles, closed, 1 degenerate
centre of gravity
(8.18612, 5.19966, -0.0140783) its STEP's solid
inertia
about it, of unit density: Ixx 525.468; Iyy 277.097; Izz 752.151; Ixy 234.824; Iyz -2.27039; Izx 1.23059
//! The ring sector (radii 8 to 12, heights −1 to 1, angles 0° to 60°) less everything a ball of//! radius 0.8 at (10, 0, 0) on a stem leaning 20° toward +y passes through as it turns about the//! z axis from −140° to 30°.use springrep::boolean::{difference, union};
use springrep::math::{Frame, Vec3};
use springrep::primitive::{cylinder, sphere};
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, sector_block, turning, v3};
pubfnbuild() -> Result<Brep, String> {
let lean = deg(20.0);
let up = Frame::new(v3(10.0, 0.0, 0.0), v3(0.0, lean.sin(), lean.cos()), Vec3::X).map_err(e)?;
let stem = cylinder(&up, 0.4, 3.0, "stem").map_err(e)?;
let ball = sphere(&crate::shared::at([10.0, 0.0, 0.0]), 0.8, "ball").map_err(e)?;
let tool = union(&ball, &stem).map_err(e)?;
let swept = solid(&tool, &turning(deg(-140.0), deg(30.0)), "swing").map_err(e)?;
difference(§or_block()?, &swept).map_err(e)
}
Time
3.24 s; CPU time 6.64 s; peak memory 42.4 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
71.03324856
71.03324856
8.7e-11
area
164.1729535
164.1729535
8.8e-11
agrees with
cad-kernel, kentron, next.BREP, cadrs, springrep
mesh
11243 triangles, closed, 1 degenerate
centre of gravity
(8.18612, 5.19966, -0.0140783) its STEP's solid
inertia
about it, of unit density: Ixx 525.468; Iyy 277.097; Izz 752.151; Ixy 234.824; Iyz -2.27039; Izx 1.23059
// A curved block, the ring sector between radii 8 and 12 about the z axis, z within 1, polar angle// from 0 to 60 degrees: its section in the front plane (x, z) turned 60 degrees about the z axis.// The tool, a ball of radius 0.8 about (10, 0, 0) in union with a stem, the rod of radius 0.4// along the segment 3 long from the ball's centre leaning 20 degrees from upright toward +y. It is// turned rigidly about the z axis from -140 to +30 degrees, and everything it passes through cut// from the block.unit mm
use std
use std.sets
use std.solids
use std.solids (cut, union)
use std.motion (turns)
in std.front {
a := point
b := point hint((12, -1))
c := point hint((12, 1))
d := point hint((8, 1))
meridian := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((8, -1)) a
a distance(4) b
b distance(2) c
}
part := solid(std.solids.Revolution(meridian, about: std.z, to: 60deg))
centre := point
fix((10, 0, 0)) centre
top := point hint((10, 1.03, 2.82))
stem_axis := line(centre, top)
length(3) stem_axis
stem_axis perpendicular std.x
stem_axis angle(20deg, about: std.x) std.z
ball := solid(std.sets.Ball(centre, r: 0.8mm))
stem := solid(std.sets.Rod(stem_axis, r: 0.4mm))
tool := solid(ball)
stem union tool
swing := frame
swing turns(1) std.z
notch := solid({ p | some t in (-140deg, 30deg): p in tool at(under: swing) t })
notch cut part
anvilcad left no solid to show.
Time
1.2 ms; CPU time 980 µs; peak memory 3.3 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 ball on a leaning stem swung partway into 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())
}