A solid torus about the z axis, centered on the origin, whose tube has radius 3 about a middle circle of radius 10. Shrink it by 1.5: the solid of every point at least 1.5 from the torus's outside.
The shrunk solid is the torus about the same middle circle whose tube has radius 1.5.
† 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
2.9 ms; CPU time 4.2 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 solid torus about z, its tube of radius 3 about a middle circle of radius 10, shrunk by 1.5.use cad_kernel::build::torus;
use cad_kernel::offset::{shrunk, Join};
use cad_kernel::topo::Brep;
pubfnbuild() -> Result<Brep, String> {
shrunk(&torus([0., 0., 0.], [0., 0., 1.], 10., 3.)?, 1.5, Join::Round)
}
Time
611 ms; CPU time 610 ms; peak memory 363.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.
"""A torus shrunk by 1.5. A solid torus about the z axis, centred on the origin, whose tube has
radius 3 about a middle circle of radius 10, shrunk by 1.5."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeTorusfromOCP.gp import gp
from offset import offset
MAJOR_RADIUS = 10MINOR_RADIUS = 3SHRINKAGE = 1.5defbuild():
torus = BRepPrimAPI_MakeTorus(gp.XOY_s(), MAJOR_RADIUS, MINOR_RADIUS).Shape()
returnoffset(torus, -SHRINKAGE)
Time
1.8 ms; CPU time 1.6 ms; peak memory 7.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.
//! A solid torus about the z axis, its tube of radius 3 about a middle circle of radius 10, shrunk//! by 1.5.use arris::geom::{Profile, ProfileLoop};
use arris::math::{Axis, Control, Frame, Point2, Point3, Vec3};
use arris::ops::{offset_faces, revolve, OpError};
use arris::topo::{Body, Model};
use std::f64::consts::TAU;
constMAJOR: f64 = 10.0;
constMINOR: f64 = 3.0;
constSHRINKAGE: f64 = 1.5;
pubfnbuild(m: &mutModel) -> Result<Body, OpError> {
// arris has no torus primitive: the tube's circle, drawn in the xz plane, turned about zlet xz = Frame::new(Point3::origin(), -Vec3::y(), Vec3::x())?;
let tube = Profile {
plane: xz,
outer: ProfileLoop::Circle { center: Point2::new(MAJOR, 0.0), radius: MINOR },
holes: vec![],
};
let (torus, _) = revolve(m, &tube, Axis::z_at(Point3::origin()), TAU, &Control::NONE)?;
// its one face moved in: a torus's offset is the torus of the same middle circlelet faces = m.faces(torus)?;
let (shrunk, _) = offset_faces(m, torus, &faces, -SHRINKAGE, &Control::NONE)?;
Ok(shrunk)
}
Time
4.2 ms; CPU time 3.9 ms; peak memory 9.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.
//! A solid torus about the z axis, its tube of radius 3 about a middle circle of radius 10, shrunk//! by 1.5: the torus about the same circle whose tube has radius 1.5.use kentron::offset::{self, Join};
use kentron::primitives::Torus;
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let torus = Torus::new(10.0, 3.0).build(m)?;
offset::shape(m, torus, -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
919 ms; CPU time 918 ms; peak memory 51.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.
//! A torus's one face, moved 1.5 inward along its normal by Offset Face (`offset_faces`), is the//! torus about the same middle circle with a tube 1.5 thinner: the torus has no edge to join, so//! moving its face is the whole of shrinking it.usecrate::solids::*;
pubfnbuild() -> R<Body> {
let torus = solidcraft_kernel::torus(Vec3::ZERO, 10.0, 3.0)?;
// the tube's outermost point, picking its face
solidcraft_kernel::offset_faces(&torus, &[v3(13.0, 0.0, 0.0)], -1.5)
}
Time
1.1 ms; CPU time 990 µs; peak memory 4.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.
//! A solid torus about the z axis, its tube of radius 3 about a middle circle of radius 10,//! shrunk by 1.5 with brepkit's offset: its one face moved 1.5 inward, to the torus of tube//! radius 1.5. The torus has no edges, so there is no joint to round or keep sharp.use brepkit_operations::offset_v2::offset_solid_v2;
use brepkit_operations::primitives::make_torus;
use brepkit_operations::OperationsError;
use brepkit_topology::solid::SolidId;
use brepkit_topology::Topology;
pubfnbuild(topo: &mutTopology) -> Result<SolidId, OperationsError> {
let torus = make_torus(topo, 10.0, 3.0, 64)?;
offset_solid_v2(topo, torus, -1.5)
}
Time
5.4 ms; CPU time 5.9 ms; peak memory 21.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 torus about the z axis: a circle of radius 3 centred 10 out along x in the xz plane, revolved a// full turn about z. Shrunk by 1.5.let m = model();
let t = m.profile(xz()).circle(3.0).at(10.0, 0.0).sketch("section")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), full_circle());
t = t.offset_solid(-1.5, #{ label: "shrunk" });
m
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
5.3 ms; CPU time 5.1 ms; peak memory 16.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.
//! The solid torus about the z axis whose tube has radius 3 about a middle circle of radius 10,//! shrunk by 1.5: the torus about the same middle circle with a tube of radius 1.5.usecrate::solids::offset::parallel;
usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{make_torus_brep, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let torus = make_torus_brep(p(0.0, 0.0, 0.0), p(0.0, 0.0, 1.0), 10.0, 3.0)?;
Ok(parallel(&torus, -1.5)?)
}
Time
3.41 s; CPU time 3.41 s; peak memory 31.7 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no torus primitive
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 solid torus about the z axis, its tube of radius 3 about a middle circle of radius 10,//! shrunk by 1.5: the torus of tube radius 1.5 about the same circle. geop has no torus: it is//! turned from its circular section about the z axis, and its face offset 1.5 into it by geop's//! face offset.usecrate::shared::hollow::{offset_faces, on_torus};
usecrate::shared::{Drawing, axis, revolve, sketch, zx, zx_at};
usecrate::{Bench, Refusal};
use geop_core_math::primitives::FrameAxis;
use geop_ops_model::Combine;
pubfnbuild(b: &mutBench) -> Result<(), Refusal> {
letmut tube = Drawing::new();
tube.circle(zx_at(10.0, 0.0), 3.0);
sketch(b, "tube", zx(), tube)?;
revolve(b, "ring", "tube", axis(FrameAxis::Z), 360.0, Combine::NewBody)?;
// One piece of the torus picked: the face offset takes along the faces it runs smoothly// into, the rest of the torus.let on = on_torus(10.0, 3.0, 22.5, 45.0);
offset_faces(b, "shrink", &[on], -1.5)
}
Time
1.9 ms; CPU time 1.7 ms; peak memory 6.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 solid torus about the z axis, centered on the origin, its tube of radius 3 about a middle//! circle of radius 10, shrunk by 1.5: the solid of every point at least 1.5 from its outside,//! the torus about the same middle circle with a tube of radius 1.5.//!//! The torus is cadrs's torus primitive. Then cadrs's offset inward.usecrate::bench::{p3, torus, v3};
usecrate::shared::offset::shrunk;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let t = torus(k, p3(0.0, 0.0, 0.0), v3(0.0, 0.0, 1.0), 10.0, 3.0)?;
shrunk(k, t, 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
1.7 ms; CPU time 1.5 ms; peak memory 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 torus about the z axis of middle radius 10 and tube radius 3, shrunk by 1.5: the torus of//! tube radius 1.5 about the same middle circle.use springrep::edit::offset;
use springrep::primitive::torus;
use springrep::topo::Brep;
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let ring = torus(&at([0., 0., 0.]), 10., 3., "ring").map_err(e)?;
offset(&ring, -1.5, "shrunk").map_err(e)
}
geomsolver left no solid to show.
Time
47 ms; CPU time 47 ms; peak memory 23.8 MB
Notes
refused error[E080]: `shrunk.body`: a body shelled that is no body of terms
// A torus shrunk by 1.5: the tube's circle, radius 3, drawn in the front plane (x, z) 10 out along// x and turned a whole turn about the z axis; and the points of it at least 1.5 from its outside,// `std.rounds.Grown`'s body for a negative reach.unit mm
use std
use std.solids
use std.rounds
in std.front {
c := point
fix((10, 0)) c
tube := circle(center: c) hint(r: 3)
radius(3) tube
}
torus := solid(std.solids.Revolution(face(tube), about: std.z))
shrunk := std.rounds.Grown(torus, d: -1.5mm)
part := solid(shrunk.body)
Time
66 ms; CPU time 66 ms; peak memory 10.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no torus primitive
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 torus about the z axis (middle circle 10, tube 3) shrunk by 1.5.use anvil_brep::{Frame, Solid};
usecrate::shared::{offset, torus};
pubfnbuild() -> Result<Solid, String> {
offset(&torus(&Frame::world(), 10., 3.)?, -1.5)
}