A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, with a helical groove ground around it by a wheel shaped as a flattened spheroid, carried along a screw. The wheel's meridian is an ellipse, neither a line nor a circle.
The wheel is the oblate spheroid centered at (10.5, 0, 0) with semi-axes 6, 6 and 1.5, its short axis along its own axis. That axis lies square to the x axis, leaning from the y axis down toward −z by h = atan(2π·4.75/30) ≈ 44.83°: its direction is (0, cos h, −sin h). So its rim, a circle of radius 6 about its center in the plane square to that axis, reaches to (4.5, 0, 0), 0.5 inside the rod.
The screw is about the z axis: the wheel turns right-handed about it (from +x toward +y) and rises 30 for every whole turn, rigidly. It runs from a turn of −90° (lowered 7.5, wholly below the rod) to a turn of +330° (raised 27.5, wholly above it). Cut from the rod everything the wheel passes through.
expected
closed form
volume
1559.464105
no closed form: cad-kernel and cadrs agree to 3e-10; the mean of their values
area
794.4600094
no closed form: cad-kernel and cadrs agree to 9e-10; 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
1.47 s; CPU time 3.55 s; peak memory 21 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
1559.464104
1559.464105
5.7e-10
area
794.4600085
794.4600094
1.1e-09
agrees with
kentron, next.BREP, cadrs, springrep
mesh
7652 triangles, closed
centre of gravity
(0.00719146, -0.012456, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61682; Iyy 61655.4; Izz 19373.1; Ixy 22.9724; Iyz -118.296; Izx -204.894
//! A rod, the cylinder of radius 5 about z from z = 0 to 20, with a helical groove ground round it//! by an oblate spheroid — centred at (10.5, 0, 0), semi-axes 6, 6 and 1.5, its short axis along//! (0, cos h, −sin h), h = atan(2π·4.75 / 30) — screwed about z, right-handed and rising 30 a turn,//! from a turn of −90° to +330°.//!//! The kernel's closed sweep (`swept::closed::cut_from`) takes the wheel whole: under a screw its//! closed class takes planes, balls, and cylinders and cones about axes along the screw's, and//! refuses the spheroid (`Unbuilt::Curved`), whose face is a ball's affine image, its contact//! curves no closed form the candidates hold (an affine map does not carry a screw to a screw, so//! the slid ellipsoid's route through the ball does not apply); since 0.9.0 such a tool goes the//! contact's road — the spheroid's contact with the screw carried over the roll as sheets, given//! their meetings with one another and with the end poses, trimmed by membership in the sweep, and//! the result cut from the rod.use cad_kernel::build::{disc, ellipsoid, prism};
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::cut_from;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::TAU;
constROD_RADIUS: f64 = 5.;
constROD_LENGTH: f64 = 20.;
constCENTRE: V = [10.5, 0., 0.];
constSEMI: [f64; 3] = [6., 6., 1.5];
constLEAD: f64 = 30.;
constROLL: [f64; 2] = [-90f64.to_radians(), 330f64.to_radians()];
/// How closely the wheel is meshed for the sweep's membership reads: a hundred-and-fiftieth of its/// short semi-axis.constBAR: f64 = 0.01;
pubfnbuild() -> Result<Brep, String> {
let up = [0., 0., 1.];
let rod = prism(&disc([0., 0., 0.], up, ROD_RADIUS), 0., ROD_LENGTH)?;
// the wheel's axis square to x, leaning from y down toward −z by the helix's angle at 4.75let h = (TAU * 4.75 / LEAD).atan();
let axis = [0., h.cos(), -h.sin()];
// the spheroid on a frame about that axis: its two long semi-axes square to it (the first// along x), its short one along itlet wheel = ellipsoid(CENTRE, axis, [1., 0., 0.], SEMI)?;
// the screw about z: a radian a radian of the roll, rising the lead a turnlet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: up, ratio: 1., advance: LEAD,
});
let size = rod.size().max(wheel.size());
cut_from(&rod, &wheel, &path, ROLL, BAR, tolerance(size))
.map_err(|why| format!("the wheel's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
615 ms; CPU time 614 ms; peak memory 356.7 MB
Notes
refused occt has no sweep of a solid: it carries faces along a screw, and the spheroid, screwed about an axis its own does not share, touches what it sweeps along a curve that is no plane section of it, which occt has no operation to find
"""A rod threaded by a wheel whose section is an ellipse. A rod, the cylinder of radius 5 about the
z axis from z = 0 to z = 20, with a helical groove ground around it by a wheel shaped as a
flattened spheroid, carried along a screw. The wheel's meridian is an ellipse, neither a line nor a
circle.
The wheel is the oblate spheroid centered at (10.5, 0, 0) with semi-axes 6, 6 and 1.5, its short
axis along its own axis. That axis lies square to the x axis, leaning from the y axis down toward
−z by h = atan(2π·4.75/30) ≈ 44.83°: its direction is (0, cos h, −sin h). So its rim, a circle of
radius 6 about its center in the plane square to that axis, reaches to (4.5, 0, 0), 0.5 inside the
rod.
The screw is about the z axis: the wheel turns right-handed about it (from +x toward +y) and rises
30 for every whole turn, rigidly. It runs from a turn of −90° (lowered 7.5, wholly below the rod)
to a turn of +330° (raised 27.5, wholly above it). Cut from the rod everything the wheel passes
through."""from bench importRefuseddefbuild():
# OCCT has no spheroid but makes one exactly, a ball stretched by GTransform. But carried# along a screw about an axis its own does not share, it touches what it sweeps along a# curve that is none of its circles and no plane section of it (the image of no great# circle of the ball). OCCT sweeps no solid, and a face it carries along the screw sweeps to# a solid only once split along its contact: finding that curve would be computing the# envelope outside the kernel.raiseRefused("occt has no sweep of a solid: it carries faces along a screw, and the ""spheroid, screwed about an axis its own does not share, touches what it ""sweeps along a curve that is no plane section of it, which occt has no ""operation to find")
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
1.41 s; CPU time 2.17 s; peak memory 158.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.
Data
its STEP's
expected
rel. error
volume
1559.464104
1559.464105
1.1e-10
area
794.4600095
794.4600094
8.4e-11
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
18706 triangles, closed
centre of gravity
(0.00719146, -0.012456, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61682; Iyy 61655.4; Izz 19373.1; Ixy 22.9724; Iyz -118.296; Izx -204.894
//! A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, with a helical groove//! ground round it by a wheel shaped as an oblate spheroid: centred at (10.5, 0, 0), semi-axes 6, 6//! and 1.5, its short axis along (0, cos h, −sin h), h = atan(2π·4.75/30), carried along the screw//! about the z axis, right-handed, rising 30 a turn, from a turn of −90° to +330°. Everything the//! wheel passes through, cut.//!//! The wheel is its meridian (half an ellipse and its axis) revolved and placed; its sweep is//! kentron's sweep of a solid (`sweep::solid`, one screw), cut from the rod.usecrate::bench::p;
use kentron::geometry::curve::{Curve, Ellipse};
use kentron::make;
use kentron::math::{Axis, Direction, Frame, Point, Transform, Vector};
use kentron::primitives::Cylinder;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::{FRAC_PI_2, TAU};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let rod = Cylinder::new(5.0, 20.0).build(m)?;
// The spheroid about the z axis, its meridian in the xz plane: from its pole below round// through (6, 0, 0) to its pole above, and back down the axis.let meridian = Ellipse::new(Frame::new(Point::ORIGIN, Direction::NEG_Y, Direction::X), 6.0, 1.5);
let edges = vec![
make::edge_from_curve_range(m, Curve::Ellipse(meridian), -FRAC_PI_2, FRAC_PI_2)?,
make::edge_between(m, p(0.0, 0.0, 1.5), p(0.0, 0.0, -1.5))?,
];
let wire = make::wire(m, &edges)?;
let half = make::planar_face(m, wire)?;
let upright = sweep::revolve(m, half, Axis::Z, TAU)?.shape;
// Its axis turned from z to (0, cos h, −sin h) (about x by −(90° + h)), then moved to its// centre.let h = (TAU * 4.75 / 30.0).atan();
let place = Transform::translation(Vector::new(10.5, 0.0, 0.0)) * Transform::rotation(Axis::X, -(FRAC_PI_2 + h));
let wheel = kentron::modify::transform(m, upright, &place, Default::default())?;
let screw = RigidMotion::Screw { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), lead: 30.0, from: -FRAC_PI_2, to: 330f64.to_radians() };
let swept = sweep::solid(m, wheel, &screw)?;
kentron::boolean::difference(m, rod, swept)
}
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.7 ms; CPU time 1.5 ms; peak memory 4.5 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: no layer's screw sweep (`sweep_helix`, `screw_sweep`) does more than screw a planar profile, but the groove's wall is the envelope of the leaning spheroid over the screw, touching it along no plane section of it
//! Refused. The groove is what the spheroid, leaning at the helix angle, passes through as it is//! screwed along the rod. Its wall is the envelope of the spheroid over the screw, touching it//! along a curve that is none of its plane sections, so no section of the wheel screwed by the//! kernel's helical sweep (`sweep_helix`) makes it. solidcraft-kernel has no sweep of a solid and//! no envelope, and that curve computed here 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 or an envelope: no layer's screw sweep (`sweep_helix`, `screw_sweep`) does more than screw a \
planar profile, but the groove's wall is the envelope of the leaning spheroid over the \
screw, touching it along no plane section of it"
.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
3.3 ms; CPU time 3.1 ms; peak memory 11.6 MB
Notes
refused popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make
// A rod threaded by a wheel whose section is an ellipse.//// Refused: popkern has no sweep of a solid (its sweeps carry a profile along a path), and this// one's boundary is an envelope of the moving solid that its other operations do not make.throw"popkern has no sweep of a solid, and this sweep's wall is an envelope its other operations do not make";
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
193 ms; CPU time 193 ms; peak memory 13.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
1559.464105
1559.464105
5.2e-12
area
794.4600097
794.4600094
3.3e-10
agrees with
cad-kernel, kentron, cadrs, springrep
mesh
100386 triangles, closed
centre of gravity
(0.00719146, -0.012456, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61682; Iyy 61655.4; Izz 19373.1; Ixy 22.9724; Iyz -118.296; Izx -204.894
//! A rod with a helical groove ground by an oblate spheroid carried along a screw, through the//! kernel's sweep of a solid within a region (`sweep_solid_within`): the spheroid is a solid of//! revolution about the line through (10.5, 0, 0) along (0, cos h, −sin h), h = atan(2π·4.75/30),//! its meridian the half ellipse of semi-axes 6 (from the axis) and 1.5 (along it) closed by the//! axis; screwed about the z axis, rising 30 a turn, from −90° to 330°; cut from the rod.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, make_cylinder_brep, sweep_clip_less, sweep_solid_within, BooleanOperation, BrepSolid,
OutlinePiece, ScrewStep, SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::{FRAC_PI_2, TAU};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let rod = make_cylinder_brep(p(0.0, 0.0, 0.0), p(0.0, 0.0, 1.0), 5.0, 20.0)?;
let h = (TAU * 4.75 / 30.0).atan();
let wheel = SweptTool::Revolved {
axis_origin: p(10.5, 0.0, 0.0),
axis_direction: p(0.0, h.cos(), -h.sin()),
radial: p(-1.0, 0.0, 0.0),
meridian: vec![
OutlinePiece::Ellipse { centre: [0.0, 0.0], semi: [6.0, 1.5], rotation: 0.0, start: -FRAC_PI_2, end: FRAC_PI_2 },
OutlinePiece::Line { from: [0.0, 1.5], to: [0.0, -1.5] },
],
};
let screw = 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: 30.0 / TAU,
}],
from: (-90.0f64).to_radians(),
to: 330.0f64.to_radians(),
};
let around_rod = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: p(0.0, 0.0, 1.0),
reference: p(1.0, 0.0, 0.0),
radius: [0.0, 5.5],
axial: [-1.0, 21.0],
angle: None,
};
letmut operands = vec![rod];
// The rod less the sweep, built directly where the kernel can (its clip// the rod itself); else the sweep within the larger clip, subtracted.let rod_clip = SweepClip { radius: [0.0, 5.0], axial: [0.0, 20.0], ..around_rod.clone() };
ifletSome(mut bodies) = sweep_clip_less(&wheel, &screw, &rod_clip)? {
if bodies.len() == 1 {
returnOk(bodies.remove(0));
}
}
operands.extend(sweep_solid_within(&wheel, &screw, &around_rod)?);
Ok(boolean_operation_nary(&operands, BooleanOperation::Subtract)?)
}
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
177 ms; CPU time 401 ms; peak memory 17.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
1559.464104
1559.464105
1.3e-10
area
794.4600097
794.4600094
3.6e-10
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
11808 triangles, closed
centre of gravity
(0.00719146, -0.012456, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61682; Iyy 61655.4; Izz 19373.1; Ixy 22.9724; Iyz -118.296; Izx -204.894
//! A rod (the cylinder of radius 5 about the z axis from z = 0 to z = 20) with a helical groove//! ground by an oblate spheroid (semi-axes 6, 6 and 1.5 about (10.5, 0, 0), its short axis along//! (0, cos h, −sin h), h = atan(2π·4.75/30)) screwed about the z axis, rising 30 a turn, from a//! turn of −90° to +330°.//!//! The spheroid is the unit ball scaled and turned (cadrs's affine transform); what it passes//! through (a turn and a slide along its axis at once: a screw) is cut from the rod by cadrs's cut by//! a swept solid (exactly half a turn at a time where it can be, else meshed); of the wheel, its part within 5.5 of the axis (the screw maps the cylinder about//! its axis onto itself, so only that part reaches the rod).usecrate::bench::{ball, p3, v3};
usecrate::shared::swept::{cut_swept, near_axis, rod, screw, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Kernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let unit = ball(k, p3(0.0, 0.0, 0.0), 1.0)?;
let h = (std::f64::consts::TAU * 4.75 / 30.0).atan();
// Its axes: x stays, the short axis along (0, cos h, −sin h), the third square to both.let short = v3(0.0, h.cos(), -h.sin());
let third = short.cross(&v3(1.0, 0.0, 0.0));
let m = nalgebra::Matrix3::from_columns(&[v3(6.0, 0.0, 0.0), third * 6.0, short * 1.5]);
let wheel = k.transform_affine(unit, m, v3(10.5, 0.0, 0.0))?.first()?;
let wheel = near_axis(k, wheel, 5.5)?;
let r = rod(k)?;
cut_swept(k, r, wheel, &screw(z_axis(), 30.0, -90.0, 330.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
5.72 s; CPU time 5.72 s; peak memory 99.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
1559.464105
1559.464105
3.6e-11
area
794.4600096
794.4600094
2.9e-10
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
11550 triangles, closed
centre of gravity
(0.00719146, -0.012456, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61682; Iyy 61655.4; Izz 19373.1; Ixy 22.9724; Iyz -118.296; Izx -204.894
//! The rod of radius 5 about the z axis from z = 0 to 20 less everything an oblate spheroid//! wheel (semi-axes 6, 6, 1.5 about (10.5, 0, 0), leaning 44.83°) passes through as it is//! screwed about the z axis, rising 30 a turn.use std::f64::consts::PI;
use springrep::boolean::difference;
use springrep::profile::{NamedSegment, Profile, Segment};
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, line, revolved, rod, screwing, v2, v3};
pubfnbuild() -> Result<Brep, String> {
let h = (2.0 * PI * 4.75 / 30.0).atan();
let axis = v3(0.0, h.cos(), -h.sin());
// the half meridian out from the wheel's axis and along it: the ellipse of semi-axes 6 and 1.5let skin = Segment::Ellipse {
center: v2(0.0, 0.0),
rotation: 0.0,
major: 6.0,
minor: 1.5,
start: -PI / 2.0,
sweep: PI,
};
let half = Profile::outline(vec![
NamedSegment::new(skin, "skin"),
line((0.0, 1.5), (0.0, -1.5), "axis"),
]);
// drawn on the side away from the rod, so the wheel's seam stays clear of the cutlet wheel = revolved(&half, v3(10.5, 0.0, 0.0), axis, v3(1.0, 0.0, 0.0), "wheel")?;
let swept = solid(&wheel, &screwing(30.0, deg(-90.0), deg(330.0)), "screw").map_err(e)?;
difference(&rod()?, &swept).map_err(e)
}
geomsolver left no solid to show.
Time
26 ms; CPU time 26 ms; peak memory 12.5 MB
Notes
refused Solvent turns only lines, arcs and circles into a solid of revolution. The wheel's meridian is half an ellipse; drawn as a traced `std.shapes.Ellipse`, or exactly as two rational cubic quarters, `std.solids.Revolution` of it is refused when the screw's sweep reads the wheel ("exact revolved patches currently require lines, arcs or circles"), and std.sets has no ellipsoid or other set that is the spheroid, so the wheel cannot be made.
// A rod threaded by a wheel shaped as a flattened spheroid (semi-axes 6, 6 and 1.5), carried along// a screw.//// Refused: Solvent turns only lines, arcs and circles into a solid of revolution. The wheel's// meridian is half an ellipse; drawn as a traced `std.shapes.Ellipse`, or exactly as two rational// cubic quarters, `std.solids.Revolution` of it is refused when the screw's sweep reads the wheel// ("exact revolved patches currently require lines, arcs or circles"), and std.sets has no// ellipsoid or other set that is the spheroid, so the wheel cannot be made.
anvilcad left no solid to show.
Time
1.2 ms; CPU time 1.1 ms; peak memory 3.6 MB
Notes
refused anvil-brep has no sweep of a solid and no helical curve: a body screwed along an axis sweeps envelopes of its surfaces under the screw, which it cannot make from its profile sweeps
//! A rod threaded by a wheel whose section is an ellipse.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid and no helical curve: a body screwed along an axis sweeps envelopes of its surfaces under the screw, which it cannot make from its profile sweeps".into())
}