The solid a box fills as it slides along a straight line without turning. The box starts as the box from (0, 0, 0) to (10, 6, 4) and slides along the vector (8, 5, 0), level, ending as the box from (8, 5, 0) to (18, 11, 4). Make the solid of everything the box passes through.
It is swept/box-slid-aslant with the slide in the plane of the box's top and bottom, so those two faces slide within their own planes: the result is a prism 4 high, from z = 0 to z = 4, over the hexagon the rectangle from (0, 0) to (10, 6) sweeps, through (0, 0), (10, 0), (18, 5), (18, 11), (8, 11) and (0, 6). Its top and bottom are those hexagons, and its six sides are rectangles 4 high.
As a set:
$$\bigl([0,10]\times[0,6]\times[0,4]\bigr) \oplus \{\,s\,(8,5,0) : 0 \le s \le 1\,\}$$
expected
closed form
volume
632
abc + |dx|bc + |dy|ca + |dz|ab = (ab + a|dy| + b|dx|)c, a, b, c = 10, 6, 4, d = (8, 5, 0)
† 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
51 ms; CPU time 117 ms; peak memory 18.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.
//! The box from (0, 0, 0) to (10, 6, 4) slid without turning along (8, 5, 0), level: a prism 4//! high over the hexagon its floor sweeps.usecrate::sketch::block;
use cad_kernel::geom::{tolerance, V};
use cad_kernel::swept::closed::slid;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use cad_kernel::util::space::{norm, unit};
use std::f64::consts::TAU;
constSIZE: V = [10., 6., 4.];
constSLIDE: V = [8., 5., 0.];
pubfnbuild() -> Result<Brep, String> {
let tool = block([0., 0., 0.], SIZE)?;
// the slide along (8, 5, 0): a screw that does not turn, advancing its whole length over a// roll of τlet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.],
axis: unit(SLIDE),
ratio: 0.,
advance: norm(SLIDE),
});
// the kernel's closed swept solid (a box's flat faces mesh exactly, at any bar)let size = tool.size();
slid(&tool, &path, [0., TAU], size, tolerance(size))
.map_err(|why| format!("the box's sweep not built: {why:?}"))
}
Time
627 ms; CPU time 627 ms; peak memory 367.9 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
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 box slid along the plane of its faces. The solid a box fills as it slides along a straight
line without turning. The box starts as the box from (0, 0, 0) to (10, 6, 4) and slides along the
vector (8, 5, 0), level, ending as the box from (8, 5, 0) to (18, 11, 4). Make the solid of
everything the box passes through.
The slide lies in the plane of the box's top and bottom, so those two faces slide within their own
planes: the result is a prism 4 high over the hexagon the rectangle from (0, 0) to (10, 6)
sweeps."""fromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBoxfromOCP.gp import gp_Pnt
from sweep import slid, united
CORNER = (0, 0, 0)
FAR_CORNER = (10, 6, 4)
SLIDE = (8, 5, 0)
defbuild():
box = BRepPrimAPI_MakeBox(gp_Pnt(*CORNER), gp_Pnt(*FAR_CORNER)).Shape()
# Every face is flat, so none needs splitting: the faces x = 10 and y = 6 lead the slide, the# faces x = 0 and y = 0 trail it, and the top and bottom slide within their own planes and# sweep nothing of their own (`slid` leaves them out: a prism of a face along its own plane# would have no volume).returnunited(slid(box, SLIDE))
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
73 ms; CPU time 73 ms; peak memory 49 MB
Notes
pass Its volume and area are the expected ones, and its mesh is closed.
Workaround † no sweep of a solid
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 the box from the origin to (10, 6, 4) fills as it slides along (8, 5, 0) without//! turning: `swept/box-slid-aslant` slid level.//!//! Built as that case builds it (solidcraft-kernel has no sweep of a solid): the box where it//! starts and the faces it leads with, x = 10 and y = 6, each slid the whole way. The top and//! bottom slide within their own planes and lead nowhere.usesuper::box_slid_aslant::slid;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
slid(v3(8.0, 5.0, 0.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
4.8 ms; CPU time 4.6 ms; peak memory 12.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.
//! The box from (0, 0, 0) to (10, 6, 4) slid without turning along (8, 5, 0): the kernel's sweep//! of a solid, as `swept/box-slid-aslant` slides its box along (8, 5, 3).usecrate::solids::p;
usecrate::solids::swept::{box_tool, slide_by};
usecrate::Refusal;
use brep_kernel::{sweep_solid, BrepSolid};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let tool = box_tool(p(0.0, 0.0, 0.0), p(10.0, 0.0, 0.0), p(0.0, 6.0, 0.0), p(0.0, 0.0, 4.0));
Ok(sweep_solid(&tool, &slide_by(p(8.0, 5.0, 0.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
4.8 ms; CPU time 8.3 ms; peak memory 9.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.
//! The solid the box from (0, 0, 0) to (10, 6, 4) fills as it slides without turning along//! (8, 5, 0), level, to the box from (8, 5, 0) to (18, 11, 4): its top and bottom slide in their//! own planes, so it is the prism 4 high over the hexagon (0, 0), (10, 0), (18, 5), (18, 11),//! (8, 11), (0, 6).//!//! The box is a rectangle on the Top plane extruded 4; its slide is cadrs's sweep of a solid//! (`Kernel::sweep_solid`, one slide along (8, 5, 0)), as in `swept/box-slid-aslant`.usecrate::bench::{block, p3, v3};
usecrate::shared::swept::slid;
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let start = block(k, p3(0.0, 0.0, 0.0), p3(10.0, 6.0, 4.0))?;
slid(k, start, v3(8.0, 5.0, 0.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
3.7 ms; CPU time 3.5 ms; peak memory 8.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.
//! The solid the box (0, 0, 0)–(10, 6, 4) fills as it slides without turning along (8, 5, 0), as//! `swept/box-slid-aslant` slides it along (8, 5, 3).use springrep::sweep::{Motion, solid};
use springrep::topo::Brep;
usecrate::shared::e;
usecrate::shared::swept::{boxed, v3};
pubfnbuild() -> Result<Brep, String> {
let block = boxed([0.0, 0.0, 0.0], [10.0, 6.0, 4.0], "box")?;
solid(&block, &Motion::Slide(v3(8.0, 5.0, 0.0)), "swept").map_err(e)
}
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
3.4 ms; CPU time 3.2 ms; peak memory 4.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.
//! What the box from the origin to (10, 6, 4) fills as it slides along (8, 5, 0) without turning.use anvil_brep::Solid;
usecrate::shared::{v3, zonotope};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. A box slid along a line fills the zonotope of its three// edges and the slide: the box's faces and the parallelograms each of its edges sweepslet (box_, slide) = ([v3(10., 0., 0.), v3(0., 6., 0.), v3(0., 0., 4.)], v3(8., 5., 0.));
let center = v3(5., 3., 2.) + slide * 0.5;
zonotope(center, &[box_[0], box_[1], box_[2], slide])
}