The solid a rod fills as it is spun partway about an upright line that passes through it.
The rod is a solid cylinder of radius 0.5 whose axis is the x axis, from x = −3 to x = 5, its ends flat. The z axis crosses it square to its axis.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 120°. Make the solid of everything the rod passes through.
The turn's axis crosses the rod's. Every circle of the rod about its own axis touches at its top and bottom points, z = ±0.5, except the one at x = 0, which the turn moves along the rod's own axis and which touches all round: there the two roots cross. The rod's two arms sweep two fans, of radii 5 and 3, that meet about the axis.
expected
closed form
volume
41.68570617
no closed form: next.BREP and cadrs agree to 6e-9; the mean of their values
area
111.3502616
no closed form: next.BREP and cadrs agree to 7e-9; 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
278 ms; CPU time 682 ms; peak memory 20.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 rod fills turned 120° about the z axis, which crosses it: the solid cylinder of//! radius 0.5 about the x axis from x = −3 to 5.//!//! The kernel's closed sweep (`swept::closed::closed`) takes the rod whole. Its closed class//! refuses it (`Unbuilt::Curved` at the centre of the rod's end at x = −3): under a turn a sharp//! circle leaning to the axis is turned into its ring, and the rod's end rims, square to a radius,//! have their normal in the plane through the turn's axis and their centre, which turns into no//! ring the kernel reads (`turned::Rim::simple`); and the turn's axis crosses the rod's within its//! side, where it would refuse the cylinder's contact too. Since 0.10.0 such a tool goes the//! contact's road — each sheet on the surface of revolution of its section's meridian, 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::{disc, prism};
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
constRADIUS: f64 = 0.5;
constTURN: f64 = 120f64.to_radians();
/// How closely the rod is meshed for the sweep's membership reads: a hundredth of its radius.constBAR: f64 = 0.005;
pubfnbuild() -> Result<Brep, String> {
let rod = prism(&disc([-3., 0., 0.], [1., 0., 0.], RADIUS), 0., 8.)?;
// the turn about z: a screw that does not advance, turning a radian a radian of the rolllet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: [0., 0., 1.], ratio: 1., advance: 0.,
});
// the kernel's closed swept solid: a cylinder about an axis square to the turn's, which the// turn's axis crosses within the faceclosed(&rod, &path, [0., TURN], BAR, tolerance(rod.size()))
.map_err(|why| format!("the rod's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
840 ms; CPU time 839 ms; peak memory 372.8 MB
Notes
refused BRepAlgoAPI_Fuse declined the tool and what its faces sweep
"""A rod spun partway about a line through it. The solid a rod fills as it is spun partway about an
upright line that passes through it.
The rod is a solid cylinder of radius 0.5 whose axis is the x axis, from x = −3 to x = 5, its ends
flat. The z axis crosses it square to its axis.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 120°. Make the solid of
everything the rod passes through.
The turn's axis crosses the rod's. Every circle of the rod about its own axis touches at its top
and bottom points, z = ±0.5, except the one at x = 0, which the turn moves along the rod's own axis
and which touches all round: there the two roots cross. The rod's two arms sweep two fans, of radii
5 and 3, that meet about the axis."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeCylinderfromOCP.gp import gp, gp_Ax2, gp_Pnt
from sweep import plane, turned, united
RADIUS, NEAR, FAR = 0.5, -3, 5# the rod, along the x axisTURN = 120# degrees about the z axisdefbuild():
rod = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(NEAR, 0, 0), gp.DX_s()), RADIUS,
FAR - NEAR).Shape()
# The rod's axis meets the turn's, at the origin. At the point (x, ½ cos t, ½ sin t) of its# side, its normal (0, cos t, sin t) is square to the velocity ẑ × p = (−½ cos t, x, 0) where# x cos t = 0: along its lines in the plane y = 0 through both axes (top and bottom), and# all round its circle at x = 0, where the turn moves it along the rod's own axis. Its flat# ends meet the turn square-on along the plane y = 0 too.
cuts = [plane((0, 0, 0), (0, 1, 0)), plane((0, 0, 0), (1, 0, 0))]
returnunited(turned(rod, 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
34 ms; CPU time 36 ms; peak memory 13.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 rod fills as it is spun partway about an upright line through it: the solid//! cylinder of radius 0.5 about the x axis from x = −3 to x = 5, 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 rod, and kentron's sweep refuses a turn about an axis meeting the tool.usecrate::bench::{frame, p};
use kentron::math::{Axis, Direction};
use kentron::primitives::Cylinder;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let rod = Cylinder::new(0.5, 8.0).with_frame(frame(p(-3.0, 0.0, 0.0), Direction::X)).build(m)?;
sweep::solid(m, rod, &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.
Time
918 ms; CPU time 918 ms; peak memory 55.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.
//! The solid a rod fills as it is spun 120° about the z axis, right-handed: the solid cylinder of//! radius 0.5 about the x axis from x = −3 to 5, which the z axis crosses.//!//! solidcraft-kernel has no sweep of a solid, so the turn is built by elementary geometry. At//! height z the rod is the rectangle −3 ≤ x ≤ 5, |y| ≤ w, w = √(0.5² − z²). It holds each circle//! about the z axis out to w whole, and meets each farther one in an arc about its point at 0°,//! out to the arm's end at 5, or about its point at 180°, out to 3; and beyond the ends, out to//! the far corners, √(5² + w²) and √(3² + w²), in two arcs beside the corners, a few degrees//! apart. That gap is far narrower than the turn, so the rod passes over all the rod filled out//! to the spheres about the origin through its end rims does: K′, the rod with its ends//! capped by the spheres of radii √(5² + 0.5²) and √(3² + 0.5²) instead of flat, which meets every//! circle in an arc about its point at 0°, one about 180°, or both, or holds it whole. Turned by//! 120°, an arc about 0° is passed over where K′ starts, the 120° on from 0°, and where it stops; one about//! 180°, likewise from 180°. So the sweep is K′'s section by the half-plane at 0° revolved from 0°//! to 120°, its section by the half-plane at 180° revolved from 180° to 300°, and K′ where it//! starts and where it stops, each by the quarters beyond those half-planes: behind them where it//! starts, ahead of them where it stops (holding what the turn misses of the circles K′ holds//! whole). Joined on their flat faces, the quarters meet the revolved sections only there.usesuper::drum_swung_partway_into_ring_sector::turned;
usecrate::solids::*;
use solidcore_record::Seg2;
use std::f64::consts::{PI, TAU};
/// The arm's section in x and z, out from the axis to the sphere through its end rim at `end`.fnarm(end: f64) -> Region2 {
let far = (end * end + 0.25).sqrt();
let reach = 0.5f64.atan2(end);
let segs = vec![
Seg2::Line { a: v2(0.0, -0.5), b: v2(end, -0.5) },
Seg2::Arc { center: v2(0.0, 0.0), radius: far, start: -reach, sweep: 2.0 * reach },
Seg2::Line { a: v2(end, 0.5), b: v2(0.0, 0.5) },
Seg2::Line { a: v2(0.0, 0.5), b: v2(0.0, -0.5) },
];
Region2 { outer: Loop2 { segs }, holes: vec![] }
}
/// The quarter of `body` on the given sides of the planes x = 0 and y = 0.fnquarter(body: &Body, x_positive: bool, y_positive: bool) -> R<Body> {
let part = |b: &Body, plane: Plane, positive| -> R<Body> {
solidcraft_kernel::half_space(b, &plane, positive)?
.0
.ok_or_else(|| KernelError::Failed("the rod's quarter is empty".into()))
};
let across_x = Plane { origin: Vec3::ZERO, x: Vec3::Y, y: Vec3::Z }; // normal +xlet across_y = Plane { origin: Vec3::ZERO, x: Vec3::Z, y: Vec3::X }; // normal +ypart(&part(body, across_x, x_positive)?, across_y, y_positive)
}
pubfnbuild() -> R<Body> {
// K′, revolved about the x axis: its section above the axis in x and z, from the far end of// the arm along +x round to the far end of the otherlet (long, short) = ((25.25f64).sqrt(), (9.25f64).sqrt());
let section = vec![
Seg2::Line { a: v2(-short, 0.0), b: v2(long, 0.0) },
Seg2::Arc { center: v2(0.0, 0.0), radius: long, start: 0.0, sweep: 0.5f64.atan2(5.0) },
Seg2::Line { a: v2(5.0, 0.5), b: v2(-3.0, 0.5) },
Seg2::Arc { center: v2(0.0, 0.0), radius: short, start: PI - 0.5f64.atan2(3.0), sweep: 0.5f64.atan2(3.0) },
];
let section = Region2 { outer: Loop2 { segs: section }, holes: vec![] };
let filled = one(solidcraft_kernel::revolve(&xz(), &[section], Vec2::ZERO, Vec2::X, TAU)?)?;
// the sections by the half-planes at 0° and at 180° (drawn at 0° and turned half a turn)let ahead_of_0 = revolve_z(arm(5.0), 120.0)?;
let ahead_of_180 = turned(&revolve_z(arm(3.0), 120.0)?, 180.0)?;
let pieces = [
quarter(&filled, true, false)?,
ahead_of_0,
quarter(&filled, false, true)?,
ahead_of_180,
turned(&quarter(&filled, true, true)?, 120.0)?,
turned(&quarter(&filled, false, false)?, 120.0)?,
];
letmut swept = pieces[0].clone();
for piece in &pieces[1..] {
swept = union(&swept, piece)?;
}
Ok(swept)
}
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
229 ms; CPU time 564 ms; peak memory 31.9 MB
Notes
refused FeatureFailed at rod_spun_about_a_line_through_it.rhai:14:7: feature 'boolean-2' (boolean) failed: result validation failed: cellular result invalid: Half-edge HalfEdgeHandle(53v1) in loop LoopHandle(7v1) ends at VertexHandle(9v1) but its successor HalfEdgeHandle(35v1) starts at VertexHandle(2v1)
// The solid a rod (radius 0.5 about the x axis, x = -3 to 5) fills as it turns 120° about the z// axis.//// A turn about z sweeps the rod where it starts and stops and, between them, each arm's shadow on// a half-plane through the axis revolved: the arm along +x reaches √(25.25 - z²) from the origin at// height z (its far rim's corners), a zone of a sphere, and the arm along -x √(9.25 - z²); the -x// arm's shadow turns from 180° to 300°.let m = model();
let fan = |m, r| m.profile(xz()).path(0.0, -0.5).line_to(sqrt(r * r - 0.25), -0.5)
.arc_to([r, 0.0], [sqrt(r * r - 0.25), 0.5]).line_to(0.0, 0.5).close().sketch("fan")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(120.0));
let s = m.cylinder(0.5, 8.0, #{ at: [-3.0, 0.0, 0.0], axis: [1.0, 0.0, 0.0], ref: [0.0, 1.0, 0.0] });
s = s.union(m.tool(|m| fan.call(m, sqrt(25.25))));
s = s.union(m.tool(|m| fan.call(m, sqrt(9.25)).rotate(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), 180.0)));
s = s.union(m.tool(|m| m.cylinder(0.5, 8.0, #{ at: [-3.0, 0.0, 0.0], axis: [1.0, 0.0, 0.0], ref: [0.0, 1.0, 0.0] })
.rotate(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), 120.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
94 ms; CPU time 93 ms; peak memory 21.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.
//! Everything a rod passes through as it turns rigidly about the z axis by 120°, right-handed: the//! solid cylinder of radius 0.5 about the x axis from x = −3 to x = 5, its ends flat.//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the rod, a solid of revolution//! about the x axis whose meridian is the rectangle out to radius 0.5 from x = −3 to x = 5, turned//! 120° about the z axis.usecrate::solids::p;
usecrate::solids::swept::{revolved_tool, turn_about_z, Piece};
usecrate::Refusal;
use brep_kernel::{sweep_solid, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let rod = revolved_tool(p(-3.0, 0.0, 0.0), p(1.0, 0.0, 0.0), p(0.0, 0.0, 1.0), &[
Piece::Line { from: [0.0, 0.0], to: [0.5, 0.0] },
Piece::Line { from: [0.5, 0.0], to: [0.5, 8.0] },
Piece::Line { from: [0.5, 8.0], to: [0.0, 8.0] },
Piece::Line { from: [0.0, 8.0], to: [0.0, 0.0] },
]);
Ok(sweep_solid(&rod, &turn_about_z(0.0, 120f64.to_radians(), 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
49 ms; CPU time 103 ms; peak memory 12.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.
//! The solid a rod (radius 0.5 about the x axis from x = −3 to 5) fills as it turns 120° about//! the z axis, which crosses it.//!//! The rod is a circle extruded; what it passes through is cadrs's sweep of a solid (one turn).usecrate::bench::{cylinder, p3, v3};
usecrate::shared::swept::{swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let rod = cylinder(k, p3(-3.0, 0.0, 0.0), v3(1.0, 0.0, 0.0), 0.5, 8.0)?;
swung(k, rod, 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
81 ms; CPU time 80 ms; peak memory 9.1 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 the rod of radius 0.5 about the x axis from x = −3 to 5 fills as it turns 120° about//! the z axis.use springrep::math::{Frame, Vec3};
use springrep::primitive::cylinder;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, turning, v3};
pubfnbuild() -> Result<Brep, String> {
let end = Frame::new(v3(-3.0, 0.0, 0.0), Vec3::X, Vec3::Y).map_err(e)?;
let rod = cylinder(&end, 0.5, 8.0, "rod").map_err(e)?;
solid(&rod, &turning(0.0, deg(120.0)), "spin").map_err(e)
}
geomsolver left no solid to show.
Time
41 ms; CPU time 41 ms; peak memory 22.4 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a rod fills as it is spun partway about an upright line through it. The rod is a// cylinder of radius 0.5 about the x axis from x = -3 to 5: its circle drawn in the side plane// (y, z), whose normal is +x, and the prism over it from -3 to 5 along that normal. The part is// the kernel's sweep of the rod turned right-handed about z through 120 degrees.unit mm
use std
use std.solids
use std.motion (turns)
in std.side {
private o := point
fix((0, 0)) o
private rim := circle(center: o) hint(r: 0.5)
radius(0.5mm) rim
}
construction rod := solid(std.solids.Prism(face(rim), from: -3mm, to: 5mm))
spin := frame
spin turns(1) std.z
part := solid({ p | some t in (0deg, 120deg): p in rod at(under: spin) t })
Time
168 ms; CPU time 167 ms; peak memory 5.2 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.
//! What a rod (radius 0.5 about the x axis from x = −3 to 5) fills as it turns 120° about the z//! axis, which crosses it.use anvil_brep::Solid;
use anvil_brep::profile::Segment;
usecrate::shared::{intersect, line, rod, swung, turn_z, union, v2};
/// The half section an arm of the rod reaching `r` from the axis covers: from the axis out to the/// sphere of radius √(r² + 0.5²) its far rim reaches, within |z| ≤ 0.5.fnarm(r: f64) -> Vec<Segment> {
let far = (r * r + 0.25).sqrt();
let a = (0.5 / far).asin();
vec![
line(v2(0., -0.5), v2(far * a.cos(), -0.5)),
Segment::Arc { center: v2(0., 0.), radius: far, start: -a, sweep: 2. * a },
line(v2(far * a.cos(), 0.5), v2(0., 0.5)),
line(v2(0., 0.5), v2(0., -0.5)),
]
}
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. Each arm turned about the axis fills the revolve of what// it covers in a half-plane: the long arm's fan from 0° to 120°, the short one's from 180° to// 300°; and the rod itself where it starts and stopslet r = rod([-3., 0., 0.], [5., 0., 0.], 0.5)?;
let turned = turn_z(120.);
let with_fans = union(&union(&r, &swung(arm(5.), 0., 120.)?)?, &swung(arm(3.), 180., 120.)?)?;
letmut solid = union(&with_fans, &r.transformed(&turned))?;
// Beyond an arm's end (5 or 3 from the axis) the rod covers, on a circle about the axis, only// the angles between its end cap and its side, so the fans above leave out a sliver before each// fan's start and after its end, which the end corners sweep. On the start side the sliver is// what the rod's cylinder, carried on past its end, covers there within the arm's reach, and on// the end side the same turned by 120°let long = rod([-3.5, 0., 0.], [5.5, 0., 0.], 0.5)?;
let slivers = [
intersect(&long, &swung(arm(5.), -90., 90.)?)?,
intersect(&long, &swung(arm(3.), 90., 90.)?)?,
intersect(&long.transformed(&turned), &swung(arm(5.), 120., 90.)?)?,
intersect(&long.transformed(&turned), &swung(arm(3.), 300., 90.)?)?,
];
for sliver in &slivers {
solid = union(&solid, sliver)?;
}
Ok(solid)
}