A barrel: the ball of radius 5 centered on the origin, cut by the planes z = −3 and z = 3, keeping the part between them, whose flat ends are disks of radius 4. Shrink it by 1: keep every point of it at least 1 from its boundary.
A point is at least 1 inside the ball and at least 1 inside each plane exactly when it is in the ball of radius 4 and between the planes z = −2 and z = 2, so the result is the same kind of barrel: the ball of radius 4 about the origin cut by z = ±2, its flat ends disks of radius √12. Its edges, where the sphere meets the ends, are convex and stay sharp.
† 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.7 ms; CPU time 11 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.
//! A barrel, the ball of radius 5 about the origin kept between the planes z = −3 and z = 3, shrunk//! by 1: the ball of radius 4 kept between z = −2 and z = 2, its edges sharp.use cad_kernel::build::{kept, sphere};
use cad_kernel::offset::{shrunk, Join};
use cad_kernel::topo::Brep;
constRADIUS: f64 = 5.;
constHALF_HEIGHT: f64 = 3.;
pubfnbuild() -> Result<Brep, String> {
let ball = sphere([0., 0., 0.], [0., 0., 1.], RADIUS)?;
// the ball kept under the plane z = 3, then over the plane z = −3let barrel = kept(&ball, [0., 0., HALF_HEIGHT], [0., 0., -1.], 0.)?;
let barrel = kept(&barrel, [0., 0., -HALF_HEIGHT], [0., 0., 1.], 0.)?;
shrunk(&barrel, 1., Join::Round)
}
Time
629 ms; CPU time 628 ms; peak memory 367.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 ball cut by two planes shrunk by 1. A barrel: the ball of radius 5 centred on the origin cut by
the planes z = −3 and z = 3, keeping the part between them, whose flat ends are disks of radius 4,
shrunk by 1: every point of it at least 1 from its boundary."""import math
fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeSpherefrom offset import offset
RADIUS = 5HALF_HEIGHT = 3SHRINKAGE = 1defbuild():
# the ball's zone between the two latitudes the planes cut it at
latitude = math.asin(HALF_HEIGHT / RADIUS)
barrel = BRepPrimAPI_MakeSphere(RADIUS, -latitude, latitude).Shape()
returnoffset(barrel, -SHRINKAGE)
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.
kentron 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.
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
1.27 s; CPU time 1.27 s; peak memory 57.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.
//! A barrel, the ball of radius 5 about the origin cut by the planes z = −3 and z = 3, shrunk by 1.//! Its two edges, where the sphere meets the flat ends, are convex, and shrunk a convex edge stays//! sharp, so Offset Face (`offset_faces`) moving the sphere and both ends 1 inward is the barrel//! shrunk: the ball of radius 4 cut by z = ±2.usecrate::solids::*;
pubfnbuild() -> R<Body> {
let ball = solidcraft_kernel::sphere(Vec3::ZERO, 5.0)?;
let barrel = common(&ball, &block((-6.0, -6.0, -3.0), (6.0, 6.0, 3.0))?)?;
// a point on the sphere's zone and the middle of each end, picking themlet faces = [v3(5.0, 0.0, 0.0), v3(0.0, 0.0, -3.0), v3(0.0, 0.0, 3.0)];
solidcraft_kernel::offset_faces(&barrel, &faces, -1.0)
}
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
33 ms; CPU time 28 ms; peak memory 20.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.
//! The ball of radius 5 about the origin between the planes z = −3 and z = 3, shrunk by 1 to its//! inner parallel body.usecrate::solids::boolean::common;
usecrate::solids::offset::parallel;
usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{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))?;
// the slab between the planes, wider than the balllet slab = make_box_brep(p(-6.0, -6.0, -3.0), 12.0, 12.0, 6.0)?;
Ok(parallel(&common(&ball, &slab)?, -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
2.8 ms; CPU time 2.5 ms; peak memory 8.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.
//! A barrel: the ball of radius 5 about the origin cut by the planes z = −3 and z = 3, the part//! between them kept (flat ends, disks of radius 4), shrunk by 1: the solid of every point at//! least 1 from its outside, the ball of radius 4 cut by z = ±2.//!//! The ball is cadrs's sphere primitive, its ends cut flat by a common with a block (a//! rectangle extruded from z = −3 to 3); then cadrs's offset inward.usecrate::bench::{ball, block, common, p3};
usecrate::shared::offset::shrunk;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let b = ball(k, p3(0.0, 0.0, 0.0), 5.0)?;
let slab = block(k, p3(-6.0, -6.0, -3.0), p3(6.0, 6.0, 3.0))?;
let barrel = common(k, b, slab)?;
shrunk(k, barrel, 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
2.4 ms; CPU time 2.2 ms; peak memory 8.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.
//! The ball of radius 5 about the origin between the planes z = −3 and z = 3, shrunk by 1://! springrep's own offset by −1.use springrep::boolean::intersection;
use springrep::topo::Brep;
usecrate::shared::boolean::{ball, between};
usecrate::shared::e;
usecrate::shared::offset::shrunk;
pubfnbuild() -> Result<Brep, String> {
let whole = ball([0., 0., 0.], 5., "ball")?;
// the slab between the planes, wider than the balllet slab = between([-6., -6., -3.], [6., 6., 3.], "slab")?;
let barrel = intersection(&whole, &slab).map_err(e)?;
shrunk(&barrel, 1.)
}
geomsolver 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
13 ms; CPU time 12 ms; peak memory 5.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 ball of radius 5 about the origin cut by the planes z = ±3, shrunk by 1: every face moved//! 1 inward.use anvil_brep::Solid;
usecrate::shared::{ball, block, intersect, offset};
pubfnbuild() -> Result<Solid, String> {
let barrel = intersect(&ball([0., 0., 0.], 5.)?, &block([-6., -6., -3.], [6., 6., 3.])?)?;
offset(&barrel, -1.)
}