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/2 with rounded edges: the solid of every point within 1/2 of it. It is convex, so each face moves out by 1/2 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/2 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/2 \},\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.13 s; CPU time 2.45 s; peak memory 25.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
427.7005053
427.7005051
3.1e-10
area
324.1200233
324.1200233
8.7e-11
agrees with
kentron, next.BREP, springrep
mesh
25950 triangles, closed
centre of gravity
(0.263924, 2.5149e-09, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy 2.87853e-06; Iyz -5.03104e-06; Izx -606.106
//! 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/2 with rounded edges: every point within 1/2 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 = 0.5;
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
648 ms; CPU time 647 ms; peak memory 368.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
427.7005094
427.7005051
1.0e-08
area
324.1200408
324.1200233
5.4e-08
agrees with
no other kernel
mesh
27298 triangles, closed
centre of gravity
(0.263924, 2.59834e-08, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy 2.66144e-05; Iyz -3.6312e-05; Izx -606.106
"""A cylinder cut by a plane at 45° and grown by a half. 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/2 with rounded edges: the solid of every point within 1/2 of it. It is convex, so
each face moves out by 1/2 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/2 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 = 0.5defbuild():
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
27 ms; CPU time 27 ms; peak memory 14.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
427.700505
427.7005051
3.5e-10
area
324.1200232
324.1200233
4.1e-10
agrees with
cad-kernel, next.BREP, springrep
mesh
31016 triangles, closed
centre of gravity
(0.263924, 3.24224e-16, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy -1.6786e-13; Iyz -7.33229e-13; Izx -606.106
//! 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/2: every point within 1/2 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, 0.5, 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
894 ms; CPU time 894 ms; peak memory 62.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
427.7004679
427.7005051
8.7e-08
area
324.1200034
324.1200233
6.1e-08
agrees with
no other kernel
mesh
30546 triangles, closed
centre of gravity
(0.263924, 2.17063e-08, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy -2.4193e-05; Iyz -6.85804e-05; Izx -606.106
//! 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 1/2: every point within 1/2 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)?, 0.5, 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 12 ms; peak memory 18.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
427.7005051
427.7005051
1.3e-16
area
324.1200233
324.1200233
0.0e+00
agrees with
cad-kernel, kentron, springrep
mesh
35994 triangles, closed
centre of gravity
(0.263924, -2.5332e-16, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy 2.51263e-13; Iyz -8.91584e-14; Izx -606.106
//! A cylinder cut by a plane at 45° and grown by a half: 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 0.5 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)?, 0.5)?)
}
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 47 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
427.7005102
427.7005051
1.2e-08
area
324.1200271
324.1200233
1.2e-08
agrees with
no other kernel
mesh
30894 triangles, closed
centre of gravity
(0.263924, -1.12138e-16, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy -6.41726e-14; Iyz 1.86082e-13; Izx -606.106
//! A cylinder cut by a plane at 45° and grown by a half: 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 0.5 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, 0.5)
}
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
78 ms; CPU time 77 ms; peak memory 13.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
427.7005051
427.7005051
2.9e-12
area
324.1200233
324.1200233
3.0e-12
agrees with
cad-kernel, kentron, next.BREP
mesh
31308 triangles, closed
centre of gravity
(0.263924, -2.58652e-16, -4.78636) its STEP's solid
inertia
about it, of unit density: Ixx 6299.08; Iyy 6265.41; Izz 2571.54; Ixy -2.99137e-13; Iyz 1.18396e-13; Izx -606.106
//! The cylinder of radius 3 about the z axis from z = −10 up to the plane z = x·tan 45°, grown by//! a half: 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.)?, 0.5)
}
geomsolver left no solid to show.
Time
65 ms; CPU time 76 ms; peak memory 28.9 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/2 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/2 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: 0.5mm)
part := solid(grown.body)
anvilcad left no solid to show.
Time
1.2 ms; CPU time 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 a half, 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())
}