The solid a square bar fills as it is swung a quarter turn about an axis it faces with an edge.
The bar is a prism standing upright from z = 0 to z = 3. Its section is the square with corners (4, 0), (6, 2), (8, 0) and (6, −2): stood on a corner, its diagonal along the x axis, so that one of its upright edges, the line through (4, 0), faces the z axis squarely.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 90°. Make the solid of everything the bar passes through.
The edges through (4, 0) and (8, 0) are in contact all along them, the fan of normals at each holding the direction to the axis: they sweep cylinders of radii 4 and 8 about it. The bar's faces touch nowhere. What it sweeps is a quarter of the ring between those cylinders, with the bar where it starts and where it stops at its ends.
expected
closed form
volume
137.0973355
3(8 + (π/2)(8² − 4²)/2): each circle about the axis meets the bar's section in one arc, which the turn lengthens by π/2
area
181.8880169
2(8 + 12π) + 3((π/2)(8 + 4) + 4·2√2)
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
72 ms; CPU time 159 ms; peak memory 17.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 square bar fills swung a quarter turn about the z axis: the prism from z = 0 to 3 on//! the square with corners (4, 0), (6, 2), (8, 0) and (6, −2), stood on a corner so that its//! upright edge through (4, 0) faces the axis.usecrate::sketch::polygon;
use cad_kernel::build::prism;
use cad_kernel::geom::tolerance;
use cad_kernel::swept::closed::closed;
use cad_kernel::topo::Brep;
use cad_kernel::trajectory::{Screw, Trajectory};
use std::f64::consts::FRAC_PI_2;
constHEIGHT: f64 = 3.;
pubfnbuild() -> Result<Brep, String> {
// the square walked counter-clockwise seen from above, so its prism rises along zlet square = polygon(&[[4., 0., 0.], [6., -2., 0.], [8., 0., 0.], [6., 2., 0.]]);
let bar = prism(&square, 0., HEIGHT)?;
// the turn about z: a screw that does not advance, turning a radian a radian of the rolllet path = Trajectory::Twist(Screw {
origin: [0., 0., 0.], axis: [0., 0., 1.], ratio: 1., advance: 0.,
});
// the kernel's closed swept solid: a polyhedral tool under a turn (its flat faces mesh// exactly, at any bar)closed(&bar, &path, [0., FRAC_PI_2], bar.size(), tolerance(bar.size()))
.map_err(|why| format!("the bar's sweep not built: {why:?}"))
}
Time
658 ms; CPU time 657 ms; peak memory 368.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.
"""A square bar standing on its edge, swung a quarter turn. The solid a square bar fills as it is
swung a quarter turn about an axis it faces with an edge.
The bar is a prism standing upright from z = 0 to z = 3. Its section is the square with corners (4,
0), (6, 2), (8, 0) and (6, −2): stood on a corner, its diagonal along the x axis, so that one of
its upright edges, the line through (4, 0), faces the z axis squarely.
It turns rigidly about the z axis, right-handed (from +x toward +y), by 90°. Make the solid of
everything the bar passes through.
The edges through (4, 0) and (8, 0) are in contact all along them, the fan of normals at each
holding the direction to the axis: they sweep cylinders of radii 4 and 8 about it. The bar's faces
touch nowhere. What it sweeps is a quarter of the ring between those cylinders, with the bar where
it starts and where it stops at its ends."""fromOCP.BRepBuilderAPIimportBRepBuilderAPI_MakeFace, BRepBuilderAPI_MakePolygonfromOCP.BRepPrimAPIimportBRepPrimAPI_MakePrismfromOCP.gp import gp, gp_Pnt, gp_Vec
from sweep import flat_contacts_turned, turned, united
SECTION = [(4, 0), (6, 2), (8, 0), (6, -2)]
HEIGHT = 3TURN = 90# degrees about the z axisdefbuild():
square = BRepBuilderAPI_MakeFace(BRepBuilderAPI_MakePolygon(
*(gp_Pnt(x, y, 0) for x, y inSECTION), True).Wire()).Face()
bar = BRepPrimAPI_MakePrism(square, gp_Vec(0, 0, HEIGHT)).Shape()
# Each upright face meets the turn square-on along the plane through the axis and its# normal, none of which reaches it: they lead or trail all over.returnunited(turned(bar, gp.OZ_s(), TURN, flat_contacts_turned(bar, gp.OZ_s())))
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
6.9 ms; CPU time 6.7 ms; peak memory 10.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 a square bar fills as it is swung a quarter turn about an axis it faces with an//! edge: the prism from z = 0 to z = 3 on the square with corners (4, 0), (6, 2), (8, 0) and//! (6, −2), turned rigidly about the z axis by 90°.//!//! The bar is the square extruded; its sweep is kentron's sweep of a solid (`sweep::solid`, one//! turn).usecrate::bench::{p, v};
usecrate::shared::loft::flat;
use kentron::math::Axis;
use kentron::sweep::{self, RigidMotion};
use kentron::topology::{Model, Shape};
use std::f64::consts::FRAC_PI_2;
pubfnbuild(m: &mutModel) -> kentron::Result<Shape> {
let square = flat(m, &[p(4.0, 0.0, 0.0), p(6.0, -2.0, 0.0), p(8.0, 0.0, 0.0), p(6.0, 2.0, 0.0)])?;
let bar = sweep::extrude(m, square, v(0.0, 0.0, 3.0))?.shape;
sweep::solid(m, bar, &RigidMotion::Turn { axis: Axis::Z, from: 0.0, to: FRAC_PI_2 })
}
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
35 ms; CPU time 34 ms; peak memory 47.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.
//! The solid a square bar fills as it is swung a quarter turn about the z axis, right-handed: the//! prism from z = 0 to 3 on the square with corners (4, 0), (6, 2), (8, 0) and (6, −2).//!//! solidcraft-kernel has no sweep of a solid, so the swing is built by elementary geometry. The//! square is symmetric about the x axis and convex, so it meets each circle about the z axis in//! one arc holding the circle's point on the x axis, and turned a quarter turn it passes over that//! arc where it starts, the quarter circle on from there, and the arc where it stops. So the//! sweep is the bar's section by the half-plane at 0°, the rectangle 4 ≤ x ≤ 8, 0 ≤ z ≤ 3,//! revolved the quarter turn, with the bar's half behind that section where it starts (y ≤ 0)//! and its half ahead of it where it stops.usesuper::drum_swung_partway_into_ring_sector::turned;
usecrate::solids::*;
pubfnbuild() -> R<Body> {
let level = Plane { origin: Vec3::ZERO, x: Vec3::X, y: Vec3::Y };
let behind = extrude(&level, polygon(&[(4.0, 0.0), (6.0, -2.0), (8.0, 0.0)]), 0.0, 3.0)?;
let ahead = extrude(&level, polygon(&[(4.0, 0.0), (8.0, 0.0), (6.0, 2.0)]), 0.0, 3.0)?;
let fan = revolve_z(rect(4.0, 0.0, 8.0, 3.0), 90.0)?;
union(&union(&behind, &fan)?, &turned(&ahead, 90.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.
Time
450 ms; CPU time 848 ms; peak memory 34.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 solid a square prism (section (4, 0), (6, 2), (8, 0), (6, -2), z = 0 to 3) fills as it turns// 90° about the z axis.//// A turn about z sweeps the bar where it starts and stops and, between them, its shadow on a// half-plane through the axis revolved: the bar is symmetric about the xz plane and reaches from// 4 to 8 from the axis at every height, so its shadow is the rectangle 4 ≤ ρ ≤ 8, 0 ≤ z ≤ 3.let m = model();
let bar = |m| m.profile(xy()).polygon([[4.0, 0.0], [6.0, 2.0], [8.0, 0.0], [6.0, -2.0]]).sketch("bar").extrude(blind(3.0));
let s = m.profile(xz()).polygon([[4.0, 0.0], [8.0, 0.0], [8.0, 3.0], [4.0, 3.0]]).sketch("shadow")
.revolve(axis_at([0.0, 0.0, 0.0], [0.0, 0.0, 1.0]), blind(90.0));
s = s.union(m.tool(|m| m.profile(xy()).polygon([[4.0, 0.0], [6.0, 2.0], [8.0, 0.0], [6.0, -2.0]]).sketch("start").extrude(blind(3.0))));
s = s.union(m.tool(|m| m.profile(xy()).polygon([[0.0, 4.0], [-2.0, 6.0], [0.0, 8.0], [2.0, 6.0]]).sketch("stop").extrude(blind(3.0))));
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
6.3 ms; CPU time 6.1 ms; peak memory 10.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.
//! Everything a square bar, stood on an edge facing the z axis, passes through as it swings a//! quarter turn about that axis.//!//! The kernel's sweep of a solid (`sweep_solid_within`, its planar motion of a prism, which//! includes the end positions exactly): the bar is the prism of the square with corners (4, 0), (6,//! −2), (8, 0) and (6, 2) from z = 0 to z = 3, turned 90° about the z axis. Asked for within 40 of//! the vertical line through (−10, −10) from z = 0 to 3 (a prism's sweep is asked for between its//! ends), which holds the whole sweep; its axis is kept off the turn's, about which the bar's//! corners keep their distance.usecrate::solids::p;
usecrate::Refusal;
use brep_kernel::{
boolean_operation_nary, sweep_solid_within, BooleanOperation, BrepSolid, OutlinePiece,
ScrewStep, SolidMotion, SweepClip, SweptTool,
};
pubfnbuild() -> Result<BrepSolid, Refusal> {
let z = p(0.0, 0.0, 1.0);
let corners = [[4.0, 0.0], [6.0, -2.0], [8.0, 0.0], [6.0, 2.0]];
let bar = SweptTool::Prism {
origin: p(0.0, 0.0, 0.0),
normal: z,
x_axis: p(1.0, 0.0, 0.0),
outline: (0..4).map(|k| OutlinePiece::Line { from: corners[k], to: corners[(k + 1) % 4] }).collect(),
from: 0.0,
to: 3.0,
};
let turn = SolidMotion {
steps: vec![ScrewStep { axis_origin: p(0.0, 0.0, 0.0), axis_direction: z, turn: 1.0, advance: 0.0 }],
from: 0.0,
to: 90f64.to_radians(),
};
let around = SweepClip {
axis_origin: p(-10.0, -10.0, 0.0),
axis_direction: z,
reference: p(1.0, 0.0, 0.0),
radius: [0.0, 40.0],
axial: [0.0, 3.0],
angle: None,
};
let bodies = sweep_solid_within(&bar, &turn, &around)?;
Ok(boolean_operation_nary(&bodies, BooleanOperation::Union)?)
}
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
6.6 ms; CPU time 12 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 a square bar (the square with corners (4, 0), (6, 2), (8, 0), (6, −2), from z = 0 to//! 3) fills as it turns a quarter turn about the z axis.//!//! The square sketched and extruded; what it passes through is cadrs's sweep of a solid (one//! turn).usecrate::bench::extrude;
usecrate::shared::swept::{swung, z_axis};
usecrate::Refusal;
use cadrs_kernel::{BodyId, DefaultKernel, Loop, Plane, Profile};
pubfnbuild(k: &mutDefaultKernel) -> Result<BodyId, Refusal> {
let square = Loop::polygon(&[[4.0, 0.0], [6.0, 2.0], [8.0, 0.0], [6.0, -2.0]]);
let bar = extrude(k, &Profile::of(Plane::xy(0.0), vec![square]), 3.0)?;
swung(k, bar, z_axis(), 0.0, 90.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
14 ms; CPU time 13 ms; peak memory 8.5 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 square bar fills as it turns a quarter turn about the z axis: the prism from z = 0//! to 3 on the square with corners (4, 0), (6, 2), (8, 0) and (6, −2), stood on a corner.use std::f64::consts::FRAC_PI_2;
use springrep::sweep::{extrude, solid};
use springrep::topo::Brep;
usecrate::shared::swept::{polygon, turning};
usecrate::shared::{at, e};
pubfnbuild() -> Result<Brep, String> {
let square = polygon(&[(4.0, 0.0), (6.0, -2.0), (8.0, 0.0), (6.0, 2.0)], "side");
let bar = extrude(&square, &at([0.0, 0.0, 0.0]), 3.0, "bar").map_err(e)?;
solid(&bar, &turning(0.0, FRAC_PI_2), "swept").map_err(e)
}
geomsolver left no solid to show.
Time
43 ms; CPU time 43 ms; peak memory 22.8 MB
Notes
refused error[E080]: `part`: native CAD boundary construction for continuous motion sweeps is not yet supported
// The solid a square bar standing on its edge fills as it is swung a quarter turn about z. The// bar's section, in the top plane, is the square stood on a corner with its diagonal along x// from (4, 0) to (8, 0): its sides at 45 degrees, equal, square to one another. The bar is the// prism over it from z = 0 to 3, and the part is the kernel's sweep of it turned right-handed// about z through 90 degrees.unit mm
use std
use std.solids
use std.motion (turns)
in std.top {
private a := point
private b := point hint((6, 2))
private c := point hint((8, 0))
private d := point hint((6, -2))
fix((4, 0)) a
fix((8, 0)) c
(ab := line(a, b)) -> perpendicular equal (bc := line(b, c)) ->
(cd := line(c, d)) -> perpendicular equal (da := line(d, a)) -> close
}
construction bar := solid(std.solids.Prism(face(ab, bc, cd, da), from: 0mm, to: 3mm))
swing := frame
swing turns(1) std.z
part := solid({ p | some t in (0deg, 90deg): p in bar at(under: swing) t })
Time
7.1 ms; CPU time 6.9 ms; peak memory 5.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.
//! What an upright square bar on its corner (the square (4, 0), (6, 2), (8, 0), (6, −2), from//! z = 0 to 3) fills as it turns a quarter turn about the z axis.use anvil_brep::Solid;
usecrate::shared::{prism, rect, swung, turn_z, union};
pubfnbuild() -> Result<Solid, String> {
// anvil-brep has no sweep of a solid. Turned about the z axis the bar fills the revolve of// what it covers in a half-plane through the axis, the band 4 ≤ ρ ≤ 8, 0 ≤ z ≤ 3, and itself// where it starts and stopslet bar = prism(&[(4., 0.), (6., -2.), (8., 0.), (6., 2.)], 0., 3.)?;
let band = swung(rect((4., 0.), (8., 3.)).segments, 0., 90.)?;
union(&union(&band, &bar)?, &bar.transformed(&turn_z(90.)))
}