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, 3), ending as the box from (8, 5, 3) to (18, 11, 7). Make the solid of everything the box passes through.
It is a convex polyhedron with twelve faces, in six parallel pairs: the box's three pairs of faces, and three pairs of parallelograms, each with one edge of the box and the slide's vector as its sides.
As a set:
$$\bigl([0,10]\times[0,6]\times[0,4]\bigr) \oplus \{\,s\,(8,5,3) : 0 \le s \le 1\,\}$$
expected
closed form
volume
812
abc + |dx|bc + |dy|ca + |dz|ab, a, b, c = 10, 6, 4, d = (8, 5, 3)
area
542.6189319
2(ab + bc + ca) + 2(a|e₁×d| + b|e₂×d| + c|e₃×d|)
Drawing
TopIsometricFrontRight
Third-angle projection, the three views at one scale. Drawn from occt'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
164 ms; CPU time 378 ms; peak memory 40 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 the vector//! (8, 5, 3), to the box (8, 5, 3)–(18, 11, 7).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., 3.];
pubfnbuild() -> Result<Brep, String> {
let tool = block([0., 0., 0.], SIZE)?;
// the slide along (8, 5, 3): 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
629 ms; CPU time 628 ms; peak memory 368.8 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 aslant. 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, 3),
ending as the box from (8, 5, 3) to (18, 11, 7). Make the solid of everything the box passes
through.
It is a convex polyhedron with twelve faces, in six parallel pairs: the box's three pairs of
faces, and three pairs of parallelograms, each with one edge of the box and the slide's vector as
its sides."""fromOCP.BRepAlgoAPIimportBRepAlgoAPI_FusefromOCP.BRepPrimAPIimportBRepPrimAPI_MakeBox, BRepPrimAPI_MakePrismfromOCP.TopAbsimportTopAbs_SHELL, TopAbs_SOLIDfromOCP.TopExpimportTopExp_ExplorerfromOCP.TopoDSimportTopoDSfromOCP.collections importList_TopoDS_ShapefromOCP.gp import gp_Pnt, gp_Vec
from bench importRefusedCORNER = (0, 0, 0)
FAR_CORNER = (10, 6, 4)
SLIDE = (8, 5, 3)
defbuild():
start = BRepPrimAPI_MakeBox(gp_Pnt(*CORNER), gp_Pnt(*FAR_CORNER)).Shape()
end = BRepPrimAPI_MakeBox(gp_Pnt(*(c + d for c, d inzip(CORNER, SLIDE))),
gp_Pnt(*(c + d for c, d inzip(FAR_CORNER, SLIDE)))).Shape()
# OCCT's prism sweeps no solid ("Solids are not Processed"), but it sweeps a shell: each of# its faces to the solid that face passes through, the six together a CompSolid. A flat face# slid along a vector out of its plane never folds over itself, so each of those solids is# exactly what its face passes through.
shell = TopoDS.Shell(TopExp_Explorer(start, TopAbs_SHELL).Current())
prism = BRepPrimAPI_MakePrism(shell, gp_Vec(*SLIDE))
ifnot prism.IsDone():
raiseRefused("BRepPrimAPI_MakePrism could not slide the box's faces")
# Everything the box passes through is the box where it starts, the box where it ends, and# everything its faces pass through: a point the box covers at some instant that no face# ever crosses stays inside the box all the way, so it is in the box at both ends.
tools = List_TopoDS_Shape()
swept = TopExp_Explorer(prism.Shape(), TopAbs_SOLID)
while swept.More():
tools.Append(swept.Current())
swept.Next()
tools.Append(end)
arguments = List_TopoDS_Shape()
arguments.Append(start)
fuse = BRepAlgoAPI_Fuse()
fuse.SetArguments(arguments)
fuse.SetTools(tools)
fuse.Build()
ifnot fuse.IsDone():
raiseRefused("BRepAlgoAPI_Fuse declined the faces' sweeps and the box at each end")
return fuse.Shape()
Time
4.6 ms; CPU time 4.4 ms; peak memory 7.2 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 a box fills as it slides without turning along a straight line: the box from the//! origin to (10, 6, 4), slid along the vector (8, 5, 3).//!//! arris has no sweep of a solid, so the swept solid is built from the box and its faces. A point//! the box passes over but that is not in the box where it starts is first reached by a face the//! box leads with, one whose outward normal points along the slide: the faces x = 10, y = 6 and//! z = 4 here. So the sweep is the box where it starts and those three faces each slid along the//! line, an oblique prism apiece, which meet only on their sides (their volumes add up to the//! box's and the three slanted bricks', and the box where it ends is the far end of all four).use arris::geom::{Profile, ProfileLoop, ProfileSegment};
use arris::math::{Control, Frame, Point2, Point3, Vec3};
use arris::ops::{extrude, fuse, primitive_box, OpError};
use arris::topo::{Body, Model};
constLENGTH: f64 = 10.0;
constWIDTH: f64 = 6.0;
constHEIGHT: f64 = 4.0;
constSLIDE: [f64; 3] = [8.0, 5.0, 3.0];
/// The rectangle from the origin to (`u`, `v`) in `plane`.fnrectangle(plane: Frame, u: f64, v: f64) -> Profile {
let p = Point2::new;
Profile {
plane,
outer: ProfileLoop::Path {
start: p(0.0, 0.0),
segments: vec![
ProfileSegment::LineTo(p(u, 0.0)),
ProfileSegment::LineTo(p(u, v)),
ProfileSegment::LineTo(p(0.0, v)),
ProfileSegment::LineTo(p(0.0, 0.0)),
],
},
holes: vec![],
}
}
pubfnbuild(m: &mutModel) -> Result<Body, OpError> {
let (block, _) =
primitive_box(m, Point3::origin(), Point3::new(LENGTH, WIDTH, HEIGHT), &Control::NONE)?;
let slide = Vec3::new(SLIDE[0], SLIDE[1], SLIDE[2]);
// the three leading faces, each in its own plane with its outward normal: u, v along the// face's edges from the corner nearest the originlet leading = [
rectangle(Frame::new(Point3::new(LENGTH, 0.0, 0.0), Vec3::x(), Vec3::y())?, WIDTH, HEIGHT),
rectangle(Frame::new(Point3::new(0.0, WIDTH, 0.0), Vec3::y(), Vec3::z())?, HEIGHT, LENGTH),
rectangle(Frame::new(Point3::new(0.0, 0.0, HEIGHT), Vec3::z(), Vec3::x())?, LENGTH, WIDTH),
];
// The prisms fused onto the box one at a time, each fuse merging the faces they share. All// four in one `fuse_many`, arris 0.9.1 declines: "kernel bug: an edge along a face's boundary// with no common block was not found".letmut swept = block;
for face in &leading {
// each face slid the whole length of the slide: a prism whose sides are parallelogramslet (prism, _) = extrude(m, face, slide, slide.norm(), &Control::NONE)?;
swept = fuse(m, swept, prism, &Control::NONE)?.0;
}
Ok(swept)
}
Time
8.5 ms; CPU time 8.3 ms; peak memory 9.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.
//! The solid the box from (0, 0, 0) to (10, 6, 4) fills as it slides, without turning, along//! (8, 5, 3) to the box from (8, 5, 3) to (18, 11, 7).//!//! kentron's sweep of a solid (`sweep::solid`, one slide).usecrate::bench::{p, v};
use kentron::primitives::Cuboid;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let block = Cuboid::from_corners(p(0.0, 0.0, 0.0), p(10.0, 6.0, 4.0)).build(m)?;
sweep::solid(m, block, &RigidMotion::Slide { by: v(8.0, 5.0, 3.0) })
}
Time
8.4 ms; CPU time 8.2 ms; peak memory 7.3 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 a box fills as it slides without turning along a straight line: the box from the//! origin to (10, 6, 4), slid along the vector (8, 5, 3).//!//! vcad has no sweep of a solid, so the swept solid is built from the box and its faces. A point//! the box passes over but that is not in the box where it starts is first reached by a face the//! box leads with, one whose outward normal points along the slide: the faces x = 10, y = 6 and//! z = 4 here. So the sweep is the box where it starts and those three faces each slid along the//! line, an oblique prism apiece (vcad's extrusion of the face's rectangle along the slide); the//! box where it ends is the far end of all four.use vcad_kernel::vcad_kernel_math::{Point3, Vec3};
use vcad_kernel::vcad_kernel_sketch::SketchProfile;
use vcad_kernel::Solid;
constSIZE: [f64; 3] = [10.0, 6.0, 4.0];
constSLIDE: [f64; 3] = [8.0, 5.0, 3.0];
pubfnbuild() -> Result<Solid, crate::Refusal> {
let [a, b, c] = SIZE;
let slide = Vec3::new(SLIDE[0], SLIDE[1], SLIDE[2]);
// vcad's box has its corner at the originlet start = Solid::cube(a, b, c);
// each leading face as a rectangle sketched on it, its normal (x_dir × y_dir) outwardlet faces = [
SketchProfile::rectangle(Point3::new(a, 0.0, 0.0), Vec3::y(), Vec3::z(), b, c),
SketchProfile::rectangle(Point3::new(0.0, b, 0.0), Vec3::z(), Vec3::x(), c, a),
SketchProfile::rectangle(Point3::new(0.0, 0.0, c), Vec3::x(), Vec3::y(), a, b),
];
letmut swept = start;
for face in faces {
swept = swept.try_union(&Solid::extrude(face, slide)?)?;
}
Ok(swept)
}
Time
1.22 s; CPU time 1.22 s; peak memory 53.1 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, 3) without//! turning.//!//! solidcraft-kernel has no sweep of a solid, so the slide is built from the box and its faces by//! elementary geometry. A point the box passes over that is outside the box where it starts is//! reached first by one of the faces the box leads with, those whose outward normals point along//! the slide: x = 10, y = 6 and z = 4. So the solid is the box where it starts and those three//! faces each slid the whole way, a slanted prism apiece; the box where it ends is their far end.//! The kernel's `sweep` along a straight path translates its profile, the face, along it.usecrate::solids::*;
use solidcraft_kernel::{PathSeg, sweep};
pubfnbuild() -> R<Body> {
slid(v3(8.0, 5.0, 3.0))
}
/// The box from the origin to (10, 6, 4) slid along `slide`, whose parts are none negative: the/// box and each face it leads with, x = 10, y = 6 or z = 4 where `slide` has a part along x, y/// or z, slid the whole way.pubfnslid(slide: Vec3) -> R<Body> {
letmut swept = block((0.0, 0.0, 0.0), (10.0, 6.0, 4.0))?;
// each leading face on a plane whose normal is its outward one, its sides along the box's// edges from the corner nearest the originlet faces = [
(slide.x, Plane { origin: v3(10.0, 0.0, 0.0), x: Vec3::Y, y: Vec3::Z }, rect(0.0, 0.0, 6.0, 4.0)),
(slide.y, Plane { origin: v3(0.0, 6.0, 0.0), x: Vec3::Z, y: Vec3::X }, rect(0.0, 0.0, 4.0, 10.0)),
(slide.z, Plane { origin: v3(0.0, 0.0, 4.0), x: Vec3::X, y: Vec3::Y }, rect(0.0, 0.0, 10.0, 6.0)),
];
for (_, plane, face) in faces.iter().filter(|(along, ..)| *along > 0.0) {
let path = [PathSeg::Line { a: plane.origin, b: plane.origin + slide }];
swept = union(&swept, &sweep(plane, face, &path)?)?;
}
Ok(swept)
}
Time
1.8 ms; CPU time 1.6 ms; peak memory 5.7 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 a box fills sliding along (8, 5, 3). brepkit sweeps faces, not solids, so it is//! built by elementary geometry: a convex solid slid along a line without turning fills the//! convex hull of where it starts and where it ends, so the result is brepkit's convex hull of//! the corners of the box from (0, 0, 0) to (10, 6, 4) and of that box moved along the slide.use brepkit_operations::copy::copy_solid;
use brepkit_operations::primitives::{make_box, make_convex_hull};
use brepkit_topology::explorer::solid_vertices;
use brepkit_topology::solid::SolidId;
use brepkit_topology::Topology;
usecrate::solids::moved;
usecrate::Refusal;
pubfnbuild(topo: &mutTopology) -> Result<SolidId, Refusal> {
let start = make_box(topo, 10.0, 6.0, 4.0)?;
let end = copy_solid(topo, start)?;
let end = moved(topo, end, 8.0, 5.0, 3.0)?;
letmut corners = Vec::new();
for solid in [start, end] {
for vertex insolid_vertices(topo, solid)? {
corners.push(topo.vertex(vertex)?.point());
}
}
Ok(make_convex_hull(topo, &corners)?)
}
Time
14 ms; CPU time 15 ms; peak memory 25 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, without turning, along// (8, 5, 3).//// popkern has no sweep of a solid. The box slid along a line is the sum of its edges' three// vectors e1 = (10, 0, 0), e2 = (0, 6, 0), e3 = (0, 0, 4) and the slide v = (8, 5, 3): the convex// polyhedron with a pair of parallel faces square to the cross product of each two of the four,// six slabs. A slab square to n holds the points p with n·p between the sums of the negative and// of the positive n·g over the four vectors g. The three slabs square to the axes make the block// from the origin to (18, 11, 7); the other three, square to e1 × v, e2 × v and e3 × v, are each// a block on a plane square to n, through the slab's middle, reaching well past the solid and// extruded half the slab's thickness each way.fndot(a, b) { a[0] * b[0] + a[1] * b[1] + a[2] * b[2] }
fncross(a, b) { [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]] }
let m = model();
let e = [[10.0, 0.0, 0.0], [0.0, 6.0, 0.0], [0.0, 0.0, 4.0]];
let v = [8.0, 5.0, 3.0];
let swept = m.profile(xy()).rect(18.0, 11.0).at(9.0, 5.5).sketch("axes").extrude(blind(7.0));
for i in0..3 {
let n = cross(e[i], v);
let length = sqrt(dot(n, n));
let lo = 0.0;
let hi = 0.0;
for g in [e[0], e[1], e[2], v] {
let s = dot(n, g);
if s < 0.0 { lo += s; } else { hi += s; }
}
let middle = (lo + hi) / 2.0 / length / length;
let slab = m.tool(|m| m.profile(plane_at([n[0] * middle, n[1] * middle, n[2] * middle], n))
.rect(100.0, 100.0).sketch(`slab_${i}`).extrude(mid_plane((hi - lo) / 2.0 / length)));
swept = swept.intersect(slab, #{ label: `slid_${i}` });
}
m
aetheris left no solid to show.
Time
57 ms; CPU time 56 ms; peak memory 47.2 MB
Notes
refused Aetheris has no sweep of a solid and no union. The solid is a convex polyhedron of twelve faces, but Firmament makes polyhedra only by extruding or lofting a profile, or as the regular Polyhedron<N>, and this one is none of those: each end is three faces of the box.
// A box slid along a straight line, aslant to its faces.//// Refused: Aetheris has no sweep of a solid and no union. The solid is a convex polyhedron of// twelve faces, but Firmament makes polyhedra only by extruding or lofting a profile, or as the// regular Polyhedron<N>, and this one is none of those: each end is three faces of the box.
Time
6.6 ms; CPU time 6.4 ms; peak memory 12.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.
//! Everything the box from (0, 0, 0) to (10, 6, 4) passes through as it slides without turning//! along the vector (8, 5, 3).//!//! Through the kernel's whole sweep of a solid (`sweep_solid`): the box as a convex polyhedron, its//! eight corners and six faces, slid by (8, 5, 3). The kernel bounds the sweep by the box's back//! faces where it starts, its front faces where it stops, and the sheets its silhouette edges sweep//! between.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, 3.0)))?)
}
Time
205 ms; CPU time 205 ms; peak memory 19.6 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 a box fills as it slides without turning along (8, 5, 3): the box from the origin to//! (10, 6, 4), and everything it passes through on its way to (8, 5, 3)–(18, 11, 7).//!//! geop sweeps a profile, not a solid, so the solid is built as what it is: the box where it//! starts, joined by what its three faces facing along the slide (x = 10, y = 6, z = 4) sweep —//! each face swept along the slide without turning, an oblique prism. Every point the box passes//! leaves it, going along the slide, through one of those faces, so it lies in the box or in what//! a face sweeps.usecrate::shared::paths::{at, offset_plane, path3d, sketch3d};
usecrate::shared::{Drawing, extrude, sketch, xy};
usecrate::{Bench, Refusal};
use geop_core_math::primitives::FrameAxis;
use geop_lib_sweep::Orientation;
use geop_ops_extrude_revolve::{Output, SweepArgs};
use geop_ops_model::Combine;
use geop_ops_model::sketch::whole_sketch;
use geop_ops_model::sketch3d::Sketch3d;
pubfnbuild(b: &mutBench) -> Result<(), Refusal> {
letmut base = Drawing::new();
base.rectangle([0.0, 0.0], [10.0, 6.0]);
sketch(b, "base", xy(), base)?;
extrude(b, "start", "base", 4.0, Combine::NewBody)?;
let slide = [8.0, 5.0, 3.0];
// Each face facing along the slide: its plane, normal to an axis at a distance, the face// drawn on it (the yz plane drawn in (y, z), the zx in (x, −z), the xy in (x, y)), and its// centre, where its path starts.let faces = [
("face_x", FrameAxis::X, 10.0, [[0.0, 0.0], [6.0, 4.0]], [10.0, 3.0, 2.0]),
("face_y", FrameAxis::Y, 6.0, [[0.0, 0.0], [10.0, -4.0]], [5.0, 6.0, 2.0]),
("face_z", FrameAxis::Z, 4.0, [[0.0, 0.0], [10.0, 6.0]], [5.0, 3.0, 4.0]),
];
for (id, normal, distance, [a, c], centre) in faces {
let plane = offset_plane(b, &format!("{id}_plane"), normal, distance)?;
letmut face = Drawing::new();
face.rectangle(a, c);
sketch(b, id, plane, face)?;
letmut line = Sketch3d::new();
let from = line.add_point(at(centre));
let to = line.add_point(at([0, 1, 2].map(|k| centre[k] + slide[k])));
line.add_line(from, to);
let path = format!("{id}_slide");
sketch3d(b, &path, line)?;
let body = b.solid()?;
b.step(
&format!("{id}_swept"),
SweepArgs {
profile: whole_sketch(id),
path: Some(path3d(&path)),
orientation: Orientation::FixedNormal,
twist: 0.0,
end_scale: 1.0,
rails: Vec::new(),
output: Output::Solid(Combine::join(body)),
},
)?;
}
Ok(())
}
Time
4.9 ms; CPU time 8.6 ms; peak memory 8.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 solid the box from (0, 0, 0) to (10, 6, 4) fills as it slides without turning along//! (8, 5, 3), to the box from (8, 5, 3) to (18, 11, 7).//!//! 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, 3)).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, 3.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 a box fills as it slides without turning along a line: the box from (0, 0, 0) to// (10, 6, 4), its footprint in the top plane, carried along the vector (8, 5, 3), its whole length// over the roll.unit mm
use std
use std.solids
use std.motion (slides)
in std.top {
a := point
b := point hint((10, 0))
c := point hint((10, 6))
d := point hint((0, 6))
footprint := horizontal line(a, b) -> vertical line(b, c) ->
horizontal line(c, d) -> vertical line(d, a) -> close
fix((0, 0)) a
a distance(10) b
b distance(6) c
}
box := solid(std.solids.Prism(footprint, from: 0mm, to: 4mm))
// the slide: along the line from the origin to (8, 5, 3), as far as that line is long
start := point
fix((0, 0, 0)) start
finish := point
fix((8, 5, 3)) finish
way := line(start, finish)
ram := frame
ram slides(sqrt(8^2 + 5^2 + 3^2) * 1mm) way
part := solid({ p | some t in (0deg, 360deg): p in box at(under: ram) t })
Time
4.3 ms; CPU time 4.1 ms; peak memory 5 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.
//! What the box from the origin to (10, 6, 4) fills as it slides along (8, 5, 3) 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., 3.));
let center = v3(5., 3., 2.) + slide * 0.5;
zonotope(center, &[box_[0], box_[1], box_[2], slide])
}