A ball of radius 1 centered at (5, 0, 0), at the end of an arm of length 5 from the z axis. Sweep it by a rigid motion that turns it about the z axis while sliding it along x, both at a steady rate: at each instant t from 0 to 1 the ball is turned right-handed about the z axis by 180°·t and then slid by (25t, 0, 0). The solid is everything the ball passes through.
It is not a screw: the slide is square to the turn's axis, so the motion is a rolling one, the ball carried on a wheel of radius 25/π ≈ 7.96 rolling along a line, and its center runs along a curtate trochoid, c(t) = (5 cos πt + 25t, 5 sin πt, 0), from (5, 0, 0) to (20, 0, 0) by way of (12.5, 5, 0). The path is tightest at its top, t = ½, where its radius of curvature is 1.75, more than the ball's, so the solid is the tube of radius 1 about that path, with a half ball at each end and no fold.
As a set:
$$\bigcup_{0 \le t \le 1} B_1\bigl(c(t)\bigr),\quad c(t) = (5\cos\pi t + 25t,\ 5\sin\pi t,\ 0)$$
expected
closed form
volume
61.32537597
πr²L + 4πr³/3, r = 1, L = ∫₀¹|c′(t)|dt = ∫₀¹√(625 − 250π sin πt + 25π²)dt = 18.187140112880417, the length of the center's path c(t) = (5 cos πt + 25t, 5 sin πt, 0) (a tube's volume is its section's area times its center line's length wherever the line curves no tighter than its radius, and the ends are two half balls)
area
126.8395422
2πrL + 4πr², r = 1, L = 18.187140112880417
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
45 ms; CPU time 48 ms; peak memory 13.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
61.32537945
61.32537597
5.7e-08
area
126.8395421
126.8395422
5.0e-11
agrees with
no other kernel
mesh
46858 triangles, closed, 2 degenerate
centre of gravity
(12.5, 2.46591, 2.22398e-08) its STEP's solid
inertia
about it, of unit density: Ixx 199.188; Iyy 1360.23; Izz 1529.17; Ixy -4.04658e-06; Iyz -3.67799e-06; Izx 5.04982e-09
//! A ball of radius 1 centred at (5, 0, 0), at the end of an arm of length 5 from the z axis,//! swept by a rigid motion that turns it about the z axis while sliding it along x, both at a//! steady rate: at each instant t from 0 to 1 the ball is turned right-handed about z by 180°·t and//! then slid by (25t, 0, 0). The solid is everything the ball passes through: its centre runs along//! a curtate trochoid from (5, 0, 0) to (20, 0, 0), no tighter than the ball's radius.//!//! The kernel's sweep of a ball (`swept::canal`): it reads the ball's centre's path off the//! trajectory and carries the ball's disc square to it, a face family no closed form carries,//! capped by a half ball at each end (the recipe's `Canal` node, as a document's ball sweep is//! built).use cad_kernel::build::sphere;
use cad_kernel::geom::V;
use cad_kernel::recipe::{node, Node};
use cad_kernel::swept::canal::{ball, tube};
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::collections::BTreeMap;
use std::f64::consts::{PI, TAU};
constUP: V = [0., 0., 1.];
constCENTRE: V = [5., 0., 0.];
constRADIUS: f64 = 1.;
/// How far the ball slides along x over the roll; it turns half a turn meanwhile.constSLIDE: f64 = 25.;
pubfnbuild() -> Result<Brep, String> {
let tool = sphere(CENTRE, UP, RADIUS)?;
// the turn about z, π radians a unit of the rolllet turn = Trajectory::Twist(Screw { origin: [0.; 3], axis: UP, ratio: PI, advance: 0. });
// then the slide: seen from an observer sliding back along x, `SLIDE` a unit of the roll (a// slide's advance is read per turn of the parameter, 2π of it)let slide = Screw { origin: [0.; 3], axis: [-1., 0., 0.], ratio: 0., advance: SLIDE * TAU };
let back = Trajectory::Twist(slide);
let path = Trajectory::Relative { source: Box::new(turn), observer: Box::new(back) };
// the ball read from its B-rep, as the kernel's sweep reads its toollet (centre, radius, face) = ball(&tool, 1.).ok_or("the ball is not read as a ball")?;
let swept = tube(&path, centre, radius, &face, [0., 1.])
.map_err(|why| format!("the ball's tube not built: {why:?}"))?
.ok_or("the ball's tube is a screw's meeting itself")?;
let canal =
Node::Canal { centre: swept.centre, radius: swept.radius, spine: swept.spine, face };
node(&canal, &BTreeMap::new())
}
occt left no solid to show.
Time
620 ms; CPU time 620 ms; peak memory 356.8 MB
Notes
refused OCCT has no sweep of a solid, and no curve for the trochoid the ball's center runs along to sweep its circle on
"""A ball on an arm, turned half a turn as its axis slides. A ball of radius 1 centered at (5, 0, 0),
at the end of an arm of length 5 from the z axis. Sweep it by a rigid motion that turns it about
the z axis while sliding it along x, both at a steady rate: at each instant t from 0 to 1 the ball
is turned right-handed about the z axis by 180°·t and then slid by (25t, 0, 0). The solid is
everything the ball passes through.
It is not a screw: the slide is square to the turn's axis, so the motion is a rolling one, the ball
carried on a wheel of radius 25/π ≈ 7.96 rolling along a line, and its center runs along a curtate
trochoid, c(t) = (5 cos πt + 25t, 5 sin πt, 0), from (5, 0, 0) to (20, 0, 0) by way of (12.5, 5,
0). The path is tightest at its top, t = ½, where its radius of curvature is 1.75, more than the
ball's, so the solid is the tube of radius 1 about that path, with a half ball at each end and no
fold."""from bench importRefuseddefbuild():
# The ball's sweep is the tube about its center's path with a ball at each end, but the path# is a curtate trochoid, (5 cos πt + 25t, 5 sin πt, 0), and OCCT has no such curve: only a# curve fitted to points computed here, which is geometry made outside the kernel.raiseRefused("OCCT has no sweep of a solid, and no curve for the trochoid the ball's center ""runs along to sweep its circle on")
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
2.4 ms; CPU time 2.1 ms; peak memory 7.8 MB
Notes
refused invalid input: a motion under which where it grazes the tool moves over it: its envelope is no product of a curve and the motion
//!//! The motion is given by its places (`sweep::RigidMotion::Carried`) for kentron's sweep of a//! solid (`sweep::solid`), which refuses it: the curves where the motion grazes the tool move over it, so its envelope is//! no product of a fixed curve and the motion, and kentron's sweep builds only those.usecrate::bench::{frame, p, v};
use kentron::math::{Axis, Direction, Transform};
use kentron::primitives::Sphere;
use kentron::sweep::{self, Carriage, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::PI;
use std::sync::Arc;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let ball = Sphere::new(1.0).with_frame(frame(p(5.0, 0.0, 0.0), Direction::Z)).build(m)?;
let place = |t: f64| Transform::translation(v(25.0 * t, 0.0, 0.0)) * Transform::rotation(Axis::Z, PI * t);
sweep::solid(m, ball, &RigidMotion::Carried(Carriage(Arc::new(place))))
}
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, a trochoid, or a sweep along a continuous motion (ops's sweep_stations only skins sections through sampled placements): the ball's sweep is the tube about its centre's path, a curtate trochoid, which no layer's lines, arcs, conics, Béziers or NURBS can hold
//! Refused. The ball has no orientation to keep, so its sweep is the tube of radius 1 about its//! centre's path with a half ball at each end (the path turning no tighter than 1.75). But that//! path, (5 cos πt + 25t, 5 sin πt, 0), is a curtate trochoid: transcendental, so none of the//! lines, arcs, conics, Béziers or NURBS a path or curve of any layer is made of. No layer has a//! sweep of a solid, a trochoid, or a sweep along a continuous motion (ops's `sweep_stations` only//! skins sections through placements the caller samples), and a spline fitted to the trochoid,//! or stations sampled from it, 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, a trochoid, \
or a sweep along a continuous motion (ops's sweep_stations only skins sections through \
sampled placements): the ball's sweep is the tube \
about its centre's path, a curtate trochoid, which no layer's lines, arcs, conics, \
Béziers or NURBS can hold"
.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
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
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
84 ms; CPU time 84 ms; peak memory 26.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
61.32542552
61.32537597
8.1e-07
area
126.8395864
126.8395422
3.5e-07
agrees with
no other kernel
mesh
44674 triangles, closed, 4 degenerate
centre of gravity
(12.5, 2.46592, 4.53877e-17) its STEP's solid
inertia
about it, of unit density: Ixx 199.189; Iyy 1360.23; Izz 1529.17; Ixy 6.57823e-09; Iyz -3.93635e-15; Izx -3.58785e-15
//! A ball of radius 1 centered at (5, 0, 0), turned right-handed about the z axis by 180°·t and//! slid by (25t, 0, 0) for t from 0 to 1: everything it passes through.//!//! A ball looks the same whichever way it is turned, so what it sweeps depends on its centre's path//! alone, here the curtate trochoid c(t) = (5 cos πt + 25t, 5 sin πt, 0), which curves no tighter//! than 1.75, more than the ball's radius: the solid is the pipe of radius 1 about that path,//! closed by a half ball at each end. The path is interpolated through 201 points of it (a cubic,//! within about 1e-9 of the trochoid), the unit circle swept along it square to it//! (`sweep_profile_along_path`), and the pipe united with the balls about its ends, whose other//! halves lie inside it.usecrate::solids::p;
usecrate::solids::sweep::circle;
usecrate::Refusal;
use brep_kernel::{boolean_operation_nary, interpolate_curve, make_sphere_brep, sweep_profile_along_path, BooleanOperation, BrepSolid};
use std::f64::consts::PI;
constSTATIONS: usize = 200;
fncentre(t: f64) -> brep_kernel::Vec3 {
p(5.0 * (PI * t).cos() + 25.0 * t, 5.0 * (PI * t).sin(), 0.0)
}
pubfnbuild() -> Result<BrepSolid, Refusal> {
let parameters: Vec<f64> = (0..=STATIONS).map(|k| k as f64 / STATIONSas f64).collect();
let points: Vec<_> = parameters.iter().map(|&t| centre(t)).collect();
let path = interpolate_curve(&points, 3, ¶meters)?;
let profile = circle(p(0.0, 0.0, 0.0), p(1.0, 0.0, 0.0), p(0.0, 1.0, 0.0), 1.0)?;
let pipe = sweep_profile_along_path(&profile, &path, None)?;
let up = p(0.0, 0.0, 1.0);
let start = make_sphere_brep(centre(0.0), 1.0, up)?;
let end = make_sphere_brep(centre(1.0), 1.0, up)?;
Ok(boolean_operation_nary(&[pipe, start, end], BooleanOperation::Union)?)
}
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
8.6 ms; CPU time 10 ms; peak memory 9.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
61.32538721
61.32537597
1.8e-07
area
126.8395544
126.8395422
9.6e-08
agrees with
no other kernel
mesh
45002 triangles, closed, 6 degenerate
centre of gravity
(12.5, 2.46591, -3.59002e-17) its STEP's solid
inertia
about it, of unit density: Ixx 199.188; Iyy 1360.23; Izz 1529.17; Ixy -1.28465e-09; Iyz -6.3196e-15; Izx 4.27989e-15
//! A ball of radius 1 centered at (5, 0, 0), swept by turning it half a turn about the z axis//! while sliding it 25 along x, both steadily: at instant t turned by 180°·t, then slid by//! (25t, 0, 0). Its center runs along a curtate trochoid.//!//! cadrs's sweep of a solid by a rigid motion of two steps, the turn applied first.usecrate::bench::{ball, p3, v3};
usecrate::shared::swept::z_axis;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Kernel, RigidStep, SolidMotion};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = ball(k, p3(5.0, 0.0, 0.0), 1.0)?;
let steps = vec![
RigidStep::Turn { axis: z_axis(), from: 0.0, to: std::f64::consts::PI },
RigidStep::Slide { from: v3(0.0, 0.0, 0.0), to: v3(25.0, 0.0, 0.0) },
];
Ok(k.sweep_solid(b, &SolidMotion::Rigid { steps })?.first()?)
}
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.
springrep left no solid to show.
Time
1.7 ms; CPU time 1.5 ms; peak memory 7.9 MB
Notes
refused unsupported: a sweep along a motion whose velocity changes on the body, of a sphere face
//! The solid a ball of radius 1 centered at (5, 0, 0) passes through as it turns half a turn about//! the z axis while sliding 25 along x, both at a steady rate.use std::f64::consts::PI;
use springrep::math::{Point3, Vec3};
use springrep::primitive::sphere;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let ball = sphere(&at([5., 0., 0.]), 1., "ball").map_err(e)?;
let rolling = Motion::Then(
Box::new(Motion::Turn {
origin: Point3::ZERO,
axis: Vec3::Z,
from: 0.,
to: PI,
}),
Box::new(Motion::Slide(Vec3::new(25., 0., 0.))),
);
solid(&ball, &rolling, "swept").map_err(e)
}
geomsolver 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.
anvilcad left no solid to show.
Time
1.1 ms; CPU time 970 µs; 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 ball on an arm, turned half a turn as its axis slides.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())
}