Skip to content

jitx/shapes/RoundedRectangle

Package name: jitx/shapes/RoundedRectangle

Summary

RoundedRectangle

Rounded Rectangle

Constructors

Function Description
RoundedRectangle Constructor for defstruct RoundedRectangle

Functions

Function Description
RoundedRectangle Create a rounded rectangle anchored to a specified alignment with respect to the origin.
normalize Create an equivalent rounded rectangle with pose angle 0.0 for the given axis-aligned rounded rectangle.

Definitions

RoundedRectangle

Rounded Rectangle

public defstruct RoundedRectangle <: Shape & Centerable & HasMetaUtils :
    height: Double
    pose: Pose
    radius: Double
    width: Double

  • height: Double - Height of this rounded rectangle. Must be non-negative.

  • pose: Pose - Pose of this rounded rectangle. Default value is (0.0, 0.0) with no rotation and no flip.

  • radius: Double - Radius of the rounded corners of this rounded rectangle. Must be non-negative and at most half of the minimum of the width and height.

  • width: Double - Width of this rounded rectangle. Must be non-negative.

A rectangle with rounded (filleted) corners.

All four corners are rounded to the same radius. Has a width, height, corner radius and pose. The pose center is the center of the rectangle. The flip of the pose affects the ordering of the rounded rectangle's points when converted to a polygon (clockwise when flipped, otherwise counter-clockwise).

Constructors

RoundedRectangle

Constructor for defstruct RoundedRectangle

public defn RoundedRectangle (width:Double, height:Double, radius:Double, pose:Pose = ?)

Functions

RoundedRectangle

Create a rounded rectangle anchored to a specified alignment with respect to the origin.

public defn RoundedRectangle (anchor:Anchor, w:Double, h:Double, r:Double)

  • anchor: Anchor - Anchor to align the rounded rectangle with to the origin.
  • w: Double - Width of the rounded rectangle.
  • h: Double - Height of the rounded rectangle.
  • r: Double - Corner radius of the rounded rectangle.

The alignment is performed with respect to the un-rounded rectangular bounding box of the rounded rectangle.

normalize

Create an equivalent rounded rectangle with pose angle 0.0 for the given axis-aligned rounded rectangle.

public defn normalize (r:RoundedRectangle)

  • r: RoundedRectangle - The rounded rectangle to create the equivalent of.
  • Throws Error - if the rounded rectangle's pose angle is not axis-aligned.

Related Packages

Forwarded by packages: jitx/shapes, jitx