jitx/shapes/Capsule¶
Package name: jitx/shapes/Capsule
Summary¶
Definitions¶
Capsule¶
Capsule
public defstruct Capsule <: Shape & Centerable & HasMetaUtils :
height: Double
pose: Pose
width: Double
-
height: Double
- Height of this capsule. Must be non-negative. -
pose: Pose
- Pose of this capsule. Default value is(0.0, 0.0)
with no rotation and no flip. -
width: Double
- Width of this capsule. Must be non-negative.
A pill-like shape.
Formed by rounding (filleting) the corners of a rectangle to a radius of half of the shorter dimension, such that the two corners on each short side merge into one semicircle. If the width and height are equal, the shape is a circle. The pose center is the center of the rectangle. The flip of the pose affects the ordering of the capsule's points when converted to a polygon (clockwise when flipped, otherwise counter-clockwise).
Constructors¶
Capsule¶
Constructor for defstruct Capsule
public defn Capsule (width:Double, height:Double, pose:Pose = ?)
Functions¶
Capsule¶
Create a capsule anchored to a specified alignment with respect to the origin.
public defn Capsule (anchor:Anchor, w:Double, h:Double)
anchor: Anchor
- Anchor to align the capsule with to the origin.w: Double
- Width of the capsule.h: Double
- Height of the capsule.
The alignment is performed with respect to the rectangular component inside the capsule, and not the bounding box of the capsule.
normalize¶
Create an equivalent capsule with pose angle 0.0
for the given axis-aligned capsule.
public defn normalize (r:Capsule)
r: Capsule
- The capsule to create the equivalent of.- Throws
Error
- if the capsule's pose angle is not axis-aligned.
Related Packages¶
Forwarded by packages: jitx/shapes, jitx