The rod and groove of swept/torus-screwed-through-rod, turned rigidly about the origin so that the rod's axis is no longer a coordinate axis. Write u = (2, −2, 1)/3, v = (2, 1, −2)/3 and w = (1, 2, 2)/3: three unit vectors square to one another, right-handed (u × v = w). The point that case puts at (x, y, z) is here at x·u + y·v + z·w.
So: a rod, the cylinder of radius 5 about the line through the origin along w, from the origin to 20w = (20/3, 40/3, 40/3), with a helical groove ground around it by a wheel carried along a screw, as a thread is ground.
The wheel is a torus: the circle through its tube's centers has radius 6, and its tube has radius 2. As placed, its center is 11.5u = (23/3, −23/3, 23/6), so the part of its tube nearest the rod is centered at 5.5u = (11/3, −11/3, 11/6) and reaches 1.5 into the rod. Its axis passes through its center square to u, along cos h·v − sin h·w, where h = atan(2π·5.5 / 30) ≈ 49.04° is the helix angle. The wheel then lies along the helix that the screw below carries the point 5.5u along, as a grinding wheel is set.
The screw is about the rod's axis: the wheel turns right-handed about w (from u toward v) and rises 30 along w for every whole turn, rigidly. It runs from a turn of −108° (the wheel lowered 9, wholly below the rod) to a turn of +348° (raised 29, wholly above it). Cut from the rod everything the wheel passes through.
The groove's section square to the axis is the same at every station along it, turned.
expected
closed form
volume
1460.630003
no closed form: swept/torus-screwed-through-rod's answer (the mean of cad-kernel's, next.BREP's and cadrs's values, which agree to 7e-10), the solid being that one turned rigidly
area
791.5632226
no closed form: swept/torus-screwed-through-rod's answer (the mean of cad-kernel's, next.BREP's and cadrs's values, which agree to 1e-9), the solid being that one turned rigidly
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
5.33 s; CPU time 13.0 s; peak memory 32.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
1460.630002
1460.630003
4.6e-10
area
791.5632223
791.5632226
3.0e-10
agrees with
next.BREP, cadrs, springrep
mesh
9082 triangles, closed
centre of gravity
(3.30109, 6.58448, 6.76497) its STEP's solid
inertia
about it, of unit density: Ixx 51876.5; Iyy 40732.9; Izz 39680.6; Ixy -9929.84; Iyz -17056.6; Izx -10060.5
//! The rod and groove of `swept/torus-screwed-through-rod` turned rigidly so that the rod's axis is//! w = (1, 2, 2)/3: the cylinder of radius 5 about w from the origin to 20w, less everything a wheel//! passes through, the torus of radii 6 and 2 about 11.5u set along the helix the screw carries 5.5u//! along, screwed about w, rising 30 a turn, from a turn of −108° to one of 348°.use cad_kernel::build::{disc, prism, torus};
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 cad_kernel::util::space::{scale, sub};
use std::f64::consts::TAU;
/// The turned frame: u where the case before it had x, v where it had y, w where it had z.constU: V = [2. / 3., -2. / 3., 1. / 3.];
constV_: V = [2. / 3., 1. / 3., -2. / 3.];
constW: V = [1. / 3., 2. / 3., 2. / 3.];
/// How far the screw rises a whole turn.constRISE: f64 = 30.;
/// How far the screw turns from where the wheel is drawn, in degrees: down to, and up to.constTURNS: [f64; 2] = [-108., 348.];
/// How closely the wheel is meshed for the sweep's membership reads.constBAR: f64 = 0.01;
pubfnbuild() -> Result<Brep, String> {
let rod = prism(&disc([0.; 3], W, 5.), 0., 20.)?;
// the wheel set along the helix the screw carries 5.5u along: its axis cos h·v − sin h·wlet h = (TAU * 5.5 / RISE).atan();
let axis = sub(scale(V_, h.cos()), scale(W, h.sin()));
let wheel = torus(scale(U, 11.5), axis, 6., 2.)?;
// the screw about w: a radian a radian of the roll, rising `RISE` a turnlet path = Trajectory::Twist(Screw { origin: [0.; 3], axis: W, ratio: 1., advance: RISE });
let size = rod.size().max(wheel.size());
cut_from(&rod, &wheel, &path, TURNS.map(f64::to_radians), BAR, tolerance(size))
.map_err(|why| format!("the wheel's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
637 ms; CPU time 636 ms; peak memory 356.7 MB
Notes
refused occt has no sweep of a solid along a screw motion: BRepOffsetAPI_MakePipe along a helix takes no solid and stops on the torus's face (BRepFill_Sweep::BuildEdge), and the groove's wall is the envelope of the screwed torus, along a characteristic curve that is none of its circles, which occt has no operation to find
"""A tilted rod grooved by a wheel screwed along it. The rod and groove of
swept/torus-screwed-through-rod, turned rigidly about the origin so that the point that case puts
at (x, y, z) is here at x·u + y·v + z·w, where u = (2, −2, 1)/3, v = (2, 1, −2)/3 and
w = (1, 2, 2)/3.
So: a rod, the cylinder of radius 5 about the line through the origin along w, from the origin to
20w, with a helical groove ground round it by a wheel, a torus whose tube's centres lie on a
circle of radius 6 and whose tube has radius 2, centred at 11.5u, its axis along
cos h·v − sin h·w (h = atan(2π·5.5 / 30)), carried along the screw about w that rises 30 along w
for every whole turn, from a turn of −108° to one of +348°. Cut from the rod everything the wheel
passes through."""from bench importRefuseddefbuild():
# As for swept/torus-screwed-through-rod, of which this is a rigid motion: OCCT's one sweep# that follows a screw is a pipe along a helix under the Frenet law# (BRepOffsetAPI_MakePipe), which takes no solid and stops on the torus's face# (BRepFill_Sweep::BuildEdge). Sweeping the torus's face whole would not be enough either:# it would first have to be split along its characteristic curve, none of the torus's# circles, and the groove's wall is the envelope that curve sweeps out, which would be# computed outside the kernel. Turning the axis changes none of that.raiseRefused("occt has no sweep of a solid along a screw motion: BRepOffsetAPI_MakePipe ""along a helix takes no solid and stops on the torus's face ""(BRepFill_Sweep::BuildEdge), and the groove's wall is the envelope of the ""screwed torus, along a characteristic curve that is none of its circles, ""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.
kentron 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.
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.8 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 section is the envelope of the leaning torus over the screw, which is no plane section of it
//! Refused, as `swept/torus-screwed-through-rod` is: turning the rod and the wheel rigidly so//! that the axis is (1, 2, 2)/3 changes nothing of why. The kernel's helical sweep//! (`sweep_helix`) carries a planar profile along a screw, but no plane section of the torus is//! the groove's section: the groove's wall is the envelope of the torus over the screw, touching//! it along a curve that is none of its circles. solidcraft-kernel has no sweep of a solid and no//! envelope, and that section 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 section is the envelope of the leaning torus over the screw, \
which is 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
It has not run.
Notes
missing no implementation
Data
No measures: it built no solid to measure.
Implementation
No implementation yet.
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
189 ms; CPU time 188 ms; peak memory 12.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
1460.630003
1460.630003
4.4e-10
area
791.5632229
791.5632226
4.3e-10
agrees with
cad-kernel, cadrs, springrep
mesh
44548 triangles, closed
centre of gravity
(3.30109, 6.58448, 6.76497) its STEP's solid
inertia
about it, of unit density: Ixx 51876.5; Iyy 40732.9; Izz 39680.6; Ixy -9929.84; Iyz -17056.6; Izx -10060.5
//! `swept/torus-screwed-through-rod` turned rigidly so that the rod's axis runs along//! w = (1, 2, 2)/3, with u = (2, −2, 1)/3 and v = (2, 1, −2)/3: a rod (radius 5, from the origin to//! 20w) grooved by a torus wheel (radii 6 and 2 about 11.5u, its axis cos h·v − sin h·w) carried//! along the screw about the rod's axis rising 30 a turn, from −108° to +348°.//!//! Built as the original is, every point and direction it places at (x, y, z) placed at//! x·u + y·v + z·w: the kernel's sweep of a solid (`sweep_clip_less`, else `sweep_solid_within`//! inside the rod's cylinder of radius 5.5 from −1 to 21 along w), 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, Vec3,
};
use std::f64::consts::TAU;
/// The point (or direction) the upright case puts at (x, y, z), here at x·u + y·v + z·w.fnat(x: f64, y: f64, z: f64) -> Vec3 {
let (u, v, w) = (p(2.0, -2.0, 1.0).scale(1.0 / 3.0), p(2.0, 1.0, -2.0).scale(1.0 / 3.0),
p(1.0, 2.0, 2.0).scale(1.0 / 3.0));
u.scale(x).add(v.scale(y)).add(w.scale(z))
}
pubfnbuild() -> Result<BrepSolid, Refusal> {
let rod = make_cylinder_brep(p(0.0, 0.0, 0.0), at(0.0, 0.0, 1.0), 5.0, 20.0)?;
let h = (TAU * 5.5 / 30.0).atan();
let wheel = SweptTool::Revolved {
axis_origin: at(11.5, 0.0, 0.0),
axis_direction: at(0.0, h.cos(), -h.sin()),
radial: at(-1.0, 0.0, 0.0),
meridian: vec![OutlinePiece::Arc { centre: [6.0, 0.0], radius: 2.0, start: 0.0, end: TAU }],
};
let screw = SolidMotion {
steps: vec![ScrewStep {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: at(0.0, 0.0, 1.0),
turn: 1.0,
advance: 30.0 / TAU,
}],
from: (-108.0f64).to_radians(),
to: 348.0f64.to_radians(),
};
let around_rod = SweepClip {
axis_origin: p(0.0, 0.0, 0.0),
axis_direction: at(0.0, 0.0, 1.0),
reference: at(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
30 ms; CPU time 33 ms; peak memory 9.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
1460.630003
1460.630003
2.2e-12
area
791.5632228
791.5632226
3.5e-10
agrees with
cad-kernel, next.BREP, springrep
mesh
5528 triangles, closed
centre of gravity
(3.30109, 6.58448, 6.76497) its STEP's solid
inertia
about it, of unit density: Ixx 51876.5; Iyy 40732.9; Izz 39680.6; Ixy -9929.84; Iyz -17056.6; Izx -10060.5
//! `swept/torus-screwed-through-rod` turned rigidly so that the rod's axis runs along//! w = (1, 2, 2)/3, with u = (2, −2, 1)/3 and v = (2, 1, −2)/3: a rod (radius 5, from the origin//! to 20w) grooved by a wheel (a torus of radii 6 and 2 about 11.5u, its axis cos h·v − sin h·w,//! h = atan(2π·5.5/30)) screwed about the rod's axis, rising 30 a turn, from −108° to 348°.//!//! The wheel is cadrs's torus primitive and the rod a circle extruded; cadrs's cut by a swept//! solid.usecrate::bench::{cylinder, p3, torus, v3};
usecrate::shared::swept::{cut_swept, screw};
usecrate::Refusal;
use cadrs_kernel::{Axis, BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let (u, v, w) = (v3(2.0, -2.0, 1.0) / 3.0, v3(2.0, 1.0, -2.0) / 3.0, v3(1.0, 2.0, 2.0) / 3.0);
let o = p3(0.0, 0.0, 0.0);
let h = (std::f64::consts::TAU * 5.5 / 30.0).atan();
let wheel = torus(k, o + u * 11.5, v * h.cos() - w * h.sin(), 6.0, 2.0)?;
let r = cylinder(k, o, w, 5.0, 20.0)?;
cut_swept(k, r, wheel, &screw(Axis::new(o, w), 30.0, -108.0, 348.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
511 ms; CPU time 509 ms; peak memory 33.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.
Data
its STEP's
expected
rel. error
volume
1460.630003
1460.630003
5.6e-10
area
791.5632231
791.5632226
6.4e-10
agrees with
cad-kernel, next.BREP, cadrs
mesh
8086 triangles, closed
centre of gravity
(3.30109, 6.58448, 6.76497) its STEP's solid
inertia
about it, of unit density: Ixx 51876.5; Iyy 40732.9; Izz 39680.6; Ixy -9929.84; Iyz -17056.6; Izx -10060.5
//! `swept/torus-screwed-through-rod` turned rigidly so that the rod's axis runs along//! w = (1, 2, 2)/3, with u = (2, −2, 1)/3 and v = (2, 1, −2)/3: the rod of radius 5 about the line//! through the origin along w, from the origin to 20w, less everything a torus wheel (radii 6 and 2//! about 11.5u, its axis cos h·v − sin h·w, h = atan(2π·5.5/30)) passes through as it is screwed//! about that line, rising 30 a turn, from −108° to 348°.//!//! Built as the original is, each frame and direction it places at (x, y, z) placed at//! x·u + y·v + z·w: the shared rod and reach cylinders written out on frames along w, the shared//! screw about w.use std::f64::consts::PI;
use springrep::boolean::{difference, intersection};
use springrep::math::{Point3, Vec3};
use springrep::primitive::{cylinder, torus};
use springrep::sweep::{solid, Helix, Motion};
use springrep::topo::Brep;
usecrate::shared::swept::deg;
usecrate::shared::{e, frame};
constU: [f64; 3] = [2.0 / 3.0, -2.0 / 3.0, 1.0 / 3.0];
constV: [f64; 3] = [2.0 / 3.0, 1.0 / 3.0, -2.0 / 3.0];
constW: [f64; 3] = [1.0 / 3.0, 2.0 / 3.0, 2.0 / 3.0];
/// The point (or direction) the upright case puts at (x, y, z), here at x·u + y·v + z·w.fnat(x: f64, y: f64, z: f64) -> [f64; 3] {
[0, 1, 2].map(|i| x * U[i] + y * V[i] + z * W[i])
}
pubfnbuild() -> Result<Brep, String> {
let h = (2.0 * PI * 5.5 / 30.0).atan();
let axis = frame(at(11.5, 0.0, 0.0), at(0.0, h.cos(), -h.sin()), U)?;
let wheel = torus(&axis, 6.0, 2.0, "wheel").map_err(e)?;
// No sweep of the whole tool: a screw keeps each point's distance from its axis, so only the// tool within 5.5 of it reaches the rod, and only that part is swept.let reach = cylinder(&frame(at(0.0, 0.0, -100.0), W, U)?, 5.5, 200.0, "reach").map_err(e)?;
let rim = intersection(&wheel, &reach).map_err(e)?;
let screw = Motion::Screw {
screw: Helix { origin: Point3::ZERO, axis: Vec3::from_array(W), rise: 30.0 / (2.0 * PI), sign: 1.0 },
from: deg(-108.0),
to: deg(348.0),
};
let swept = solid(&rim, &screw, "screw").map_err(e)?;
let rod = cylinder(&frame([0.0, 0.0, 0.0], W, U)?, 5.0, 20.0, "rod").map_err(e)?;
difference(&rod, &swept).map_err(e)
}
geomsolver 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.
anvilcad left no solid to show.
Time
1.2 ms; CPU time 1000 µs; peak memory 3.4 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 tilted rod grooved by a wheel screwed along it.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())
}