A cylinder of radius 3 about the z axis, from its flat bottom at z = −10 up to where the plane z = x·tan 45° cuts it: the plane crosses the axis at z = 0 and leans at 45° to the bottom, so the top is the ellipse it cuts from the cylinder, with semi-axes 3 and 3/cos 45°.
Grow it by 1 with rounded edges: the solid of every point within 1 of it. It is convex, so each face moves out by 1 along its normal, the bottom circle's edge becomes a piece of a torus, the elliptic edge where the slanted top meets the side becomes a canal surface (the envelope of the balls of radius 1 along the ellipse), and the faces stay tangent to one another.
By Steiner's formula for a convex body K grown by d, its volume is V₀ + S₀d + Md² + 4πd³/3 and its area S₀ + 2Md + 4πd², where V₀ and S₀ are K's volume and area and M is its integrated mean curvature: the side's 10π (its area 60π times the mean curvature 1/6, the plane's top crossing the axis at z = 0), plus half of each edge's turning angle integrated along it, 3π²/2 for the bottom circle (a right angle along 6π) and J/2 for the ellipse, where the angle between the top's normal and the side's at the point (3 cos φ, 3 sin φ, 3 cos φ·tan α) is arccos(−sin α cos φ) and the ellipse's length element is 3√(1 + tan²α sin²φ) dφ. J has no elementary closed form; the value above is it to twelve places (any quadrature agrees to well under the grade).
As a set:
$$\{ p : \operatorname{dist}(p, K) \le 1 \},\quad K = \{ x^2 + y^2 \le 9,\ -10 \le z \le x\tan 45^\circ \}$$
† 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.11 s; CPU time 2.40 s; peak memory 24.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
607.9105598
607.9105597
2.4e-10
area
397.7673923
397.7673924
2.3e-10
agrees with
kentron, next.BREP, springrep
mesh
26844 triangles, closed
centre of gravity
(0.291405, 4.88617e-09, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy 8.80303e-06; Iyz -1.3313e-05; Izx -1019.31
//! The cylinder of radius 3 on the z axis from its flat bottom at z = −10 up to where the plane//! z = x·tan 45° cuts it, grown by 1 with rounded edges: every point within 1 of it.use cad_kernel::build::{disc, kept, prism};
use cad_kernel::offset::{grown, Join};
use cad_kernel::topo::Brep;
constRADIUS: f64 = 3.;
constBOTTOM: f64 = -10.;
constTILT_DEGREES: f64 = 45.;
constGROWTH: f64 = 1.;
pubfnbuild() -> Result<Brep, String> {
// a cylinder reaching up past where the plane leaves it, at most 3 above the originlet cylinder = prism(&disc([0., 0., BOTTOM], [0., 0., 1.], RADIUS), 0., 2. * -BOTTOM)?;
// kept below the plane through the origin that leans at the tilt about y, on the side of its// downward normallet tilt = TILT_DEGREES.to_radians();
let slanted = kept(&cylinder, [0., 0., 0.], [tilt.sin(), 0., -tilt.cos()], 0.)?;
grown(&slanted, GROWTH, Join::Round)
}
Time
652 ms; CPU time 652 ms; peak memory 368.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.
Data
its STEP's
expected
rel. error
volume
607.9105804
607.9105597
3.4e-08
area
397.7674092
397.7673924
4.2e-08
agrees with
no other kernel
mesh
30420 triangles, closed
centre of gravity
(0.291405, -1.0296e-07, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy 2.34679e-05; Iyz 0.000254803; Izx -1019.31
"""A cylinder cut by a plane at 45° and grown by 1. A cylinder of radius 3 about the z axis, from its flat bottom at z = −10 up to where the plane
z = x·tan 45° cuts it: the plane crosses the axis at z = 0 and leans at 45° to the bottom, so the
top is the ellipse it cuts from the cylinder, with semi-axes 3 and 3/cos 45°.
Grow it by 1 with rounded edges: the solid of every point within 1 of it. It is convex, so
each face moves out by 1 along its normal, the bottom circle's edge becomes a piece of a torus,
the elliptic edge where the slanted top meets the side becomes a canal surface (the envelope of the
balls of radius 1 along the ellipse), and the faces stay tangent to one another.
By Steiner's formula for a convex body K grown by d, its volume is V₀ + S₀d + Md² + 4πd³/3 and its
area S₀ + 2Md + 4πd², where V₀ and S₀ are K's volume and area and M is its integrated mean
curvature: the side's 10π (its area 60π times the mean curvature 1/6, the plane's top crossing the
axis at z = 0), plus half of each edge's turning angle integrated along it, 3π²/2 for the bottom
circle (a right angle along 6π) and J/2 for the ellipse, where the angle between the top's normal
and the side's at the point (3 cos φ, 3 sin φ, 3 cos φ·tan α) is arccos(−sin α cos φ) and the
ellipse's length element is 3√(1 + tan²α sin²φ) dφ. J has no elementary closed form; the value
above is it to twelve places (any quadrature agrees to well under the grade)."""import math
fromOCP.BRepAlgoAPIimportBRepAlgoAPI_CommonfromOCP.BRepBuilderAPIimport (BRepBuilderAPI_MakeFace, BRepBuilderAPI_MakePolygon,
BRepBuilderAPI_MakeSolid)
fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeCylinder, BRepPrimAPI_MakePrismfromOCP.TopAbsimportTopAbs_ShapeEnumfromOCP.TopoDSimportTopoDSfromOCP.gp import gp_Ax2, gp_Dir, gp_Pnt, gp_Vec
from bench importRefusedfrom offset import offset
TILT = 45GROWTH = 1.0defbuild():
t = math.tan(math.radians(TILT))
cylinder = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, -10), gp_Dir(0, 0, 1)), 3, 30).Shape()
# The plane's half-space below it: a long prism on its trace in the plane y = -10.
trace = BRepBuilderAPI_MakePolygon(gp_Pnt(-20, -10, -20 * t), gp_Pnt(20, -10, 20 * t),
gp_Pnt(20, -10, -40), gp_Pnt(-20, -10, -40), True)
below = BRepPrimAPI_MakePrism(BRepBuilderAPI_MakeFace(trace.Wire()).Face(), gp_Vec(0, 20, 0))
cut = BRepAlgoAPI_Common(cylinder, below.Shape())
ifnot cut.IsDone():
raiseRefused("BRepAlgoAPI_Common could not cut the cylinder")
grown = offset(cut.Shape(), GROWTH)
# OCCT's offset gives this solid back as its closed shell; the solid is the one it bounds.if grown.ShapeType() == TopAbs_ShapeEnum.TopAbs_SHELL:
grown = BRepBuilderAPI_MakeSolid(TopoDS.Shell(grown)).Solid()
return grown
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
31 ms; CPU time 30 ms; peak memory 13.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
607.9105595
607.9105597
3.4e-10
area
397.7673922
397.7673924
3.5e-10
agrees with
cad-kernel, next.BREP, springrep
mesh
32132 triangles, closed
centre of gravity
(0.291405, -3.52337e-16, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy 1.86563e-13; Iyz 1.6349e-12; Izx -1019.31
//! The cylinder of radius 3 about the z axis from z = −10 up to where the plane z = x·tan 45° cuts//! it, grown by 1: every point within 1 of it. The bottom rim becomes a piece of a torus, the//! elliptic top rim a canal surface about the ellipse.usecrate::Refusal;
usecrate::shared::offset::slant_cut_cylinder;
use kentron::offset::{self, Join};
use kentron::topology::{Model, Shape};
use std::f64::consts::FRAC_PI_4;
pubfnbuild(m: &mutModel) -> Result<Shape, Refusal> {
let cylinder = slant_cut_cylinder(m, FRAC_PI_4)?;
Ok(offset::shape(m, cylinder, 1.0, Join::Arc)?)
}
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
830 ms; CPU time 826 ms; peak memory 63.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
607.9105258
607.9105597
5.6e-08
area
397.7673799
397.7673924
3.1e-08
agrees with
no other kernel
mesh
30898 triangles, closed
centre of gravity
(0.291405, 1.52622e-08, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy -2.57421e-05; Iyz -7.21175e-05; Izx -1019.31
//! A cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 45°, grown by 1://! every point within 1 of it, its bottom rim a piece of a torus and its elliptic top rim a tube//! about the ellipse, SolidCraft's offset of the whole solid (`offset_solid`), its convex edges//! rounded.usecrate::solids::*;
/// The cylinder of radius 3 from z = −10, cut off by the plane z = x·tan `degrees`: it runs up/// past the plane, and the half-space above the plane, a block on z > 0 turned −`degrees` about/// the y axis (its face's normal then (−sin, 0, cos)), is cut from it.pubfnslant_cut_cylinder(degrees: f64) -> R<Body> {
let top = 3.0 * degrees.to_radians().tan();
let cylinder = zcyl(0.0, 0.0, 3.0, -10.0, 1.0 + top)?;
let above = block((-30.0, -30.0, 0.0), (30.0, 30.0, 30.0))?;
let above = solidcraft_kernel::transform(&above, Vec3::ZERO, Vec3::ZERO, Vec3::Y, -degrees.to_radians())?;
cut(&cylinder, &above)
}
pubfnbuild() -> R<Body> {
solidcraft_kernel::offset_solid(&slant_cut_cylinder(45.0)?, 1.0, true)
}
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
12 ms; CPU time 11 ms; peak memory 18.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
607.9105597
607.9105597
1.9e-16
area
397.7673924
397.7673924
1.4e-16
agrees with
cad-kernel, kentron, springrep
mesh
36766 triangles, closed
centre of gravity
(0.291405, -4.3104e-17, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy 4.53648e-13; Iyz 5.61163e-15; Izx -1019.31
//! A cylinder cut by a plane at 45° and grown by 1: the cylinder of radius 3 on the z axis from z = −10, cut by the plane z = x·tan 45°//! (the part below it kept), grown by 1.0 with rounded edges.//!//! The cylinder is the kernel's; the plane's half-space is a long prism on its trace in the plane//! y = −10, extruded 20 along +y, and the two are intersected. Then the kernel's rounded offset.usecrate::solids::boolean::common;
usecrate::solids::offset::parallel;
usecrate::solids::{p, polygon};
usecrate::Refusal;
use brep_kernel::{extrude_profile_brep, make_cylinder_brep, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let t = (45f64).to_radians().tan();
let cylinder = make_cylinder_brep(p(0.0, 0.0, -10.0), p(0.0, 0.0, 1.0), 3.0, 30.0)?;
let trace = polygon(&[
p(-20.0, -10.0, -20.0 * t),
p(20.0, -10.0, 20.0 * t),
p(20.0, -10.0, -40.0),
p(-20.0, -10.0, -40.0),
])?;
let below = extrude_profile_brep(&trace, p(0.0, 1.0, 0.0), 20.0)?;
Ok(parallel(&common(&cylinder, &below)?, 1.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
27 ms; CPU time 48 ms; peak memory 11.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
607.9105695
607.9105597
1.6e-08
area
397.7673979
397.7673924
1.4e-08
agrees with
no other kernel
mesh
33222 triangles, closed
centre of gravity
(0.291405, -1.63636e-16, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy -2.11953e-13; Iyz 2.14963e-14; Izx -1019.31
//! A cylinder cut by a plane at 45° and grown by 1: the cylinder of radius 3 on the z axis from z = −10, cut by the plane z = x·tan 45°//! (the part below it kept), grown by 1.0 with rounded edges.//!//! The cylinder is cadrs's primitive; the plane's half-space is a long prism on its trace in the//! Front plane, extruded both ways, and the two are intersected. Then cadrs's offset with rounded//! edges.usecrate::bench::{common, cylinder, extrude_symmetric, p3, v3};
usecrate::shared::offset::grown;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Loop, Plane, Profile};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let t = (45f64).to_radians().tan();
let c = cylinder(k, p3(0.0, 0.0, -10.0), v3(0.0, 0.0, 1.0), 3.0, 30.0)?;
// the Front plane's sketch (x, y) is the model's (x, z)let trace = Loop::polygon(&[[-20.0, -20.0 * t], [20.0, 20.0 * t], [20.0, -40.0], [-20.0, -40.0]]);
let below = extrude_symmetric(k, &Profile::of(Plane::xz(0.0), vec![trace]), 40.0)?;
let cut = common(k, c, below)?;
grown(k, cut, 1.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
87 ms; CPU time 87 ms; peak memory 13.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
607.9105597
607.9105597
5.8e-12
area
397.7673924
397.7673924
6.0e-12
agrees with
cad-kernel, kentron, next.BREP
mesh
32596 triangles, closed
centre of gravity
(0.291405, -8.61219e-17, -4.71968) its STEP's solid
inertia
about it, of unit density: Ixx 10764.2; Iyy 10695.1; Izz 4718.97; Ixy -4.59561e-14; Iyz 1.10921e-12; Izx -1019.31
//! The cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 45°, grown by//! 1: its elliptic top edge becomes a canal surface, its bottom rim a piece of a torus.use springrep::topo::Brep;
usecrate::shared::offset::{grown, slant_cut_cylinder};
pubfnbuild() -> Result<Brep, String> {
grown(&slant_cut_cylinder(45.)?, 1.)
}
geomsolver left no solid to show.
Time
64 ms; CPU time 75 ms; peak memory 29 MB
Notes
refused error[E080]: `grown.body`: a cylinder's face that is no band between two circles about its axis, a bore no wider than the reach, or a band shorter than it between its feet: read by the field
// A cylinder of radius 3 about the z axis, from its flat bottom at z = −10 up to the plane through// the origin leaning at 45° to the bottom, z = x·tan 45°, grown by 1 with rounded edges. The cut// cylinder is the region within 3 of the axis, above the plane z = −10 and behind the slanted plane// (behind its normal, the axis `lean`, which is z turned 45° about y toward −x); grown, it is the// points within 1 of it, `std.rounds.Grown`'s body.unit mm
use std
use std.sets
use std.rounds
o := point
fix((0, 0, 0)) o
up := point
fix((0, 0, 1)) up
z_axis := line(o, up)
lean := axis hint(dir: (-0.5, 0, 0.87))
lean perpendicular std.y
lean angle(45deg, about: std.y) std.z
cut_cylinder := solid({ p |
p in std.sets.Cylinder(z_axis, r: 3mm)
p distance(>= -10mm, along: n) std.top
p in std.sets.HalfSpace(o, lean, d: 0mm)
})
grown := std.rounds.Grown(cut_cylinder, d: 1mm)
part := solid(grown.body)
anvilcad left no solid to show.
Time
1.3 ms; CPU time 1.1 ms; peak memory 3.6 MB
Notes
refused anvil-brep's offset moves each face along its normal and extends the moved faces until they meet, keeping the solid's edges; it adds no round about a convex edge or corner, so it cannot grow a solid to every point within a distance of it
//! A cylinder cut by a plane at 45° and grown by 1, grown with its convex edges rounded.use anvil_brep::Solid;
pubfnbuild() -> Result<Solid, String> {
Err("anvil-brep's offset moves each face along its normal and extends the moved faces until they meet, keeping the solid's edges; it adds no round about a convex edge or corner, so it cannot grow a solid to every point within a distance of it".into())
}