Skip to main content

Function: atShapeExtremum()

function atShapeExtremum(
shape,
axis,
extremum,
tolerance?): ShapeExtremumFilter;

Defined in: packages/replicad/src/finders/helpers.ts:51

Creates a predicate for a finder's when method that selects elements touching an axis-aligned bounding-box extreme of a shape.

An element is selected when its bounding-box minimum or maximum is within tolerance of the corresponding bound of shape. This means that a side face touching the top of a shape is considered top-most too. Combine this predicate with an orientation filter when only horizontal or vertical elements should be selected.

The shape bounds are calculated once when the predicate is created. Element bounds are calculated whenever the predicate is evaluated.

Parameters

shape

AnyShape

Shape whose bounds define the extremum.

axis

CartesianAxis

Cartesian axis along which to compare bounds.

extremum

"min" | "max"

Whether to compare the minimum or maximum bound.

tolerance?

number = 1e-6

Maximum difference between bounds. Defaults to 1e-6.

Returns

ShapeExtremumFilter

A predicate that can be passed to EdgeFinder.when or FaceFinder.when.

Example

const topEdges = new EdgeFinder()
.when(atShapeExtremum(shape, "Z", "max"))
.parallelTo("XY")
.find(shape);