On this page:
Point
Point.x
Point.y
Point  Like
Point  Like.to_  point
Point  Like.to_  point
Point.zero
Size
Size.width
Size.height
Size  Like
Size  Like.to_  size
Size  Like.to_  size
Size.zero
Rect
Rect.x
Rect.y
Rect.width
Rect.height
Rect.point
Rect.size
Rect  Like
Rect  Like.to_  rect
Rect  Like.to_  rect
Rect.zero
Transformation
Transformation.xx
Transformation.yx
Transformation.xy
Transformation.yy
Transformation.x0
Transformation.y0
Transformation.translate
Transformation.scale
Transformation.rotate
Transformation.transform
Layered  Transformation
8.15.0.2

9 Point, Size, and Rectangle🔗ℹ

class

class draw.Point(x :: Real, y :: Real)

 

annotation

draw.PointLike

 

annotation

draw.PointLike.to_point

 

function

fun draw.PointLike.to_point(pt :: PointLike) :: Point

 

value

def draw.Point.zero :: Point = Point(0, 0)

The Point class represents a point in two dimensions.

Methods that expect a point typically accept a value satisfying PointLike, which is any of the following:

The PointLike.to_point annotation is satisfied by any value that satisfis PointLike, and the value is converted to an equivalent Point object if it is not one already.

The PointLike.to_point function converts a PointLike value to a Point, like the PointLike.to_point annotation. An expression pt with static information from PointLike can call PointLike.to_point(pt) using pt.to_point().

Point.zero is a Point object with 0 values.

class

class draw.Size(width :: NonnegReal, height :: NonnegReal)

 

annotation

draw.SizeLike

 

annotation

draw.SizeLike.to_size

 

function

fun draw.SizeLike.to_size(sz :: SizeLike) :: Size

 

value

def draw.Size.zero :: Size = Size(0, 0)

The Size class represents a size in two dimensions.

Methods that expect a size typically accept a value satisfying SizeLike, which is any of the following:

The SizeLike.to_size annotation, SizeLike.to_size function, and Size.zero value are anaologous to PointLike.to_point, PointLike.to_point, and Point.zero.

class

class draw.Rect(x :: Real, y :: Real,

                width :: NonnegReal, height :: NonnegReal):

  constructor

  | (x :: Real, y :: Real,

     width :: NonnegReal, height :: NonnegReal)

  | (point :: PointLike, size :: SizeLike)

 

property

property (r :: draw.Rect).point :: Point

 

property

property (r :: draw.Rect).size :: Size

 

annotation

draw.RectLike

 

annotation

draw.RectLike.to_rect

 

function

fun draw.RectLike.to_rect(sz :: RectLike) :: Rect

 

value

def draw.Rect.zero :: Rect = Rect(0, 0, 0, 0)

The Rect class represents a rectagular region, where x and y correspond to the top-left of the rectangle. The Rect.point property produces x and y in a Point, while Rect.size property produces width and height in a Size.

Methods that expect a rectangle typically accept a value satisfying RectLike, which is any of the following:

The RectLike.to_rect annotation, RectLike.to_rect function, and Rect.zero value are anaologous to PointLike.to_point, PointLike.to_point, and Point.zero.

class

class draw.Transformation(xx :: Real, yx :: Real,

                          xy :: Real, yy :: Real,

                          x0 :: Real, y0 :: Real)

 

method

method (t :: Transformation).translate(dx :: Real, dy :: Real)

  :: Transformation

 

method

method (t :: Transformation).scale(sx :: Real, sy :: Real)

  :: Transformation

 

method

method (t :: Transformation).rotate(a :: Real)

  :: Transformation

 

method

method (t :: Transformation).transform(by_t :: Transformation)

  :: Transformation

A Transformation object represents a transformation matrix:

The Transformation.translate, Transformation.scale, Transformation.rotate, and Transformation.transform methods produce a new Transformation object that represents the starting transformation followed by an additional one.

annotation

draw.LayeredTransformation

A LayeredTransformation represents the internal transformation state of a DC object. It is useful only as a result or new value for the DC.layered_transformation property.