The solid a square bar fills as it is carried round on a planet, turning about its own center against the carrier as a planet gear does.
The bar is a prism standing from z = 0 to z = 2, its section the square of side 2 centered at (5, 0) with its sides along x and y.
It moves with one parameter t, from 0° to 360°: its center is carried round the circle of radius 5 about the z axis, to (5 cos t, 5 sin t), and the bar turns about its own center by −2t, so that it turns by −3t relative to the carrier. Make the solid of everything the bar passes through.
Its section sweeps a region of the plane bounded by envelopes of its sides and the trochoids its corners trace; the solid is that region carried from z = 0 to z = 2.
expected
closed form
volume
155.3366775
no closed form: cad-kernel, next.BREP and cadrs agree to 5e-9; the mean of their values
area
282.192712
no closed form: cad-kernel, next.BREP and cadrs agree to 4e-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
276 ms; CPU time 532 ms; peak memory 27.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
155.3366773
155.3366775
1.7e-09
area
282.192712
282.192712
1.3e-10
agrees with
kentron, next.BREP, cadrs, springrep
mesh
411740 triangles, closed
centre of gravity
(-2.4878e-14, 2.49685e-16, 1) its STEP's solid
inertia
about it, of unit density: Ixx 2039.37; Iyy 2039.37; Izz 3975.18; Ixy -4.61853e-14; Iyz -1.45698e-18; Izx -7.99361e-15
//! The solid a square bar fills carried round on a planet: the prism from z = 0 to 2 on the square//! of side 2 centred at (5, 0), its centre carried round the circle of radius 5 about z by t while//! it turns about its own centre by −2t (by −3t against the carrier), t from 0° to 360°.//!//! Two turns about parallel axes at different rates are no constant twist, but every pose keeps the//! plane z = 0, and the bar is a prism square to it: `swept::closed::closed` builds the region the//! square sweeps in that plane — the envelopes of its sides and the trochoids its corners trace, each//! stretch kept where it stands outside the square at every pose; the roll is a whole period, so no//! end pose bounds it — fitted and carried from z = 0 to 2 (#880 Q2), and judges it by the sweep's//! definition before returning it.usecrate::sketch::block;
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;
pubfnbuild() -> Result<Brep, String> {
let bar = block([4., -1., 0.], [6., 1., 2.])?;
let up = [0., 0., 1.];
// on the carrier the bar turns by −3t about its own centre; the carrier turns by t about z.// The motion is the planet's turn seen from a frame turning by −t about z (`Relative`: at each// t the source's pose, then the observer's undone), so the carrier's turn is put back.let planet = Trajectory::Twist(Screw {
origin: [5., 0., 0.], axis: up, ratio: -3., advance: 0.,
});
let carrier = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: up, ratio: -1., advance: 0.,
});
let path = Trajectory::Relative { source: Box::new(planet), observer: Box::new(carrier) };
// no constant twist, but a motion keeping the bar's plane: its section's planar sweep, extrudedclosed(&bar, &path, [0., TAU], bar.size(), tolerance(bar.size()))
.map_err(|why| format!("the bar's sweep not built: {why:?}"))
}
occt left no solid to show.
Time
624 ms; CPU time 623 ms; peak memory 356.5 MB
Notes
refused occt has no sweep of a solid along a planet's motion: it slides, turns about one axis, or follows a path with its tangent, and the bar turns against the circle its centre runs on; the walls are envelopes of its sides, which occt has no operation to find
"""A square bar carried round on a planet gear. The solid a square bar fills as it is carried round
on a planet, turning about its own center against the carrier as a planet gear does.
The bar is a prism standing from z = 0 to z = 2, its section the square of side 2 centered at (5,
0) with its sides along x and y.
It moves with one parameter t, from 0° to 360°: its center is carried round the circle of radius 5
about the z axis, to (5 cos t, 5 sin t), and the bar turns about its own center by −2t, so that it
turns by −3t relative to the carrier. Make the solid of everything the bar passes through.
Its section sweeps a region of the plane bounded by envelopes of its sides and the trochoids its
corners trace; the solid is that region carried from z = 0 to z = 2."""from bench importRefuseddefbuild():
# The bar turns about its own centre by −2t while its centre is carried round the z axis# by t: its axis of turning moves. OCCT's sweeps slide (BRepPrimAPI_MakePrism), turn about# one axis (BRepPrimAPI_MakeRevol) or carry a shape along a path under a law of its# trihedron (BRepOffsetAPI_MakePipe, MakePipeShell), and along the circle the centre runs# on the bar turns against that circle's own frame. And its flat sides touch what they# sweep along lines that move across them: the walls are envelopes of the sides and# trochoids of the corners, which occt has no operation to find.raiseRefused("occt has no sweep of a solid along a planet's motion: it slides, turns about ""one axis, or follows a path with its tangent, and the bar turns against the ""circle its centre runs on; the walls are envelopes of its sides, 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.15 s; CPU time 2.18 s; peak memory 11.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
155.3366773
155.3366775
1.7e-09
area
282.192712
282.192712
1.2e-10
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
12930 triangles, closed
centre of gravity
(-7.07106e-16, -6.04187e-16, 1) its STEP's solid
inertia
about it, of unit density: Ixx 2039.37; Iyy 2039.37; Izz 3975.18; Ixy 1.59872e-13; Iyz 2.51525e-16; Izx 3.55271e-15
//! The solid a square bar fills as it is carried round on a planet: the prism from z = 0 to z = 2//! on the square of side 2 centred at (5, 0), its sides along x and y, its centre carried round//! the circle of radius 5 about the z axis to (5 cos t, 5 sin t) while it turns about its centre//! by −2t, for t from 0° to 360°.//!//! The motion is given by its places (`sweep::RigidMotion::Carried`): the bar's turn about its//! own centre by −3t, then the carrier's turn by t about the z axis. Its sweep is kentron's sweep//! of a solid (`sweep::solid`), which refuses it: as the bar turns against the carrier, the lines//! where the motion grazes its sides move over them, so its envelope is no product of a fixed//! curve and the motion, and kentron's sweep builds only those.usecrate::bench::p;
use kentron::math::{Axis, Direction, Transform};
use kentron::primitives::Cuboid;
use kentron::sweep::{self, Carriage, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::TAU;
use std::sync::Arc;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let bar = Cuboid::from_corners(p(4.0, -1.0, 0.0), p(6.0, 1.0, 2.0)).build(m)?;
let place = |s: f64| {
let t = s * TAU;
Transform::rotation(Axis::Z, t) * Transform::rotation(Axis::new(p(5.0, 0.0, 0.0), Direction::Z), -3.0 * t)
};
sweep::solid(m, bar, &RigidMotion::Carried(Carriage(Arc::new(place))))
}
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.6 ms; peak memory 4.5 MB
Notes
refused no layer (solidcraft-kernel, solidcore-ops, solidcore) has a sweep of a solid or an envelope: the bar turns about its own centre as that is carried round the z axis, so its sweep is bounded by the envelopes of its sides and the trochoids of its corners
//! Refused. The bar moves by two turns at once, about the z axis and about its own centre carried//! round it, so no line of it stays fixed: its section sweeps a region bounded by the envelopes//! of its sides and the trochoids its corners trace. solidcraft-kernel has no sweep of a solid,//! no envelope and no trochoid, and those 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: the bar turns about its own \
centre as that is carried round the z axis, so its sweep is bounded by the envelopes of \
its sides and the trochoids of its corners"
.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.2 ms; CPU time 3 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 square bar carried round on a planet gear.//// 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
101 ms; CPU time 101 ms; peak memory 24.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
155.3366773
155.3366775
1.7e-09
area
282.192712
282.192712
1.3e-10
agrees with
cad-kernel, kentron, cadrs, springrep
mesh
680892 triangles, closed
centre of gravity
(1.75888e-15, -2.65842e-16, 1) its STEP's solid
inertia
about it, of unit density: Ixx 2039.37; Iyy 2039.37; Izz 3975.18; Ixy 1.70886e-12; Iyz 1.41934e-16; Izx -3.18412e-13
//! Everything a square bar passes through as it is carried round on a planet, turning about its own//! centre against the carrier.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism): the bar is//! the prism of the square of side 2 about (5, 0) from z = 0 to z = 2. At t its centre is carried//! by t about the z axis and the bar turns by −2t about its centre, so it is first turned by −3t//! about the vertical line through (5, 0) and then by t about the z axis, for t from 0° to 360°.//! Asked for within 9 of the z axis from z = 0 to 2 (a prism's sweep is asked for between its//! ends), which holds the whole sweep.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, sweep_solid_within, BooleanOperation, BrepSolid, OutlinePiece,
ScrewStep, SolidMotion, SweepClip, SweptTool,
};
use std::f64::consts::TAU;
pubfnbuild() -> Result<BrepSolid, Refusal> {
let z = p(0.0, 0.0, 1.0);
let corners = [[4.0, -1.0], [6.0, -1.0], [6.0, 1.0], [4.0, 1.0]];
let bar = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: z,
x_axis: p(1.0, 0.0, 0.0),
outline: (0..4).map(|k| OutlinePiece::Line { from: corners[k], to: corners[(k + 1) % 4] }).collect(),
from: 0.0,
to: 2.0,
};
let planet = SolidMotion {
steps: vec![
ScrewStep { axis_origin: p(5.0, 0.0, 0.0), axis_direction: z, turn: -3.0, advance: 0.0 },
ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: z, turn: 1.0, advance: 0.0 },
],
from: 0.0,
to: TAU,
};
let around = SweepClip {
axis_origin: p(-20.0, 0.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [0.0, 30.0],
axial: [0.0, 2.0],
angle: None,
};
let bodies = sweep_solid_within(&bar, &planet, &around)?;
Ok(boolean_operation_nary(&bodies, BooleanOperation::Union)?)
}
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
92 ms; CPU time 225 ms; peak memory 8.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.
Data
its STEP's
expected
rel. error
volume
155.3366781
155.3366775
3.4e-09
area
282.1927121
282.192712
2.5e-10
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
83816 triangles, closed, 12 degenerate
centre of gravity
(1.00714e-12, -5.56594e-13, 1) its STEP's solid
inertia
about it, of unit density: Ixx 2039.37; Iyy 2039.37; Izz 3975.18; Ixy -8.22897e-06; Iyz -3.33149e-16; Izx -8.65974e-15
//! The solid a square bar (the prism from z = 0 to 2 on the square of side 2 about (5, 0)) fills//! as it is carried round the z axis a whole turn while turning about its own centre by −2t, as a//! planet gear on its carrier.//!//! cadrs's sweep of a solid in its planes (`SolidMotion::Planar`, its steps applied in order at//! each instant): a turn of −3t about the bar's centre, then the carrier's turn of t about the z//! axis; a prism along the motion's normal fills the region its section sweeps, extruded.usecrate::bench::{block, p3, v3};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Kernel, PlanarStep, SolidMotion};
use std::f64::consts::TAU;
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let bar = block(k, p3(4.0, -1.0, 0.0), p3(6.0, 1.0, 2.0))?;
let steps = vec![
PlanarStep::Turn { about: p3(5.0, 0.0, 0.0), from: 0.0, to: -3.0 * TAU },
PlanarStep::Turn { about: p3(0.0, 0.0, 0.0), from: 0.0, to: TAU },
];
let motion = SolidMotion::Planar { normal: crate::bench::unit(v3(0.0, 0.0, 1.0)), steps };
Ok(k.sweep_solid(bar, &motion)?.first()?)
}
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.44 s; CPU time 8.44 s; peak memory 42.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
155.3366773
155.3366775
1.7e-09
area
282.1927119
282.192712
2.7e-10
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
65036 triangles, closed
centre of gravity
(2.63755e-12, -1.0968e-11, 1) its STEP's solid
inertia
about it, of unit density: Ixx 2039.37; Iyy 2039.37; Izz 3975.18; Ixy -1.10077e-09; Iyz 9.99273e-10; Izx -9.37028e-14
//! The solid a square bar (side 2, from z = 0 to 2) fills as it is carried round the circle of//! radius 5 while turning by −2t about its own center.use std::f64::consts::PI;
use springrep::math::{Point3, Vec3};
use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, v3};
pubfnbuild() -> Result<Brep, String> {
let bar = boxed([4.0, -1.0, 0.0], [6.0, 1.0, 2.0], "bar")?;
// turned by −3t about its own center, then carried by t about the z axis: by −2t in alllet planet = Motion::Then(
Box::new(Motion::Turn {
origin: v3(5.0, 0.0, 0.0),
axis: Vec3::Z,
from: 0.0,
to: -6.0 * PI,
}),
Box::new(Motion::Turn {
origin: Point3::ZERO,
axis: Vec3::Z,
from: 0.0,
to: 2.0 * PI,
}),
);
solid(&bar, &planet, "planet").map_err(e)
}
geomsolver left no solid to show.
Time
48 ms; CPU time 48 ms; peak memory 24.8 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a square bar fills as it is carried round on a planet. The carrier turns about z by// t; the planet, riding it, turns about the carrier's pin (5 out along x, carried round with it)// by -3t against it, so the bar turns -2t in the world. The bar is the square of side 2 about the// pin, sides along x and y, drawn in the planet's block, and the prism over it from z = 0 to 2;// it rides both frames, so the part is the kernel's sweep of the bar as the roll t runs 0..360// degrees.unit mm
use std
use std.solids
use std.place (coords)
use std.shapes
use std.motion (spins)
in std.top {
private o := point
fix((0, 0)) o
}
in (carrier := frame) {
in std.top {
private pin := point
pin coords(du: 5mm, dv: 0mm) std.top
}
in (planet := frame) {
in std.top {
private c := point
c coords(du: 5mm, dv: 0mm) std.top
private sq := std.shapes.CenteredRectangle(c, w: 2mm, h: 2mm)
}
construction bar := solid(std.solids.Prism(sq.loop, from: 0mm, to: 2mm))
}
}
carrier spins(1) o
planet spins(-3) pin
part := solid({ p | some t in (0deg, 360deg): p in bar at t })
anvilcad left no solid to show.
Time
1.1 ms; CPU time 960 µs; peak memory 3.4 MB
Notes
refused anvil-brep has no sweep of a solid: the cutter, carried by two motions at once relative to the blank, sweeps envelopes of its faces that it would have to compute itself
//! A square bar carried round on a planet gear.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep has no sweep of a solid: the cutter, carried by two motions at once relative to the blank, sweeps envelopes of its faces that it would have to compute itself".into())
}