class Geometry · Computations

Bars

Creates bars (rectangles) standing on a segment or at a pin.

Static methods

fromAnchoredPinstatic

static fromAnchoredPin(pin: Pin | PinLike, anchorRatio: Real | NumberLike, width: Real | NumberLike, height: Real | NumberLike, left: Bool | BoolLike, result?: Rectangle | null): Rectangle

Creates a bar anchored at a specific ratio along its width.

pin
The pin defining the anchor position and orientation.
anchorRatio
The ratio along the bar's width at which the pin sits. 0 places the pin at the left edge, 0.5 at the center, and 1 at the right edge.
width
The total width of the bar along the pin's direction.
height
The height of the bar perpendicular to the pin's direction.
left
If true, the bar extends to the left of the pin's direction; otherwise to the right.
result optional
Optional Rectangle to write the result into; it is returned. Without it, a new Rectangle is returned.

Returns A rectangle representing the bar anchored at anchorRatio along its width.

fromPinstatic

static fromPin(pin: Pin | PinLike, width: Real | NumberLike, height: Real | NumberLike, left: Bool | BoolLike, result?: Rectangle | null): Rectangle

Creates a bar centered at a pin.

pin
The pin defining the center position and orientation of the bar.
width
The total width of the bar along the pin's direction.
height
The height of the bar perpendicular to the pin's direction.
left
If true, the bar extends to the left of the pin's direction; otherwise to the right.
result optional
Optional Rectangle to write the result into; it is returned. Without it, a new Rectangle is returned.

Returns A rectangle representing the bar centered at pin.

fromSegmentstatic

static fromSegment(p1: Point | VectorLike, p2: Point | VectorLike, height: Real | NumberLike, left: Bool | BoolLike, result?: Rectangle | null): Rectangle

Creates a bar from a baseline segment, extruded perpendicularly by a given height.

p1
The start point of the baseline segment.
p2
The end point of the baseline segment.
height
The height of the bar, measured perpendicular to the segment.
left
If true, the bar extends to the left of the segment direction; otherwise to the right.
result optional
Optional Rectangle to write the result into; it is returned. Without it, a new Rectangle is returned.

Returns A rectangle representing the bar above the segment from p1 to p2.