The solid a ring fills as it slides across, square to its own axis, farther 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 15, ending centered on (15, 0, 0). Make the solid of everything the ring passes through.
The torus's top and bottom circles, of radius 6 at z = ±2, stay in their planes as it slides, so each sweeps a flat face: the region within 6 of the segment from (0, 0) to (15, 0). The slide is longer than the hole is wide, so the hole is filled; the inner half of the torus touches nowhere.
† 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
164 ms; CPU time 380 ms; 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
1631.265729
1631.265729
2.8e-16
area
1061.826218
1061.826218
4.3e-16
agrees with
occt, kentron, solidcraft, next.BREP, cadrs
mesh
26856 triangles, closed
centre of gravity
(7.5, 0, 2.17789e-17) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy 7.27596e-12; Iyz -0; Izx 3.84581e-13
//! The solid a ring fills slid without turning 15 along x, square to its own axis — farther 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 = 15.;
/// 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
856 ms; CPU time 855 ms; peak memory 373.8 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.
Data
its STEP's
expected
rel. error
volume
1631.265729
1631.265729
5.8e-11
area
1061.826218
1061.826218
1.3e-10
agrees with
cad-kernel, kentron, solidcraft, next.BREP, cadrs
mesh
27364 triangles, closed
centre of gravity
(7.5, -6.30716e-15, -1.64073e-10) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy 2.72848e-12; Iyz -4.88853e-12; Izx -1.35974e-06
"""A ring lying flat, slid across farther than its hole. The solid a ring fills as it slides
across, square to its own axis, farther 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 15, ending centered on (15, 0, 0). Make the solid of
everything the ring passes through.
The torus's top and bottom circles, of radius 6 at z = ±2, stay in their planes as it slides, so
each sweeps a flat face: the region within 6 of the segment from (0, 0) to (15, 0). The slide is
longer than the hole is wide, so the hole is filled; the inner half of the torus touches nowhere."""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 = (15, 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
109 ms; CPU time 154 ms; peak memory 16.2 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
1631.265729
1631.265729
1.4e-16
area
1061.826218
1061.826218
4.3e-16
agrees with
cad-kernel, occt, solidcraft, next.BREP, cadrs
mesh
17152 triangles, closed
centre of gravity
(7.5, 2.09077e-16, 1.74231e-17) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy -4.68103e-12; Iyz -1.8889e-13; Izx -1.58462e-29
//! The solid a ring fills as it slides across, square to its own axis, farther 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 15.//!//! 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(15.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
313 ms; CPU time 313 ms; peak memory 53.7 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.
Data
its STEP's
expected
rel. error
volume
1631.265729
1631.265729
1.1e-15
area
1061.826218
1061.826218
2.1e-16
agrees with
cad-kernel, occt, kentron, next.BREP, cadrs
mesh
16636 triangles, closed
centre of gravity
(7.5, 8.36309e-16, 1.60293e-15) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy 3.18323e-12; Iyz -1.08002e-12; Izx -2.34195e-11
//! The solid a ring fills as it slides without turning along x by 15: 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 its outer//! disc slides over is missed by the annulus only if the point's whole path back, 15 long, lies//! in the hole, at most 12 wide: never. So the ring sweeps what the ring with its hole filled//! sweeps. That filled ring is convex, the revolve of its half section. Split by the plane x = 0//! through its axis, square to the slide, its back half leads with its flat cut face only (its//! round faces back, its flat top and bottom move in their own planes), so it sweeps itself and//! that section slid 15; its front half likewise sweeps the section and itself where it stops.usecrate::solids::*;
use solidcore_record::Seg2;
use std::f64::consts::{FRAC_PI_2, PI, TAU};
/// The half of the ring centred on (`x`, 0, 0), its hole filled, on the side `outward` points to.fnhalf_filled(x: f64, outward: Vec3) -> R<Body> {
// the half section in (r, z): out to the tube's outer halflet segs = vec![
Seg2::Line { a: v2(0.0, -2.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(0.0, 2.0) },
Seg2::Line { a: v2(0.0, 2.0), b: v2(0.0, -2.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![] };
let filled = one(solidcraft_kernel::revolve(&plane, &[section], Vec2::ZERO, Vec2::Y, TAU)?)?;
let cap = Plane::from_normal(plane.origin, outward)
.ok_or_else(|| KernelError::Invalid("the half ring's direction".into()))?;
solidcraft_kernel::half_space(&filled, &cap, true)?
.0
.ok_or_else(|| KernelError::Failed("the half ring is empty".into()))
}
/// What the ring with its hole filled sweeps as it slides along x by `slide`: its back half where/// it starts, its section through the axis on x = 0 extruded along x, and its front half where it/// stops.pubfnfilled_slid(slide: f64) -> R<Body> {
// the section in (y, z): within 2 of the segment from (−6, 0) to (6, 0), the flat betweenlet segs = vec![
Seg2::Line { a: v2(-6.0, -2.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, 2.0) },
Seg2::Arc { center: v2(-6.0, 0.0), radius: 2.0, start: FRAC_PI_2, sweep: PI },
];
let plane = Plane { origin: Vec3::ZERO, x: Vec3::Y, y: Vec3::Z };
letmut swept = extrude(&plane, Region2 { outer: Loop2 { segs }, holes: vec![] }, 0.0, slide)?;
swept = union(&swept, &half_filled(0.0, -Vec3::X)?)?;
union(&swept, &half_filled(slide, Vec3::X)?)
}
pubfnbuild() -> R<Body> {
filled_slid(15.0)
}
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
10.3 s; CPU time 14.0 s; peak memory 380.2 MB
Notes
refused FeatureFailed at ring_slid_flat_past_its_hole.rhai:13:7: feature 'boolean-2' (boolean) failed: result validation failed: cellular result invalid: Half-edge HalfEdgeHandle(16v1) in loop LoopHandle(5v1) ends at VertexHandle(5v1) but its successor HalfEdgeHandle(22v1) starts at VertexHandle(7v1)
// The solid a torus about z (middle radius 6, tube 2) fills as it slides along x by 15.//// 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. The slide is wider than the hole, so nothing of it is left.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)
}
let s = filled(m, 0.0);
s = s.union(m.tool(|m| filled(m, 15.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(15.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
102 ms; CPU time 101 ms; peak memory 20.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
1631.265729
1631.265729
0.0e+00
area
1061.826218
1061.826218
2.1e-16
agrees with
cad-kernel, occt, kentron, solidcraft, cadrs
mesh
46442 triangles, closed, 2 degenerate
centre of gravity
(7.5, -2.7877e-16, -7.23113e-17) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy 1.81899e-12; Iyz -2.65852e-14; Izx -9.78861e-14
//! Everything a ring passes through as it slides without turning by 15 along x: 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.//!//! next.BREP has no sweep of a solid along a line. A wheel slid square to its axis farther than its//! hole is wide follows by elementary geometry (`solids::sweep::torus_slid_up`, proved there): the//! wheel with its hole filled where it starts and where it stops, and between them its outline//! seen along the slide slid from the start to the stop. That helper slides a wheel whose axis is//! along y up the z axis; the rotation (x, y, z) ↦ (z, x, y) carries its axis onto z and its slide//! onto x.usecrate::solids::p;
usecrate::solids::sweep::{moved, torus_slid_up};
usecrate::Refusal;
use brep_kernel::{AffineTransform, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let onto = AffineTransform::new([
0.0, 0.0, 1.0, 0.0, //1.0, 0.0, 0.0, 0.0, //0.0, 1.0, 0.0, 0.0, //0.0, 0.0, 0.0, 1.0,
])?;
letmut parts = Vec::new();
for part intorus_slid_up(p(0.0, 0.0, 0.0), 6.0, 2.0, 15.0)? {
parts.push(moved(&part, onto)?);
}
letmut whole = parts[0].clone();
for part in &parts[1..] {
whole = crate::solids::fillet::union(&whole, part)?;
}
Ok(whole)
}
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
6 ms; CPU time 8.1 ms; peak memory 10.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
1631.265729
1631.265729
1.4e-16
area
1061.826218
1061.826218
2.1e-16
agrees with
cad-kernel, occt, kentron, solidcraft, next.BREP
mesh
16636 triangles, closed
centre of gravity
(7.5, -2.7877e-16, -1.54944e-16) its STEP's solid
inertia
about it, of unit density: Ixx 30076.5; Iyy 105301; Izz 131347; Ixy 1.81899e-12; Iyz -4.87234e-13; Izx 6.08228e-14
//! The solid a ring (the torus about the z axis, radii 6 and 2) fills as it slides along the x axis//! by 15, farther than its hole is wide.//!//! 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(15.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.
springrep left no solid to show.
Time
46 ms; CPU time 45 ms; peak memory 9 MB
Notes
refused invalid result: the 4 faces round the edge through (0.000014, 6.000000, 2.000000) do not pair off
//! The solid a ring fills as it slides 15 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(15.0, 0.0, 0.0)), "slide").map_err(e)
}
geomsolver left no solid to show.
Time
45 ms; CPU time 45 ms; peak memory 23.3 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 farther than 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 15// 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: 15 along x over the roll's one turn
carriage := frame
carriage slides(15mm) std.x
part := solid({ p | some t in (0deg, 360deg): p inringat(under: carriage) t })
anvilcad left no solid to show.
Time
43 ms; CPU time 43 ms; peak memory 5.2 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 15. along x without//! turning, farther than its hole is wide.use anvil_brep::{Frame, Solid, extrude};
usecrate::shared::{at, e, region, rod, stadium, 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, 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 = 15.;
let stadium = region(&[stadium((0., 0.), (d, 0.), 6.)])?;
let slab = extrude::extrude(&Frame::world(), &stadium, -2., 2.).map_err(e)?;
// 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)
}