The solid a ring fills as it slides across, square to its own axis, by less than the width of its hole.
The ring is a torus about the z axis centered on the origin: the circle through its tube's centers has radius 6, and its tube has radius 2.
It slides without turning along the x axis by 6, ending centered on (6, 0, 0). Make the solid of everything the ring passes through.
The torus's top and bottom circles stay in their planes and sweep flat faces. Its hole is never filled: what is left of it, all the way through, is the lens the hole shares where the ring starts and where it stops, walled by the inner halves of the torus at those two places, which meet along two curves.
expected
closed form
volume
1031.876235
no closed form: next.BREP and cad-kernel agree to 4e-9; the mean of their values
area
748.6578177
no closed form: next.BREP and cad-kernel agree to 4e-9; 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
298 ms; CPU time 784 ms; peak memory 25 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 ring fills slid without turning 6 along x, square to its own axis — less than its//! hole is wide: the torus about the z axis centred on the origin, of radii 6 and 2.use cad_kernel::build::torus;
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::TAU;
constMAJOR: f64 = 6.;
constMINOR: f64 = 2.;
constSLIDE: f64 = 6.;
/// How closely the ring is meshed for the sweep's membership reads: a hundredth of its tube's/// radius.constBAR: f64 = 0.02;
pubfnbuild() -> Result<Brep, String> {
let ring = torus([0., 0., 0.], [0., 0., 1.], MAJOR, MINOR)?;
// the slide along x: a screw that does not turn, advancing its whole length over a roll of τlet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: [1., 0., 0.], ratio: 0., advance: SLIDE,
});
// the kernel's closed swept solid: a torus slid square to its axis, its top and bottom circles// kept in their planes, its meridians square to the slide swept into cylinders along itclosed(&ring, &path, [0., TAU], BAR, tolerance(ring.size()))
.map_err(|why| format!("the ring's sweep not built: {why:?}"))
}
Time
1.15 s; CPU time 1.15 s; peak memory 375.6 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 ring lying flat, slid across less than its hole. The solid a ring fills as it slides across,
square to its own axis, by less than the width of its hole.
The ring is a torus about the z axis centered on the origin: the circle through its tube's centers
has radius 6, and its tube has radius 2.
It slides without turning along the x axis by 6, ending centered on (6, 0, 0). Make the solid of
everything the ring passes through.
The torus's top and bottom circles stay in their planes and sweep flat faces. Its hole is never
filled: what is left of it, all the way through, is the lens the hole shares where the ring starts
and where it stops, walled by the inner halves of the torus at those two places, which meet along
two curves."""import math
fromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeFacefromOCP.BRepPrimAPIimportBRepPrimAPI_MakeTorusfromOCP.gp import gp, gp_Ax3, gp_Cylinder
from sweep import plane, slid, united
RING, TUBE = 6, 2# the radius of the circle through the tube's centres, and the tube'sSLIDE = (6, 0, 0)
defbuild():
ring = BRepPrimAPI_MakeTorus(gp.XOY_s(), RING, TUBE).Shape()
# At the point of the tube's circle turned u about the z axis and v round the tube, the# torus's normal is cos v·(cos u, sin u, 0) + sin v·ẑ, square to the slide (x) where# cos v·cos u = 0: on its two circles in the plane x = 0 through its axis, and on its top# and bottom circles, of radius 6 at z = ±2, where the cylinder of radius 6 cuts it.
cylinder = BRepBuilderAPI_MakeFace(gp_Cylinder(gp_Ax3(gp.XOY_s()), RING),
0, 2 * math.pi, -2 * TUBE, 2 * TUBE).Face()
returnunited(slid(ring, SLIDE, [plane((0, 0, 0), (1, 0, 0)), cylinder]))
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
265 ms; CPU time 400 ms; peak memory 24.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 ring fills as it slides across, square to its own axis, by less than the width of//! its hole: the torus about the z axis centred on the origin, radii 6 and 2, slid without turning//! along the x axis by 6.//!//! kentron's sweep of a solid (`sweep::solid`, one slide).usecrate::bench::v;
use kentron::primitives::Torus;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let ring = Torus::new(6.0, 2.0).build(m)?;
sweep::solid(m, ring, &RigidMotion::Slide { by: v(6.0, 0.0, 0.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.
Time
859 ms; CPU time 859 ms; peak memory 55.5 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.
//! The solid a ring fills as it slides without turning along x by 6: the torus about the z axis//! centred on the origin, the circle through its tube's centres of radius 6, its tube of radius 2.//!//! solidcraft-kernel has no sweep of a solid, so the ring's sweep is built by elementary geometry,//! level by level. At height z the ring is an annulus, radii 6 ∓ √(4 − z²). A point the annulus's//! outer disc slid over is missed by the annulus only if its whole path back lies in the hole://! being a disc, if it lies in the hole where the ring starts and where it stops. So the sweep is//! what the ring with its hole filled sweeps (as in `ring-slid-flat-past-its-hole`) less the lens//! the hole shares at its two places. The slide, 6, is less than the hole's width, 8 at the//! least, so the lens runs all the way through. The hole is the revolve of its half section, here//! carried on to z = ±3 as the cylinder of radius 6, past the ring's flat top and bottom, so that//! the lens is cut through them.usesuper::ring_slid_flat_past_its_hole::filled_slid;
usecrate::solids::*;
use solidcore_record::Seg2;
use std::f64::consts::{FRAC_PI_2, PI, TAU};
/// The ring's hole about the vertical line through (`x`, 0), carried on to z = ±3.fnhole(x: f64) -> R<Body> {
// the half section in (r, z): in to the tube's inner halflet segs = vec![
Seg2::Line { a: v2(0.0, -3.0), b: v2(6.0, -3.0) },
Seg2::Line { a: v2(6.0, -3.0), b: v2(6.0, -2.0) },
Seg2::Arc { center: v2(6.0, 0.0), radius: 2.0, start: -FRAC_PI_2, sweep: -PI },
Seg2::Line { a: v2(6.0, 2.0), b: v2(6.0, 3.0) },
Seg2::Line { a: v2(6.0, 3.0), b: v2(0.0, 3.0) },
Seg2::Line { a: v2(0.0, 3.0), b: v2(0.0, -3.0) },
];
let plane = Plane { origin: v3(x, 0.0, 0.0), x: Vec3::X, y: Vec3::Z };
let section = Region2 { outer: Loop2 { segs }, holes: vec![] };
one(solidcraft_kernel::revolve(&plane, &[section], Vec2::ZERO, Vec2::Y, TAU)?)
}
pubfnbuild() -> R<Body> {
let lens = common(&hole(0.0)?, &hole(6.0)?)?;
cut(&filled_slid(6.0)?, &lens)
}
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
2.71 s; CPU time 2.71 s; peak memory 74.6 MB
Notes
refused FeatureFailed at ring_slid_flat_short_of_its_hole.rhai:17:7: feature 'boolean-1' (boolean) failed: result validation failed: cellular result invalid: Half-edge HalfEdgeHandle(65v1) in loop LoopHandle(9v1) ends at VertexHandle(5v1) but its successor HalfEdgeHandle(67v1) starts at VertexHandle(1v1)
// The solid a torus about z (middle radius 6, tube 2) fills as it slides along x by 6.//// The torus with its hole filled (everything within 6 + √(4 - z²) of the z axis) is convex: it// sweeps itself where it starts and stops and, between them, its section in the plane x = 0// carried along the slide. Of the hole, what no place of the ring covers is what the holes where it// starts and where it stops share (each everything within 6 - √(4 - z²) of the ring's axis).let m = model();
fnfilled(m, x) {
m.profile(xz()).path(0.0, -2.0).line_to(6.0, -2.0).arc_to([8.0, 0.0], [6.0, 2.0]).line_to(0.0, 2.0).close()
.sketch("filled").revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), full_circle()).translate(x, 0.0, 0.0)
}
fnhole(m, x) {
m.profile(xz()).path(0.0, -2.0).line_to(6.0, -2.0).arc_to([4.0, 0.0], [6.0, 2.0]).line_to(0.0, 2.0).close()
.sketch("hole").revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), full_circle()).translate(x, 0.0, 0.0)
}
let s = filled(m, 0.0);
s = s.union(m.tool(|m| filled(m, 6.0)));
s = s.union(m.tool(|m| m.profile(yz()).path(-6.0, -2.0).line_to(6.0, -2.0).arc_to([8.0, 0.0], [6.0, 2.0])
.line_to(-6.0, 2.0).arc_to([-8.0, 0.0], [-6.0, -2.0]).close().sketch("section").extrude(blind(6.0))));
s = s.subtract(m.tool(|m| hole(m, 0.0).intersect(m.tool(|m| hole(m, 6.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
21 ms; CPU time 21 ms; peak memory 12.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 solid a ring fills as it slides 6 along x, square to its axis, less than its hole's width://! the torus about the z axis centred on the origin, the circle through its tube's centres of//! radius 6, its tube of radius 2.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the ring, a solid of revolution//! about the z axis whose meridian is the circle of radius 2 about the point 6 from the axis, slid//! 6 along x.usecrate::solids::p;
usecrate::solids::swept::{revolved_tool, slide_by, Piece};
usecrate::Refusal;
use brep_kernel::{sweep_solid, BrepSolid};
use std::f64::consts::{TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let (x, z) = (p(1.0, 0.0, 0.0), p(0.0, 0.0, 1.0));
let ring = revolved_tool(p(0.0, 0.0, 0.0), z, x, &[
Piece::Arc { centre: [6.0, 0.0], radius: 2.0, start: 0.0, end: TAU },
]);
Ok(sweep_solid(&ring, &slide_by(p(6.0, 0.0, 0.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
19 ms; CPU time 40 ms; peak memory 12.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.
//! The solid a ring (the torus about the z axis centered on the origin, radii 6 and 2) fills as it//! slides 6 along x, less than the width of its hole.//!//! The ring is cadrs's torus primitive; what it passes through is cadrs's sweep of a solid (one//! slide).usecrate::bench::{p3, torus, v3};
usecrate::shared::swept::slid;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let ring = torus(k, p3(0.0, 0.0, 0.0), v3(0.0, 0.0, 1.0), 6.0, 2.0)?;
slid(k, ring, v3(6.0, 0.0, 0.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
106 ms; CPU time 106 ms; peak memory 9.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.
//! The solid a ring fills as it slides 6 along x: the torus about the z axis, its tube's centers//! 6 from it and its tube of radius 2.use springrep::math::Frame;
use springrep::primitive::torus;
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::v3;
pubfnbuild() -> Result<Brep, String> {
let ring = torus(&Frame::WORLD, 6.0, 2.0, "ring").map_err(e)?;
solid(&ring, &Motion::Slide(v3(6.0, 0.0, 0.0)), "slide").map_err(e)
}
geomsolver left no solid to show.
Time
43 ms; CPU time 43 ms; peak memory 23.1 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a ring lying flat fills as it slides across by less than the width of its hole. The// ring is a torus about the z axis, its tube (radius 2) 6 from the axis on z = 0: the tube's circle// drawn in the front plane and turned about z. The part is the kernel's sweep of the ring as it// slides 6 along +x without turning.unit mm
use std
use std.solids
use std.place (vertical, right_of)
use std.motion (slides)
in std.front {
construction centerline spindle := vertical line(std.origin, hint((0, 1)))
length(1mm) spindle
private tc := point hint((6, 0))
tc right_of(d: 6mm) std.origin
private tube := circle(center: tc) hint(r: 2)
radius(2mm) tube
}
constructionring := solid(std.solids.Revolution(face(tube), about: spindle))
// the slide: 6 along x over the roll's one turn
carriage := frame
carriage slides(6mm) std.x
part := solid({ p | some t in (0deg, 360deg): p inringat(under: carriage) t })
anvilcad left no solid to show.
Time
133 ms; CPU time 133 ms; peak memory 5.7 MB
Notes
refused boolean operation failed: face split did not close
//! What a torus about the z axis (middle circle 6, tube 2) fills as it slides 6. along x without//! turning, less than its hole is wide.use anvil_brep::{Frame, Solid, extrude};
usecrate::shared::{at, cylinder, e, intersect, region, rod, stadium, subtract, torus, unite_all};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. A torus slid in its own plane is the tube of radius 2// about what its middle circle sweeps: the flat stadium within 6 of the slide's segment less the lens inside the middle circle at both ends, which it never reaches, so// the slab of that region 2 thick, the torus at each end, and a rod of radius 2 along each of// the stadium's straight sideslet d = 6.;
let stadium = region(&[stadium((0., 0.), (d, 0.), 6.)])?;
letmut slab = extrude::extrude(&Frame::world(), &stadium, -2., 2.).map_err(e)?;
// the lens the middle circle never reaches: inside it at both endslet w = Frame::world();
let lens = intersect(&cylinder(&w, 6., -3., 3.)?, &cylinder(&at([d, 0., 0.]), 6., -3., 3.)?)?;
slab = subtract(&slab, &lens)?;
// each joined to what is built so far, which it overlapslet pieces = [
torus(&at([0., 0., 0.]), 6., 2.),
torus(&at([d, 0., 0.]), 6., 2.),
rod([0., -6., 0.], [d, -6., 0.], 2.),
rod([0., 6., 0.], [d, 6., 0.], 2.),
];
unite_all(slab, pieces)
}