A cylinder of radius 3 about the z axis, from its flat bottom at z = −10 up to where the plane z = x·tan 30° cuts it: the plane crosses the axis at z = 0 and leans at 30° to the bottom, so the top is the ellipse it cuts from the cylinder, with semi-axes 3 and 3/cos 30°.
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 30^\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.06 s; CPU time 2.28 s; peak memory 24.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
598.5408362
598.540836
3.7e-10
area
386.3655028
386.3655028
4.4e-11
agrees with
kentron, next.BREP, cadrs, springrep
mesh
25660 triangles, closed
centre of gravity
(0.172337, -5.47526e-10, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy 7.62492e-07; Iyz 1.52512e-06; Izx -599.305
//! The cylinder of radius 3 on the z axis from its flat bottom at z = −10 up to where the plane//! z = x·tan 30° cuts it, grown by 1 with rounded edges: every point within 1 of it.//!//! The kernel sweeps a cylinder's face along its normal only where the face is bounded by its own//! parameter lines (circles and rulings); the slanted top bounds the side by an ellipse, and the//! offset refuses that face.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 = 30.;
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
629 ms; CPU time 628 ms; peak memory 368.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
598.5408256
598.540836
1.7e-08
area
386.3655036
386.3655028
2.1e-09
agrees with
no other kernel
mesh
28648 triangles, closed
centre of gravity
(0.172337, 1.74184e-08, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy -3.22643e-05; Iyz -5.9474e-05; Izx -599.306
"""A cylinder cut by a plane at 30° 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 30° cuts it: the plane crosses the axis at z = 0 and leans at 30° to the bottom, so the
top is the ellipse it cuts from the cylinder, with semi-axes 3 and 3/cos 30°.
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 = 30GROWTH = 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
28 ms; CPU time 28 ms; 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
598.5408359
598.540836
8.2e-11
area
386.3655028
386.3655028
7.2e-11
agrees with
cad-kernel, next.BREP, cadrs, springrep
mesh
31470 triangles, closed
centre of gravity
(0.172337, 2.16904e-17, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy -1.10075e-13; Iyz -1.36561e-14; Izx -599.305
//! The cylinder of radius 3 about the z axis from z = −10 up to where the plane z = x·tan 30° 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};
pubfnbuild(m: &mutModel) -> Result<Shape, Refusal> {
let cylinder = slant_cut_cylinder(m, 30f64.to_radians())?;
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
756 ms; CPU time 756 ms; peak memory 61.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
598.5407864
598.540836
8.3e-08
area
386.3654838
386.3655028
4.9e-08
agrees with
no other kernel
mesh
33536 triangles, closed
centre of gravity
(0.172337, 3.45897e-08, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy -5.93495e-05; Iyz -0.000143359; Izx -599.305
//! A cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 30°, grown by 1://! every point within 1 of it, SolidCraft's offset of the whole solid (`offset_solid`), its convex//! edges rounded. The cylinder is that of `offset/slant-cut-cylinder-grown`, cut at 30° instead of//! 45°.usesuper::slant_cut_cylinder_grown::slant_cut_cylinder;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
solidcraft_kernel::offset_solid(&slant_cut_cylinder(30.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
11 ms; CPU time 10 ms; peak memory 18.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
598.540836
598.540836
1.9e-16
area
386.3655028
386.3655028
0.0e+00
agrees with
cad-kernel, kentron, cadrs, springrep
mesh
34648 triangles, closed
centre of gravity
(0.172337, -1.3974e-16, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy 2.60434e-13; Iyz 2.33465e-13; Izx -599.305
//! A cylinder cut by a plane at 30° and grown by 1: the cylinder of radius 3 on the z axis from z = −10, cut by the plane z = x·tan 30°//! (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 = (30f64).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
22 ms; CPU time 40 ms; 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
598.5408361
598.540836
3.0e-10
area
386.3655029
386.3655028
3.3e-10
agrees with
cad-kernel, kentron, next.BREP, springrep
mesh
31298 triangles, closed
centre of gravity
(0.172337, -8.30987e-17, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy -2.2884e-13; Iyz 1.76852e-13; Izx -599.305
//! A cylinder cut by a plane at 30° and grown by 1: the cylinder of radius 3 on the z axis from z = −10, cut by the plane z = x·tan 30°//! (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 = (30f64).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
40 ms; CPU time 40 ms; peak memory 11.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
598.5408359
598.540836
4.1e-11
area
386.3655028
386.3655028
4.0e-11
agrees with
cad-kernel, kentron, next.BREP, cadrs
mesh
33528 triangles, closed
centre of gravity
(0.172337, -2.82973e-16, -4.89949) its STEP's solid
inertia
about it, of unit density: Ixx 9771.36; Iyy 9746.94; Izz 4695; Ixy 1.04288e-13; Iyz 1.95022e-13; Izx -599.305
//! The cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 30°, 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(30.)?, 1.)
}
geomsolver left no solid to show.
Time
64 ms; CPU time 75 ms; peak memory 28.4 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 30° to the bottom, z = x·tan 30°, 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 30° 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(30deg, 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.1 ms; CPU time 970 µs; 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 30° 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())
}