The half of the ball of radius 5 about the origin above the plane z = 0, with its rim, where the flat meets the ball, rounded to radius 1: the round is a piece of a torus whose tube has radius 1 about the circle of radius √15 at z = 1, tangent to the flat along the circle of radius √15 and to the ball along the circle through (5√15/4, 5/4). Shrink it by 3/2: the solid of every point at least 3/2 from its outside.
That is more than the round's radius. The round moved 3/2 inward would be a torus of tube radius 1 − 3/2 < 0, turned inside out, and drops; the moved flat and the moved ball meet in a sharp edge. The rounded hemisphere lies between the hemisphere shrunk by 1 and grown back by 1 and the hemisphere itself, and both shrink by 3/2 to the same solid: the hemisphere's points at least 3/2 inside, the part of the ball of radius 7/2 about the origin above the plane z = 3/2.
As a set:
$$\{\,x^2 + y^2 + z^2 \le (7/2)^2,\ z \ge 3/2\,\}$$
expected
closed form
volume
35.60471674
πh²(3r − h)/3, r = 5 − d, h = r − d, d = 3/2: the ball of radius 7/2 above z = 3/2
area
75.39822369
2πrh + π(r² − d²) = 24π
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
8.9 ms; CPU time 12 ms; peak memory 11.5 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no offset past a round's radius (offset in two steps, the first the round's radius)
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
35.60471674
35.60471674
0.0e+00
area
75.39822369
75.39822369
0.0e+00
agrees with
kentron, solidcraft, next.BREP, cadrs, springrep
mesh
14193 triangles, closed, 1 degenerate
centre of gravity
(-4.49019e-16, 0, 2.20588) its STEP's solid
inertia
about it, of unit density: Ixx 71.8994; Iyy 71.8994; Izz 127.339; Ixy -1.77636e-15; Iyz -0; Izx 7.36666e-15
//! The half of the ball of radius 5 about the origin above the plane z = 0, its rim rounded to//! radius 1, shrunk by 3/2: every point of it at least 3/2 inside it.//!//! The hemisphere is its half-section turned about the z axis, and the round is the kernel's round//! of that section's corner, a torus exactly. (`fillet::roll` between the plane and the sphere in//! space fits the round as a B-spline canal, which the offset cannot sweep.)//!//! The kernel's offset sweeps a round's torus inward only as far as its tube's radius: past it//! the torus would turn inside out, and the offset refuses it rather than drop it. A solid shrunk//! by a and then by b is the solid shrunk by a + b (the points a ball of radius a + b about them//! fits in), so it is shrunk first by the round's radius, which takes the round down to a sharp//! edge, and then by the rest.use cad_kernel::build::revolve;
use cad_kernel::corners::round;
use cad_kernel::offset::{shrunk, Join};
use cad_kernel::planar::{Region, Seg, Step};
use cad_kernel::recipe::region_profile;
use cad_kernel::topo::Brep;
use std::f64::consts::{FRAC_PI_2, TAU};
constRADIUS: f64 = 5.;
constROUND: f64 = 1.;
constSHRINK: f64 = 1.5;
/// The half-section's steps' tags: the flat, the ball, the axis, and the round between the first/// two.constFLAT: u32 = 1;
constBALL: u32 = 2;
constAXIS: u32 = 3;
constRIM: u32 = 4;
pubfnbuild() -> Result<Brep, String> {
// the half-section in (ρ, z): out along the flat, up round the ball, down the axislet steps = [
(Seg::Line { a: [0., 0.], b: [RADIUS, 0.] }, FLAT),
(Seg::Arc { c: [0., 0.], r: RADIUS, a0: 0., sweep: FRAC_PI_2 }, BALL),
(Seg::Line { a: [0., RADIUS], b: [0., 0.] }, AXIS),
];
let steps = steps.into_iter().map(|(seg, tag)| Step { seg, chart: None, tag }).collect();
let section = Region::new(vec![steps]);
// the rim, where the flat meets the ball, rounded in the section (the kernel reads it as// convex and takes it off), then the whole turned about the axislet rounded = round(§ion, &[FLAT], &[BALL], ROUND, RIM)?;
let (origin, axis) = ([0., 0., 0.], [0., 0., 1.]);
let profile = region_profile(&rounded, origin, [1., 0., 0.], axis, &|_| String::new());
let hemisphere = revolve(&profile, origin, axis, TAU)?;
shrunk(&shrunk(&hemisphere, ROUND, Join::Round)?, SHRINK - ROUND, Join::Round)
}
Time
653 ms; CPU time 653 ms; peak memory 369.3 MB
Notes
wrong its STEP's faces do not close into a solid
Data
No measures: it built no solid to measure.
STEP
open advanced faces, each on a surface AUTOMOTIVE_DESIGN
STEP faces
3: 1 offset, 1 plane, 1 sphere
STEP edges
5: 3 bspline, 2 circle; 2 not bounding exactly two sides of faces, so the shell is open
"""A hemisphere with its rim rounded, shrunk past the round's radius. The half of the ball of radius 5 about the origin above the plane z = 0, with its rim, where the flat meets the ball,
rounded to radius 1: the round is a piece of a torus whose tube has radius 1 about the circle of radius √15 at z = 1,
tangent to the flat along the circle of radius √15 and to the ball along the circle through (5√15/4, 5/4). Shrink it by 3/2: the solid of every point at least 3/2 from its outside.
That is more than the round's radius. The round moved 3/2 inward would be a torus of tube radius 1 − 3/2 < 0, turned
inside out, and drops; the moved flat and the moved ball meet in a sharp edge. The rounded hemisphere lies between the
hemisphere shrunk by 1 and grown back by 1 and the hemisphere itself, and both shrink by 3/2 to the same solid: the
hemisphere's points at least 3/2 inside, the part of the ball of radius 7/2 about the origin above the plane z = 3/2."""fromOCP.BRepAlgoAPIimportBRepAlgoAPI_CommonfromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeSolidfromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakeSpherefromOCP.TopAbsimportTopAbs_ShapeEnumfromOCP.TopoDSimportTopoDSfromOCP.gp import gp_Pnt
from blend import edges_where, rounded
from edit import on_circle
from offset import offset
defbuild():
above = BRepPrimAPI_MakeBox(gp_Pnt(-6, -6, 0), gp_Pnt(6, 6, 6)).Shape()
half = BRepAlgoAPI_Common(BRepPrimAPI_MakeSphere(5).Shape(), above).Shape()
solid = rounded(half, 1, edges_where(half, on_circle((0, 0, 0), 5)), "the rim")
result = offset(solid, -1.5)
# OCCT's offset may give the solid back as its closed shell; the solid is the one it bounds.if result.ShapeType() == TopAbs_ShapeEnum.TopAbs_SHELL:
result = BRepBuilderAPI_MakeSolid(TopoDS.Shell(result)).Solid()
return result
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
7.8 ms; CPU time 7.6 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.
//! The half of the ball of radius 5 about the origin above z = 0, its rim rounded to radius 1, shrunk//! by 3/2: every point at least 3/2 from its outside. The round drops; the result is the part of the//! ball of radius 7/2 above z = 3/2.usecrate::Refusal;
usecrate::shared::offset::{on_rim, rounded};
use kentron::offset::{self, Join};
use kentron::primitives::Sphere;
use kentron::topology::{Model, Shape};
use std::f64::consts::FRAC_PI_2;
pubfnbuild(m: &mutModel) -> Result<Shape, Refusal> {
let half = Sphere::new(5.0).with_latitudes(0.0, FRAC_PI_2).build(m)?;
let rounded_half = rounded(m, half, &[on_rim(5.0, 0.0)], 1.0)?;
Ok(offset::shape(m, rounded_half, -1.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
460 ms; CPU time 460 ms; peak memory 53.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
35.60471674
35.60471674
1.2e-15
area
75.39822369
75.39822369
5.7e-16
agrees with
cad-kernel, kentron, next.BREP, cadrs, springrep
mesh
14195 triangles, closed, 1 degenerate
centre of gravity
(-1.3372e-15, 4.98911e-16, 2.20588) its STEP's solid
inertia
about it, of unit density: Ixx 71.8994; Iyy 71.8994; Izz 127.339; Ixy -7.97619e-30; Iyz 1.04492e-16; Izx 2.25963e-15
//! The half of the ball of radius 5 about the origin above z = 0, its rim rounded to radius 1,//! shrunk by 3/2: every point at least 3/2 from its outside, SolidCraft's offset of the whole//! solid inward (`offset_solid`, rounded), the moved faces that cross trimmed and merged.usesuper::rounded_puck_shrunk_by_its_rounds::round_circles;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
let ball = solidcraft_kernel::sphere(Vec3::ZERO, 5.0)?;
let below = block((-6.0, -6.0, -6.0), (6.0, 6.0, 0.0))?;
let dome = cut(&ball, &below)?;
solidcraft_kernel::offset_solid(&round_circles(&dome, &[(5.0, 0.0)], 1.0)?, -1.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
36 ms; CPU time 36 ms; peak memory 22.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
35.60471674
35.60471674
2.0e-16
area
75.39822369
75.39822369
3.8e-16
agrees with
cad-kernel, kentron, solidcraft, cadrs, springrep
mesh
14197 triangles, closed, 1 degenerate
centre of gravity
(-1.08774e-15, -3.49237e-16, 2.20588) its STEP's solid
inertia
about it, of unit density: Ixx 71.8994; Iyy 71.8994; Izz 127.339; Ixy -1.77636e-15; Iyz -1.22778e-15; Izx -1.01879e-15
//! A hemisphere with its rim rounded, shrunk past the round's radius: the half ball of radius 5 above z = 0, its rim rounded to radius 1, then//! shrunk by 3/2.//!//! The half ball is the kernel's ball in common with a box above z = 0, its rim filleted; then the kernel's//! rounded offset, which drops the round turned inside out.usecrate::solids::boolean::common;
usecrate::solids::p;
usecrate::Refusal;
usecrate::solids::offset::parallel;
use brep_kernel::{fillet_edges, make_box_brep, make_sphere_brep, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let ball = make_sphere_brep(p(0.0, 0.0, 0.0), 5.0, p(0.0, 0.0, 1.0))?;
let half = common(&ball, &make_box_brep(p(-6.0, -6.0, 0.0), 12.0, 12.0, 6.0)?)?;
let rounded = fillet_edges(&half, &[p(0.0, -5.0, 0.0)], None, 1.0, false, None)?;
Ok(parallel(&rounded, -1.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
3.7 ms; CPU time 3.4 ms; peak memory 10.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.
//! A hemisphere with its rim rounded, shrunk past the round's radius: the half ball of radius 5 above z = 0, its rim rounded to radius 1, then//! shrunk by 3/2. cadrs's ball in common with a block, filleted; then its//! offset (shrunk).usecrate::bench::{ball, block, common, p3};
usecrate::shared::fillet::fillet;
usecrate::shared::offset::shrunk;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Pick};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = ball(k, p3(0.0, 0.0, 0.0), 5.0)?;
let above = block(k, p3(-6.0, -6.0, 0.0), p3(6.0, 6.0, 6.0))?;
let half = common(k, b, above)?;
let rim = k.edge_at(half, p3(0.0, -5.0, 0.0))?;
let rounded = fillet(k, half, &[rim], 1.0)?;
shrunk(k, rounded, 1.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
4.8 ms; CPU time 4.6 ms; peak memory 8.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
35.60471674
35.60471674
2.0e-16
area
75.39822369
75.39822369
0.0e+00
agrees with
cad-kernel, kentron, solidcraft, next.BREP, cadrs
mesh
14193 triangles, closed, 1 degenerate
centre of gravity
(-2.49455e-16, 9.97821e-17, 2.20588) its STEP's solid
inertia
about it, of unit density: Ixx 71.8994; Iyy 71.8994; Izz 127.339; Ixy 3.55271e-15; Iyz 1.61962e-15; Izx 2.83433e-15
//! The half of the ball of radius 5 above z = 0, its rim rounded to radius 1, shrunk by 3/2: the//! round vanishes, leaving the part of the ball of radius 7/2 above z = 3/2.//! springrep 1.0.1 refuses it: its face offset cannot follow a round moved past its radius ("an//! offset … closes a torus to nothing").use springrep::blend::fillet_edges;
use springrep::boolean::split;
use springrep::math::Vec3;
use springrep::pick::convex_edges;
use springrep::primitive::sphere;
use springrep::topo::Brep;
usecrate::shared::offset::shrunk;
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let ball = sphere(&at([0., 0., 0.]), 5., "ball").map_err(e)?;
let (dome, _) = split(&ball, Vec3::ZERO, Vec3::Z).map_err(e)?;
// the rim, where the flat meets the ball, is the dome's one convex edgelet rim = convex_edges(&dome).map_err(e)?;
let rounded = fillet_edges(&dome, &rim, 1., "round").map_err(e)?;
shrunk(&rounded, 1.5)
}
geomsolver left no solid to show.
Time
49 ms; CPU time 49 ms; peak memory 24.9 MB
Notes
refused error[E080]: `shrunk.body`: a body shelled that is no body of terms
// A hemisphere with its rim rounded, shrunk by 3/2: the points of the ball of radius 5 about the// origin at or above the top plane, the rim where the two bounds meet rounded to radius 1 (one more// bound of the region, `std.rounds.Rounded`), and the points of it at least 3/2 from its outside,// `std.rounds.Grown`'s body for a negative reach.unit mm
use std
use std.sets
use std.rounds
o := point
fix((0, 0, 0)) o
ball := std.sets.Ball(o, r: 5mm)
above := { q | q distance(>= 0mm, along: n) std.top }
dome := solid({ p | p in ball; p in above; p in std.rounds.Rounded(ball, above, r: 1mm) })
shrunk := std.rounds.Grown(dome, d: -1.5mm)
part := solid(shrunk.body)
anvilcad left no solid to show.
Time
170 ms; CPU time 170 ms; peak memory 7.1 MB
Notes
refused not supported yet: offsets of freeform faces
//! The upper half of the ball of radius 5 about the origin, its rim rounded to radius 1, shrunk by//! 3/2.use anvil_brep::Solid;
usecrate::shared::{ball, beyond, fillet, offset, ring, subtract};
pubfnbuild() -> Result<Solid, String> {
let h = subtract(&ball([0., 0., 0.], 5.)?, &beyond([0., 0., 0.], [0., 0., -1.], 10.)?)?;
offset(&fillet(&h, &[ring(5., 0.)], 1.)?, -1.5)
}