Function or value | Description |
Full Usage:
area rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Quantity<Squared<'Units>>
|
|
Full Usage:
axes rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Frame2D<'Units, 'Coordinates, 'Defines>
|
![]() ![]() ![]() ![]() ![]() ![]() Get the central axes of a rectangle as a `Frame2D`: rectangle = Rectangle2D.with (Length.meters 2) (Length.meters 5) (Length.meters 1) (Length.meters 3) Rectangle2D.axes rectangle --> Frame2D.atPoint (Point2D.meters 3.5 2) The origin point of the frame will be the center point of the rectangle.
|
Full Usage:
boundingBox rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: BoundingBox2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Get the minimal bounding box containing a given rectangle. This will have exactly the same shape and size as the rectangle itself if the rectangle is axis-aligned, but will be larger than the rectangle if the rectangle is at an angle. square = Rectangle2D.with { x1 = Length.meters 0 , x2 = Length.meters 1 , y1 = Length.meters 0 , y2 = Length.meters 1 } diamond = square |> Rectangle2D.rotateAround Point2D.origin (Angle.degrees 45) Rectangle2D.boundingBox diamond --> BoundingBox2D.from --> (Point2D.meters -0.7071 0) --> (Point2D.meters 0.7071 1.4142)
|
Full Usage:
centerPoint rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Point2D<'Units, 'Coordinates>
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a frame centered on the given axes, with the given overall dimensions; Rectangle2D.withDimensions dimensions angle centerPoint could be written as Rectangle2D.centeredOn (Frame2D.withAngle angle centerPoint) dimensions
|
Full Usage:
contains point rectangle
Parameters:
Point2D<'Units, 'Coordinates>
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: bool
|
|
Full Usage:
dimensions rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Size2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Get the overall dimensions (width and height) of a rectangle: rectangle = Rectangle2D.with { x1 = Length.meters 2 , x2 = Length.meters 5 , y1 = Length.meters 1 , y2 = Length.meters 3 } Rectangle2D.dimensions rectangle --> ( Length.meters 3, Length.meters 2 )
|
Full Usage:
edges rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: LineSegment2D<'Units, 'Coordinates> list
|
![]() ![]() ![]() ![]() ![]() ![]() Get the edges of a rectangle as a list. The edges will be returned in counterclockwise order if the rectangle's axes are right-handed, and clockwise order if the axes are left-handed.
|
|
![]() ![]() ![]() ![]() ![]() ![]() Construct an axis-aligned rectangle given the X and Y coordinates of two diagonally opposite vertices. The X and Y directions of the resulting rectangle are determined by the order of the given values: - If `x1 <= x2`, then the rectangle's X direction will be `Direction2D.positiveX`, otherwise it will be `Direction2D.negativeX` - If `y1 <= y2`, then the rectangle's Y direction will be `Direction2D.positiveY`, otherwise it will be `Direction2D.negativeY` Therefore, something like Rectangle2D.from (Pixels.pixels 0) (Pixels.pixels 300) (Pixels.pixels 500) (Pixels.pixels 0) would have its X direction equal to `Direction2D.positiveX` and its Y direction equal to `Direction2D.negativeY`. -}
|
Full Usage:
fromBoundingBox box
Parameters:
BoundingBox2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Construct an axis-aligned rectangle stretching from one point to another; Rectangle2D.from p1 p2 is equivalent to Rectangle2D.with p1.X p1.Y p2.X p2.Y and so the same logic about the resulting rectangle's X and Y directions applies (see above for details). Therefore, assuming a Y-up coordinate system, something like Rectangle2D.from lowerLeftPoint upperRightPoint would have positive X and Y directions, while Rectangle2D.from upperLeftPoint lowerRightPoint would have a positive X direction but a negative Y direction.
|
Full Usage:
interpolate rectangle u v
Parameters:
Rectangle2D<'Units, 'Coordinates>
u : float
v : float
Returns: Point2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Interpolate within a rectangle based on coordinates which range from 0 to 1. For example, the four vertices of a given rectangle are [ Rectangle2D.interpolate rectangle 0 0 Rectangle2D.interpolate rectangle 1 0 Rectangle2D.interpolate rectangle 1 1 Rectangle2D.interpolate rectangle 0 1 ] and its center point is Rectangle2D.interpolate rectangle 0.5 0.5
|
Full Usage:
mirrorAcross axis rectangle
Parameters:
Axis2D<'Units, 'Coordinates>
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Mirror a rectangle across a given axis. Note that this will flip the handedness of the rectangle's axes, and therefore the order/direction of results from `Rectangle2D.vertices` and `Rectangle2D.edges` will change.
|
Full Usage:
placeIn frame rectangle
Parameters:
Frame2D<'Units, 'GlobalCoordinates, 'LocalCoordinates>
rectangle : Rectangle2D<'Units, 'LocalCoordinates>
Returns: Rectangle2D<'Units, 'GlobalCoordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Take a rectangle considered to be defined in local coordinates relative to a given reference frame, and return that rectangle expressed in global coordinates.
|
Full Usage:
relativeTo frame rectangle
Parameters:
Frame2D<'Units, 'GlobalCoordinates, 'LocalCoordinates>
rectangle : Rectangle2D<'Units, 'GlobalCoordinates>
Returns: Rectangle2D<'Units, 'LocalCoordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Take a rectangle defined in global coordinates, and return it expressed in local coordinates relative to a given reference frame.
|
Full Usage:
rotateAround point angle rectangle
Parameters:
Point2D<'Units, 'Coordinates>
angle : Angle
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
|
Full Usage:
scaleAbout point scale rectangle
Parameters:
Point2D<'Units, 'Coordinates>
scale : float
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
![]() ![]() ![]() ![]() ![]() ![]() Scale a rectangle about a given point by a given scale. Note that scaling by a negative value will flip the handedness of the rectangle's axes, and therefore the order/direction of results from `Rectangle2D.vertices` and `Rectangle2D.edges` will change.
|
Full Usage:
toPolygon rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Polygon2D<'Units, 'Coordinates>
|
|
Full Usage:
translateBy displacement rectangle
Parameters:
Vector2D<'Units, 'Coordinates>
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
|
Full Usage:
translateIn direction distance rectangle
Parameters:
Direction2D<'Coordinates>
distance : Quantity<'Units>
rectangle : Rectangle2D<'Units, 'Coordinates>
Returns: Rectangle2D<'Units, 'Coordinates>
|
|
Full Usage:
vertices rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Point2D<'Units, 'Coordinates> list
|
![]() ![]() ![]() ![]() ![]() ![]() Get the vertices of a rectangle as a list. The vertices will be returned in counterclockwise order if the rectangle's axes are right-handed, and clockwise order if the axes are left-handed.
|
|
|
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a rectangle with the given X axis and overall dimensions. The rectangle will be centered on the axis' origin point.
|
|
![]() ![]() ![]() ![]() ![]() ![]() Construct a rectangle with the given Y axis and overall dimensions. The rectangle will be centered on the axis' origin point.
|
Full Usage:
xAxis rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Axis2D<'Units, 'Coordinates>
|
|
Full Usage:
yAxis rectangle
Parameters:
Rectangle2D<'Units, 'Coordinates>
Returns: Axis2D<'Units, 'Coordinates>
|
|