The solid a ball fills as it is swung partway about an upright line that passes through it.
The ball has radius 2 and its center is (1, 0, 0). It turns rigidly about the z axis, right-handed (from +x toward +y), by 120°, its center running along an arc of radius 1. Make the solid of everything the ball passes through.
The ball reaches across the turn's axis, so the tube about its center's arc is a piece of a spindle torus: it passes through itself on the axis, and its inner part is buried inside the balls at the two ends.
expected
closed form
volume
59.33319437
no closed form: OCCT and cadrs agree to 8e-10; the mean of their values
area
75.53287048
no closed form: OCCT and cadrs agree to 9e-10; the mean of their values
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
147 ms; CPU time 291 ms; peak memory 18.7 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
59.33319435
59.33319437
4.2e-10
area
75.53287045
75.53287048
4.4e-10
agrees with
occt, kentron, next.BREP, cadrs, springrep
mesh
37402 triangles, closed, 4 degenerate
centre of gravity
(0.328337, 0.568697, 6.13209e-15) its STEP's solid
inertia
about it, of unit density: Ixx 125.353; Iyy 146.712; Izz 166.365; Ixy 18.4975; Iyz 2.5656e-13; Izx 2.12396e-13
//! The solid a ball of radius 2 about (1, 0, 0) fills as it turns rigidly about the z axis,//! right-handed, by 120°: the axis passes through the ball, so the tube about its centre's arc is a//! piece of a spindle torus.//!//! The kernel's closed sweep (`swept::closed::closed`) takes the ball whole: under a turn its//! closed class takes a ball whose great circle through the axis turns into a ring torus, and//! refuses one reaching across the axis (`Unbuilt::Curved`), whose torus would be a spindle; since//! 0.10.0 such a tool goes the contact's road — the great circle's sheet on the torus its meridian//! turns into, cut where the meridian crosses the axis, a pole of the sheets either side, and//! trimmed by membership in the sweep.use cad_kernel::build::sphere;
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
constUP: V = [0., 0., 1.];
constCENTRE: V = [1., 0., 0.];
constRADIUS: f64 = 2.;
/// The turn, in degrees.constTURN: f64 = 120.;
/// How closely the ball is meshed for the sweep's membership reads: a thousandth of its radius.constBAR: f64 = 0.002;
pubfnbuild() -> Result<Brep, String> {
let ball = sphere(CENTRE, UP, RADIUS)?;
// 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: a ball's great circle in the plane through the axis and its// centre turned into a torus — here one reaching across the axisclosed(&ball, &path, [0., TURN.to_radians()], BAR, tolerance(ball.size()))
.map_err(|why| format!("the ball's sweep not built: {why:?}"))
}
Time
696 ms; CPU time 695 ms; peak memory 371.2 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
Data
measured
expected
rel. error
volume
59.33319439
59.33319437
3.8e-10
area
75.53287051
75.53287048
4.1e-10
agrees with
cad-kernel, kentron, next.BREP, cadrs, springrep
faces
3 sphere, 3 other
mesh
46812 triangles, closed, 6 degenerate
centre of gravity
(0.328406, 0.568815, -1.6763e-07) its triangles
inertia
about it, of unit density: Ixx 125.268; Iyy 146.611; Izz 166.245; Ixy 18.4839; Iyz 1.96768e-05; Izx -1.64902e-05
not by the harness, which graded the runner's own measures instead: cannot measure: face #490: a loop that does not join up on its surface ((0.0, 6.283185307179586) to (3.1415685863416516, 5.497787143859084))
"""A ball swung about an axis that passes through it. The solid a ball fills as it is swung partway
about an upright line that passes through it.
The ball has radius 2 and its center is (1, 0, 0). It turns rigidly about the z axis, right-handed
(from +x toward +y), by 120°, its center running along an arc of radius 1. Make the solid of
everything the ball passes through.
The ball reaches across the turn's axis, so the tube about its center's arc is a piece of a spindle
torus: it passes through itself on the axis, and its inner part is buried inside the balls at the
two ends."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeSpherefromOCP.gp import gp, gp_Pnt
from sweep import plane, turned, united
CENTRE = (1, 0, 0)
RADIUS = 2TURN = 120# degrees about the z axisdefbuild():
ball = BRepPrimAPI_MakeSphere(gp_Pnt(*CENTRE), RADIUS).Shape()
# A point p of the ball moves with velocity ẑ × p, square to its normal (p − c)/2 where# (ẑ × c)·p = 0: the great circle in the plane y = 0 through the axis and the centre. That# circle crosses the axis, and a curve turned about an axis it crosses sweeps a surface# that passes through itself, which MakeRevol declines: the plane x = 0 through the axis# cuts the ball again where the circle crosses, so that each piece of it lies to one side.
cuts = [plane((0, 0, 0), (0, 1, 0)), plane((0, 0, 0), (1, 0, 0))]
returnunited(turned(ball, gp.OZ_s(), TURN, cuts))
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
56 ms; CPU time 71 ms; peak memory 24.2 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Data
measured
expected
rel. error
volume
59.33319435
59.33319437
3.8e-10
area
75.53287045
75.53287048
4.1e-10
agrees with
cad-kernel, occt, next.BREP, cadrs, springrep
faces
3 other, 2 sphere
mesh
33750 triangles, closed
centre of gravity
(0.328341, 0.568701, 3.17312e-06) its triangles
inertia
about it, of unit density: Ixx 125.235; Iyy 146.579; Izz 166.2; Ixy 18.4837; Iyz 0.00010255; Izx -6.67491e-06
not by the harness, which graded the runner's own measures instead: cannot measure: face #121: a loop that does not join up on its surface ((3.141617154890965, 5.497787143702391) to (6.283185307179586, 4.71238898038469))
//! The solid a ball fills as it is swung about an upright line through it: the ball of radius 2//! about (1, 0, 0), turned rigidly about the z axis by 120°.//!//! kentron's sweep of a solid (`sweep::solid`, one turn), which refuses it: the turn's axis//! passes through the ball, and kentron's sweep refuses a turn about an axis meeting the tool//! (a point on the axis stands still, and the curves where the motion grazes the tool meet there).usecrate::bench::{frame, p};
use kentron::math::{Axis, Direction};
use kentron::primitives::Sphere;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let ball = Sphere::new(2.0).with_frame(frame(p(1.0, 0.0, 0.0), Direction::Z)).build(m)?;
sweep::solid(m, ball, &RigidMotion::Turn { axis: Axis::Z, from: 0.0, to: 120f64.to_radians() })
}
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
92 ms; CPU time 92 ms; peak memory 49.8 MB
Notes
refused the operation failed: SMLib boolean: operation: solidcore: SmApiBoolean: intersect::surface_drop_curve::SurfaceDropCurve::boundary_start_points: the drop found no foot point
//! The solid a ball of radius 2 about (1, 0, 0) fills as it is swung 120° about the z axis,//! right-handed, which passes through it.//!//! solidcraft-kernel has no sweep of a solid, so the swing is built by elementary geometry. The//! ball meets each circle about the z axis in one arc about its point at 0° (the points nearer//! the ball's centre than 2), or holds it whole, so it passes over such an arc where it starts,//! the 120° on from there and the arc where it stops. The sweep is the ball's section by the//! half-plane at 0°, the half of its great disc in the plane y = 0 out from the axis, revolved//! through the turn, with the ball's half behind that plane where it starts (y ≤ 0) and its half//! ahead of it where it stops (each holding what the turn misses of the circles the ball holds//! whole). Joined on their flat faces, the halves meet the revolved disc only there, not//! tangentially along its rim, as whole balls would.usesuper::ball_swung_groove::half_ball;
usesuper::drum_swung_partway_into_ring_sector::turned;
usecrate::solids::*;
use solidcore_record::Seg2;
pubfnbuild() -> R<Body> {
// the great disc's half out from the axis: the arc from (0, −√3) round through (3, 0) to// (0, √3), and the axis back downlet s3 = 3f64.sqrt();
let reach = s3.atan2(-1.0); // the arc's ends' angle about the centre, (0, √3)let section = vec![
Seg2::Arc { center: v2(1.0, 0.0), radius: 2.0, start: -reach, sweep: 2.0 * reach },
Seg2::Line { a: v2(0.0, s3), b: v2(0.0, -s3) },
];
let fan = revolve_z(Region2 { outer: Loop2 { segs: section }, holes: vec![] }, 120.0)?;
let behind = half_ball(v3(1.0, 0.0, 0.0), -Vec3::Y, 2.0)?;
let ahead = turned(&half_ball(v3(1.0, 0.0, 0.0), Vec3::Y, 2.0)?, 120.0)?;
union(&union(&behind, &fan)?, &ahead)
}
// The solid a ball (radius 2, centre (1, 0, 0)) fills as it turns 120° about the z axis.//// A turn about z sweeps the ball where it starts and stops and, between them, its shadow on a// half-plane through the axis revolved: the disc of radius 2 about (1, 0) cut by the axis.let m = model();
let pi = 3.141592653589793;
let s = m.sphere(2.0, #{ at: [1.0, 0.0, 0.0] });
s = s.union(m.tool(|m| m.profile(xz()).path(0.0, -sqrt(3.0)).arc_to([3.0, 0.0], [0.0, sqrt(3.0)]).close()
.sketch("shadow").revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(120.0))));
s = s.union(m.tool(|m| m.sphere(2.0, #{ at: [cos(2.0 * pi / 3.0), sin(2.0 * pi / 3.0), 0.0] })));
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
6.4 ms; CPU time 6 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
59.33319435
59.33319437
3.7e-10
area
75.53287045
75.53287048
4.0e-10
agrees with
cad-kernel, occt, kentron, cadrs, springrep
mesh
38724 triangles, closed, 2 degenerate
centre of gravity
(0.328337, 0.568697, -1.32138e-16) its STEP's solid
inertia
about it, of unit density: Ixx 125.353; Iyy 146.712; Izz 166.365; Ixy 18.4975; Iyz 3.2707e-15; Izx 2.52655e-15
//! The solid a ball fills as it is turned about a line through it.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the ball, a solid of revolution//! about the vertical line through its centre (1, 0, 0), its meridian the half disc of radius 2;//! turned about the z axis from 0° to 120°. The turn's axis passes through the ball, so the kernel//! bounds the sweep by the outer half of its grazing circle turned, the ball's back at the start//! less the ball at the end, and its front at the end less the ball at the start.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{sweep_solid, BrepSolid, OutlinePiece, ScrewStep, SolidMotion, SolidTool};
use std::f64::consts::FRAC_PI_2;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let ball = SolidTool::Revolved {
axis_origin: p(1.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: 2.0, start: -FRAC_PI_2, end: FRAC_PI_2 },
OutlinePiece::Line { from: [0.0, 2.0], to: [0.0, -2.0] },
],
};
let motion = 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: 0.0,
to: 120f64.to_radians(),
};
Ok(sweep_solid(&ball, &motion)?)
}
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.9 ms; CPU time 3.6 ms; peak memory 8.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
59.33319435
59.33319437
3.7e-10
area
75.53287045
75.53287048
4.0e-10
agrees with
cad-kernel, occt, kentron, next.BREP, springrep
mesh
36072 triangles, closed, 6 degenerate
centre of gravity
(0.328337, 0.568697, 1.06066e-17) its STEP's solid
inertia
about it, of unit density: Ixx 125.353; Iyy 146.712; Izz 166.365; Ixy 18.4975; Iyz 5.03795e-16; Izx -5.42668e-16
//! The solid a ball (radius 2 about (1, 0, 0)) fills as it turns 120° about the z axis, which//! passes through it.//!//! The ball is cadrs's sphere primitive; what it passes through is cadrs's sweep of a solid (one//! turn).usecrate::bench::{ball, p3};
usecrate::shared::swept::{swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = ball(k, p3(1.0, 0.0, 0.0), 2.0)?;
swung(k, b, z_axis(), 0.0, 120.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
50 ms; CPU time 50 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
59.33319435
59.33319437
3.7e-10
area
75.53287045
75.53287048
4.0e-10
agrees with
cad-kernel, occt, kentron, next.BREP, cadrs
mesh
36072 triangles, closed, 6 degenerate
centre of gravity
(0.328337, 0.568697, 5.26562e-17) its STEP's solid
inertia
about it, of unit density: Ixx 125.353; Iyy 146.712; Izz 166.365; Ixy 18.4975; Iyz -6.93822e-16; Izx -2.20144e-15
//! The solid a ball of radius 2 centered at (1, 0, 0) fills as it turns 120° about the z axis,//! which passes through it.use springrep::primitive::sphere;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::swept::{deg, turning};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let ball = sphere(&at([1.0, 0.0, 0.0]), 2.0, "ball").map_err(e)?;
solid(&ball, &turning(0.0, deg(120.0)), "swept").map_err(e)
}
geomsolver left no solid to show.
Time
43 ms; CPU time 43 ms; peak memory 23.5 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a ball fills as it is swung partway about an upright line through it: the ball of// radius 2 about (1, 0, 0), turned rigidly 120 degrees about the z axis, right-handed (from +x// toward +y).unit mm
use std
use std.sets
use std.solids
use std.motion (turns)
o := point
fix((1, 0, 0)) o
ball := solid(std.sets.Ball(o, r: 2mm))
swing := frame
swing turns(1) std.z
part := solid({ p | some t in (0deg, 120deg): p in ball at(under: swing) t })
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 4.8 MB
Notes
refused not supported yet: combining solids with a horn or spindle torus face (one whose tube reaches its axis)
//! What a ball of radius 2 about (1, 0, 0) fills as it turns 120° about the z axis, which passes//! through it.use anvil_brep::Solid;
use anvil_brep::profile::Segment;
usecrate::shared::{ball, line, swung, turn_z, union, v2};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. The ball turned about an axis through it fills the// revolve of what it covers in a half-plane through the axis: at each height every distance// from the axis out to the ball's farthest, which is its disk on the half-plane's side of the// axis (its arc from the axis round to the axis, and the axis between); and itself where it// starts and stopslet a = (1f64 / 2.).acos();
let fan = swung(
vec![
Segment::Arc { center: v2(1., 0.), radius: 2., start: -(std::f64::consts::PI - a), sweep: 2. * (std::f64::consts::PI - a) },
line(v2(0., 3f64.sqrt()), v2(0., -3f64.sqrt())),
],
0.,
120.,
)?;
let b = ball([1., 0., 0.], 2.)?;
union(&union(&fan, &b)?, &b.transformed(&turn_z(120.)))
}