A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, grooved all round by a wheel with a sharp V rim turned once round it, as a rod turns in a lathe against a form tool.
The wheel's axis is the line through (14, 0, 10) along the direction (0, sin 20°, cos 20°), leaning 20° from upright across the turn. The wheel is the solid of revolution, about that axis, of the triangle in the plane through the axis and the point (4, 0, 10) whose corners are (4, 0, 10), and (6.5, 0, 10) ± 2.5 tan 30°·(0, sin 20°, cos 20°). So its rim is a sharp circle of radius 10 that dips to (4, 0, 10), 1 inside the rod, its flanks leaning 30° either side of its mid-plane (a 60° V), back to its bore of radius 7.5.
It turns rigidly a whole turn about the z axis, starting and ending where it is drawn, inside the rod. Cut from the rod everything the wheel passes through.
A whole turn sweeps a solid of revolution: the groove is the wheel's shadow on a half-plane through the z axis, turned once round. Leaning, the wheel's flanks touch along curves that are none of its circles, joined round the rim's fan.
expected
closed form
volume
1536.481052
no closed form: cad-kernel and cadrs agree to 6e-9; the mean of their values
area
805.6742356
no closed form: cad-kernel and cadrs agree to 3e-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
69 ms; CPU time 105 ms; peak memory 12.4 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
1536.481047
1536.481052
3.0e-09
area
805.6742357
805.6742356
1.7e-10
agrees with
kentron, next.BREP, cadrs, springrep
mesh
9624 triangles, closed
centre of gravity
(-6.80955e-16, 1.60701e-16, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy 6.96332e-13; Iyz 9.14824e-13; Izx -3.407e-15
//! A rod, the cylinder of radius 5 about z from z = 0 to 20, grooved all round by a wheel with a//! sharp V rim — the triangle (4, 0, 10), (6.5, 0, 10) ± 2.5 tan 30°·(0, sin 20°, cos 20°) turned//! about the line through (14, 0, 10) along (0, sin 20°, cos 20°) — turned a whole turn about z.//!//! Sweep the wheel a whole turn into a closed solid, then subtract that solid from the rod. The//! kernel builds a whole turn by the wheel's shadow in a half-plane through the axis (#880 Q1,//! `swept::shadow`): its flanks' and bore's contacts and its three sharp circles laid in that//! half-plane, the shadow's boundary kept by membership and turned once.usecrate::sketch::polygon;
use cad_kernel::boolean::{combined, Op};
use cad_kernel::build::{disc, prism, revolve};
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use cad_kernel::util::space::{add, scale};
use std::f64::consts::TAU;
constROD_RADIUS: f64 = 5.;
constROD_LENGTH: f64 = 20.;
constCENTRE: V = [14., 0., 10.];
constLEAN: f64 = 20f64.to_radians();
/// How closely the wheel is meshed for the sweep's membership reads.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)?;
let axis = [0., LEAN.sin(), LEAN.cos()];
// the triangle in the plane through the axis and the rim's lowest point, turned once about// the axis: two cones meeting in the sharp rim, and the bore's cylinderlet half = scale(axis, 2.5 * 30f64.to_radians().tan());
let back = [6.5, 0., 10.];
let triangle = polygon(&[[4., 0., 10.], add(back, half), add(back, scale(half, -1.))]);
let wheel = revolve(&triangle, CENTRE, axis, TAU)?;
// the turn about z: a screw that does not advance, a whole turn over a roll of τlet path = Trajectory::Twist(Screw { origin: [0., 0., 0.], axis: up, ratio: 1., advance: 0. });
// the kernel's swept solid, a whole turn: its shadow's solid of revolutionlet tol = tolerance(rod.size().max(wheel.size()));
let swept = closed(&wheel, &path, [0., TAU], BAR, tol)
.map_err(|why| format!("the wheel's sweep not built: {why:?}"))?;
Ok(combined(&rod, &swept, Op::Cut, tol)?)
}
occt left no solid to show.
Time
629 ms; CPU time 628 ms; peak memory 356.6 MB
Notes
refused occt has no sweep of a solid: it turns faces, and the wheel's flanks, whose axis runs past the turn's, touch what they sweep along curves that are no plane sections of them, which occt has no operation to find
"""A rod grooved by a leaning V wheel turned once round it. A rod, the cylinder of radius 5 about
the z axis from z = 0 to z = 20, grooved all round by a wheel with a sharp V rim turned once round
it, as a rod turns in a lathe against a form tool.
The wheel's axis is the line through (14, 0, 10) along the direction (0, sin 20°, cos 20°), leaning
20° from upright across the turn. The wheel is the solid of revolution, about that axis, of the
triangle in the plane through the axis and the point (4, 0, 10) whose corners are (4, 0, 10), and
(6.5, 0, 10) ± 2.5 tan 30°·(0, sin 20°, cos 20°). So its rim is a sharp circle of radius 10 that
dips to (4, 0, 10), 1 inside the rod, its flanks leaning 30° either side of its mid-plane (a 60°
V), back to its bore of radius 7.5.
It turns rigidly a whole turn about the z axis, starting and ending where it is drawn, inside the
rod. Cut from the rod everything the wheel passes through.
A whole turn sweeps a solid of revolution: the groove is the wheel's shadow on a half-plane through
the z axis, turned once round. Leaning, the wheel's flanks touch along curves that are none of its
circles, joined round the rim's fan."""from bench importRefuseddefbuild():
# Turned whole about the z axis, the wheel sweeps a solid of revolution, its shadow on a# half-plane through the axis turned once round. But the wheel's axis runs past the turn's# without meeting it: its flanks, cones, touch what they sweep along curves that are none# of their circles or rulings and no plane sections of them, and OCCT has no operation that# finds them, nor one that draws a solid's shadow on a half-plane about an axis. A face it# turns sweeps to a solid only once split along its contact: finding those curves would be# computing the envelope outside the kernel.raiseRefused("occt has no sweep of a solid: it turns faces, and the wheel's flanks, whose ""axis runs past the turn's, touch what they sweep along curves that are no ""plane sections of them, 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
15 ms; CPU time 15 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.
Data
its STEP's
expected
rel. error
volume
1536.481056
1536.481052
3.0e-09
area
805.6742354
805.6742356
1.7e-10
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
9188 triangles, closed
centre of gravity
(-4.00018e-16, 3.42212e-16, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy 7.14095e-13; Iyz -8.71813e-13; Izx 5.06603e-15
//! A rod, the cylinder of radius 5 about the z axis from z = 0 to z = 20, grooved all round by a//! wheel with a sharp 60° V rim turned once round it: the solid of revolution, about the line//! through (14, 0, 10) along (0, sin 20°, cos 20°), of the triangle with its tip at (4, 0, 10) and//! its other corners at (6.5, 0, 10) ± 2.5 tan 30°·(0, sin 20°, cos 20°), turned rigidly a whole//! turn about the z axis. Everything the wheel passes through, cut.//!//! kentron's cut by a motion (`sweep::cut_by_motion`) takes the wheel as the solid of revolution//! of its triangle, (10, 0) its tip and (7.5, ±2.5·tan 30°) its other corners in (distance from//! the wheel's axis, height along it), the rod as the whole ring sector about the z axis from//! radius 0 to 5, and the whole turn as one step: what a whole turn fills is turned into itself,//! so the groove's section in the meridian half-plane is what the wheel covers there, revolved.usecrate::bench::p;
use kentron::math::{Axis, Direction, Frame, Point2};
use kentron::sweep::{self, Blank, MeridianPiece, Motion, MotionStep, Tool};
use kentron::topology::{Model, Shape};
use std::f64::consts::{PI, TAU};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let rod = Blank::RingSector { frame: Frame::WORLD, radii: [0.0, 5.0], heights: [0.0, 20.0], angles: [0.0, TAU] };
let lean = 20f64.to_radians();
let frame = Frame::new(p(14.0, 0.0, 10.0), Direction::new(0.0, lean.sin(), lean.cos()), Direction::NEG_X);
let half = 2.5 * (PI / 6.0).tan();
let (tip, near, far) = (Point2::new(10.0, 0.0), Point2::new(7.5, half), Point2::new(7.5, -half));
let meridian = vec![
MeridianPiece::Line { from: far, to: tip },
MeridianPiece::Line { from: tip, to: near },
MeridianPiece::Line { from: near, to: far },
];
let wheel = Tool::Revolved { frame, meridian };
let turn = MotionStep { axis: Axis::new(p(0.0, 0.0, 0.0), Direction::Z), turn: 1.0, advance: 0.0 };
let motion = Motion { steps: vec![turn], from: 0.0, to: TAU };
sweep::cut_by_motion(m, &rod, &wheel, &motion)
}
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.5 ms; CPU time 1.3 ms; peak memory 4.8 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: turned whole about the z axis, the leaning wheel sweeps the revolve of its shadow through the axis, whose edge is an envelope of its flanks' circles
//! Refused. A whole turn about the z axis sweeps the wheel's shadow on a half-plane through the//! axis, revolved; but the wheel's axis leans 20° across the turn, a line skew to the z axis, so//! its flanks touch along curves that are none of its circles and the shadow is bounded by their//! envelope (and by the shadow of its sharp rim, no conic). solidcraft-kernel has no sweep of a//! solid and no envelope, and that shadow 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: turned whole about the z axis, \
the leaning wheel sweeps the revolve of its shadow through the axis, whose edge is an \
envelope of its flanks' circles"
.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.8 ms; CPU time 3.6 ms; peak memory 11.4 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 grooved by a leaning V wheel turned once round it.//// 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
136 ms; CPU time 136 ms; peak memory 20.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
1536.481056
1536.481052
3.0e-09
area
805.6742354
805.6742356
1.6e-10
agrees with
cad-kernel, kentron, cadrs, springrep
mesh
29140 triangles, closed
centre of gravity
(-3.316e-14, -6.8386e-14, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy 4.30373e-13; Iyz -5.78298e-10; Izx -1.30643e-11
//! A rod grooved all round by a leaning wheel with a sharp V rim, turned once round it.//!//! Through the kernel's sweep of a solid (`sweep_solid_within`): the wheel is a solid of revolution//! about the line through (14, 0, 10) along (0, sin 20°, cos 20°), its meridian the triangle with//! its tip 10 from the axis (at (4, 0, 10)) and its other corners 7.5 from it, ±2.5 tan 30° along//! it; turned a whole turn about the z axis, asked for within 5.2 of the z axis from z = −0.5 to//! 20.5, which holds the rod; cut from the rod. The kernel's sweep takes a turn only where neither//! end position reaches the region asked for, so it may refuse.usecrate::solids::p;
usecrate::Refusal;
#[allow(unused_imports)]use brep_kernel::{
boolean_operation_nary, make_box_brep, make_cylinder_brep, revolve_profile_brep,
sweep_solid_within, BooleanOperation, BrepSolid, OutlinePiece, ScrewStep, SolidMotion,
SweepClip, SweptTool, Vec3,
};
#[allow(unused_imports)]use std::f64::consts::{FRAC_PI_2, PI, 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 flank = 2.5 * (PI / 6.0).tan();
letmut operands = vec![rod];
let tool0 = SweptTool::Revolved {
axis_origin: p(14.0, 0.0, 10.0),
axis_direction: p(0.0, 20f64.to_radians().sin(), 20f64.to_radians().cos()),
radial: p(-1.0, 0.0, 0.0),
meridian: vec![
OutlinePiece::Line { from: [10.0, 0.0], to: [7.5, flank] },
OutlinePiece::Line { from: [7.5, flank], to: [7.5, -flank] },
OutlinePiece::Line { from: [7.5, -flank], to: [10.0, 0.0] },
],
};
let motion0 = 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: TAU,
};
let clip0 = 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.2],
axial: [-0.5, 20.5],
angle: None,
};
operands.extend(sweep_solid_within(&tool0, &motion0, &clip0)?);
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
80 ms; CPU time 115 ms; peak memory 11 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
1536.481056
1536.481052
2.8e-09
area
805.6742352
805.6742356
4.6e-10
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
9480 triangles, closed
centre of gravity
(9.23238e-11, 2.35672e-10, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy 3.00708e-08; Iyz 3.11221e-07; Izx -4.03409e-08
//! A rod (the cylinder of radius 5 about the z axis from z = 0 to z = 20) grooved all round by a//! wheel with a sharp V rim (the triangle with corners (4, 0, 10) and (6.5, 0, 10) ± 2.5 tan 30°·w//! turned about the axis through (14, 0, 10) along w = (0, sin 20°, cos 20°)) turned a whole turn//! about the z axis.//!//! The wheel is its triangle revolved; what it passes through is cadrs's sweep of a solid (turned//! whole turns about the z axis: the solid of revolution it generates), cut from the rod.usecrate::bench::{cut, p3, revolve, v3};
usecrate::shared::swept::rod;
usecrate::Refusal;
use cadrs_kernel::{Axis, BodyId, DefaultKernel, Kernel, Loop, Plane, Profile, SolidMotion};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let t = 20f64.to_radians();
let (o, w) = (p3(14.0, 0.0, 10.0), v3(0.0, t.sin(), t.cos()));
// Sketch x from the wheel's axis toward the rim's dip (−x), sketch y along w.let x = v3(-1.0, 0.0, 0.0);
let on = Plane::new(o, x, x.cross(&w));
let h = 2.5 * 30f64.to_radians().tan();
let triangle = Loop::polygon(&[[10.0, 0.0], [7.5, -h], [7.5, h]]);
let wheel = revolve(k, &Profile::of(on, vec![triangle]), Axis::new(o, w), None)?;
let motion = SolidMotion::Turn { axis: crate::shared::swept::z_axis() };
let swept = k.sweep_solid(wheel, &motion)?.first()?;
let r = rod(k)?;
cut(k, r, swept)
}
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
8.08 s; CPU time 8.07 s; peak memory 14.4 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
1536.481056
1536.481052
3.0e-09
area
805.6742354
805.6742356
1.6e-10
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
10854 triangles, closed
centre of gravity
(-4.74587e-16, 8.55529e-17, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy -2.27374e-13; Iyz 3.201e-12; Izx 6.88338e-15
//! The rod of radius 5 about the z axis from z = 0 to 20 less everything a V wheel (a sharp rim//! of radius 10 about the line through (14, 0, 10) leaning 20° across the turn) passes through//! as it turns once about the z axis.use std::f64::consts::PI;
use springrep::boolean::difference;
use springrep::profile::Profile;
use springrep::sweep::solid;
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{deg, polygon, revolved, rod, turning, v3};
/// The V wheel's rim in (distance from its axis, along it): its tip 10 out, the V 2.5 deep with/// flanks at 30° to the wheel's plane.fnv_rim() -> Profile {
let flank = 2.5 * deg(30.0).tan();
polygon(&[(7.5, -flank), (10.0, 0.0), (7.5, flank)], "rim")
}
pubfnbuild() -> Result<Brep, String> {
let (s, c) = deg(20.0).sin_cos();
let wheel = revolved(
&v_rim(),
v3(14.0, 0.0, 10.0),
v3(0.0, s, c),
v3(-1.0, 0.0, 0.0),
"wheel",
)?;
let swept = solid(&wheel, &turning(0.0, 2.0 * PI), "turn").map_err(e)?;
difference(&rod()?, &swept).map_err(e)
}
Time
415 ms; CPU time 687 ms; peak memory 36.6 MB
Notes
wrong area 805.671005367 against 805.674235563 (its STEP's)
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
1536.480469
1536.481052
3.8e-07
area
805.6710054
805.6742356
4.0e-06
agrees with
no other kernel
mesh
10628 triangles, closed
centre of gravity
(4.58598e-07, -1.83245e-07, 10) its STEP's solid
inertia
about it, of unit density: Ixx 61804.1; Iyy 61804.1; Izz 18899.9; Ixy 0.00116398; Iyz -3.54266e-07; Izx 2.10349e-08
// A rod grooved all round by a leaning V wheel turned once round it, as a rod turns in a lathe// against a form tool. The rod is the cylinder of radius 5 about z from z = 0 to 20. The wheel's// axis runs through (14, 0, 10) along (0, sin 20, cos 20): in the plane through that axis and x,// the wheel is the triangle with its tip at (4, 0, 10) and its other corners 2.5 further out,// 2.5 tan 30 either side along the axis, turned about the axis. The kernel's sweep of the wheel// turned a whole turn about z, from where it is drawn, is cut from the rod.unit mm
use std
use std.solids (cut)
use std.place (coords, on_u)
use std.motion (turns)
lean := 20deg// how far the wheel's axis leans from upright, across the turnin std.top {
private o := point
fix((0, 0)) o
private rod_rim := circle(center: o) hint(r: 5)
radius(5mm) rod_rim
}
part := solid(std.solids.Prism(face(rod_rim), from: 0mm, to: 20mm))
// the wheel, drawn in the plane through its axis and x at the rod's middle heightprivate across := axis
fix(dir == (1, 0, 0)) across
private along := axis
fix(dir == (0, sin(lean), cos(lean))) along
bench := plane(u: across, v: along)
fix(origin == (0, 0, 10)) bench
in bench {
private a0 := point
private a1 := point
a0 coords(du: 14mm, dv: -1mm) bench
a1 coords(du: 14mm, dv: 1mm) bench
private wheel_axis := line(a0, a1)
private v0 := point
private v1 := point
private v2 := point
v0 on_u(d: 4mm) bench
v1 coords(du: 6.5mm, dv: -2.5mm * tan(30deg)) bench
v2 coords(du: 6.5mm, dv: 2.5mm * tan(30deg)) bench
private lower := line(v0, v1)
private bore := line(v1, v2)
private upper := line(v2, v0)
}
construction vwheel := solid(std.solids.Revolution(face(lower, bore, upper), about: wheel_axis))
lathe := frame
lathe turns(1) std.z
construction groove := solid({ p | some t in (0deg, 360deg): p in vwheel at(under: lathe) t })
groove cut part
anvilcad left no solid to show.
Time
1.2 ms; CPU time 980 µs; peak memory 3.4 MB
Notes
refused anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself
//! A rod grooved by a leaning V wheel turned once round it.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid, and what this motion sweeps is bounded by envelopes of the body's surfaces under it (a rim or a face leaning to the motion) that follow from no elementary construction, which it would have to compute itself".into())
}