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 4 with rounded edges: the solid of every point within 4 of it. It is convex, so each face moves out by 4 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 4 along the ellipse), and the faces stay tangent to one another.
4 is more than the ellipse's least radius of curvature, b²/a = 9/(3/cos 45°) = 2.121320 at the ends of its long axis, so the whole tube of radius 4 about the ellipse would cross itself on the ellipse's inner side. The canal face is only the part of that tube between the top's normal and the side's, on the outer side, where it stays smooth: the solid is convex and the formula below holds for every d.
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 4 \},\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
444 ms; CPU time 1.08 s; peak memory 16.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
2605.410724
2605.410728
1.3e-09
area
971.5984972
971.5984982
1.0e-09
agrees with
kentron, next.BREP, springrep
mesh
32350 triangles, closed
centre of gravity
(0.378888, -4.09241e-11, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy -2.74374e-07; Iyz 5.67626e-07; Izx -7535.88
//! 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 4 with rounded edges: every point within 4 of it.//!//! 4 is more than the ellipse's least radius of curvature, b²/a = 2.121320 at the ends of its//! long axis; the round along the ellipse is only the part of the tube of radius 4 between the//! top's normal and the side's, on the ellipse's outer side, where it stays smooth.//!//! Refused, by the kernel: "the join of face 0 (cylinder) and `far` (plane): the ellipse turns on//! a radius of 2.1213… at [3, 0, 3], tighter than the tube's 4: the tube would fold".//! `offset::grown` joins a solid's convex crease by the whole tube about it (`offset::tube`, along//! an ellipse `swept::canal::ring`), whose curvature row refuses any curve turning tighter than the//! distance; the wedge of the tube between the two faces' normals (`offset::wedge`) is built only//! along a line or a circle. Growing in two steps (by 2, then by the rest) is refused too: the//! first step's round is a face family, which `offset::normal_sweep` does not move ("a family has//! no offset in closed form").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 = 4.;
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
640 ms; CPU time 640 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
2605.410823
2605.410728
3.7e-08
area
971.5985251
971.5984982
2.8e-08
agrees with
cadrs
mesh
37078 triangles, closed
centre of gravity
(0.378888, 3.97526e-08, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy 0.000517095; Iyz -0.000286882; Izx -7535.88
"""A cylinder cut by a plane at 45° and grown by 4. 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 4 with rounded edges: the solid of every point within 4 of it. It is convex, so
each face moves out by 4 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 4 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 = 4.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
30 ms; CPU time 30 ms; peak memory 13.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
2605.410725
2605.410728
1.2e-09
area
971.5984972
971.5984982
1.0e-09
agrees with
cad-kernel, next.BREP, springrep
mesh
29286 triangles, closed
centre of gravity
(0.378888, -8.51883e-16, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy 6.21209e-12; Iyz 2.46962e-11; Izx -7535.88
//! 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 4: every point within 4 of it. The bottom rim becomes a piece of a torus, the//! elliptic top rim a canal surface about the ellipse. The distance is more than the ellipse's least radius of curvature, 2.12: the canal face is//! the outer part of the tube, where it stays smooth.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, 4.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
971 ms; CPU time 971 ms; peak memory 67.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
2605.410908
2605.410728
6.9e-08
area
971.5985804
971.5984982
8.5e-08
agrees with
no other kernel
mesh
41908 triangles, closed
centre of gravity
(0.378889, 3.65187e-08, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy -0.000131992; Iyz -0.000847654; Izx -7535.89
//! The cylinder of `offset/slant-cut-cylinder-grown`, radius 3 about the z axis from z = −10 up to//! the plane z = x·tan 45°, grown by 4: every point within 4 of it, SolidCraft's offset of//! the whole solid (`offset_solid`), its convex edges rounded.usesuper::slant_cut_cylinder_grown::slant_cut_cylinder;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
solidcraft_kernel::offset_solid(&slant_cut_cylinder(45.0)?, 4.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
14 ms; CPU time 13 ms; peak memory 19.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
2605.410728
2605.410728
5.2e-16
area
971.5984982
971.5984982
1.2e-16
agrees with
cad-kernel, kentron, springrep
mesh
45862 triangles, closed
centre of gravity
(0.378888, -8.4066e-16, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy -1.71954e-12; Iyz 9.54593e-13; Izx -7535.88
//! A cylinder cut by a plane at 45° and grown by 4: 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 4.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)?, 4.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
26 ms; CPU time 49 ms; peak memory 11.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
2605.410807
2605.410728
3.1e-08
area
971.5985156
971.5984982
1.8e-08
agrees with
occt
mesh
34246 triangles, closed
centre of gravity
(0.378888, 1.75221e-16, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy -1.5537e-12; Iyz -4.52859e-13; Izx -7535.89
//! A cylinder cut by a plane at 45° and grown by 4: 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 4.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, 4.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
51 ms; CPU time 50 ms; peak memory 11.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
2605.410728
2605.410728
7.0e-11
area
971.5984981
971.5984982
6.1e-11
agrees with
cad-kernel, kentron, next.BREP
mesh
39816 triangles, closed
centre of gravity
(0.378888, 4.13328e-16, -4.55375) its STEP's solid
inertia
about it, of unit density: Ixx 99547.9; Iyy 98666.3; Izz 58758; Ixy 2.79105e-12; Iyz -2.7458e-12; Izx -7535.88
//! The cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 45°, grown by//! 4: its elliptic top edge becomes a canal surface, its bottom rim a piece of a torus.//! springrep 1.0.1 refuses it: the rolling ball's centre along the moved ellipse does not settle.use springrep::topo::Brep;
usecrate::shared::offset::{grown, slant_cut_cylinder};
pubfnbuild() -> Result<Brep, String> {
grown(&slant_cut_cylinder(45.)?, 4.)
}
geomsolver left no solid to show.
Time
64 ms; CPU time 75 ms; peak memory 28.7 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 4 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 4 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: 4mm)
part := solid(grown.body)
anvilcad left no solid to show.
Time
1.2 ms; CPU time 1 ms; peak memory 3.5 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 4, 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())
}