Skip to content

jitx/shapes/ChamferedRectangle

Package name: jitx/shapes/ChamferedRectangle

Summary

ChamferedRectangle

Chamfered Rectangle

Constructors

Function Description
ChamferedRectangle Constructor for defstruct ChamferedRectangle

Functions

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

Definitions

ChamferedRectangle

Chamfered Rectangle

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

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

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

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

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

A rectangle with chamfered corners.

All four corners are chamfered by the same amount. Has a width, height, chamfer radius and pose. The chamfer radius is the length of the two equal legs of the isosceles right triangle cut from each corner. The pose center is the center of the rectangle. The flip of the pose affects the ordering of the chamfered rectangle's points when converted to a polygon (clockwise when flipped, otherwise counter-clockwise).

Constructors

ChamferedRectangle

Constructor for defstruct ChamferedRectangle

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

Functions

normalize

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

public defn normalize (r:ChamferedRectangle)

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

ChamferedRectangle

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

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

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

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

Related Packages

Forwarded by packages: jitx/shapes, jitx