All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 2 Drawing Graphics > 2.5 General Geometric Objects in CLIM

A*
rectangle*
is a special case of a four-sided polygon whose edges are parallel to the coordinate axes. A rectangle can be specified completely by four real numbers (*
min-x*
, *
min-y, max-x, max-y*
). They are not closed under affine transformations, although they are closed under rectilinear transformations. CLIM uses rectangles extensively for various purposes, particularly in optimizations.

The functions for creating and dealing with rectangles are the following:

rectangle [Protocol Class]

Summary: The protocol class that corresponds to a mathematical rectangle, that is, a rectangular polygons whose sides are parallel to the coordinate axes. This is a subclass of polygon . If you want to create a new class that behaves like a rectangle, it should be a subclass of rectangle . Subclasses of rectangle must obey the rectangle protocol.

rectanglep [Function]

Summary: Returns
t
if *
object*
is a rectangle; otherwise, it returns
nil
.

Summary: An instantiable class that implements an axis-aligned rectangle. This is a subclass of rectangle . This is the class that make-rectangle and make-rectangle* instantiate. Members of this class are immutable.

make-rectangle [Function]

make-rectangle* [Function]

Summary: Returns an object of class
standard-rectangle
whose edges are parallel to the coordinate axes. One corner is at the point *
point1*
(or the position (*
x1*
,*
y1*
)) and the opposite corner is at the point *
point2*
(or the position (*
x2*
,*
y2*
)). There are no ordering constraints among *
point1*
and *
point2*
(or *
x1*
and *
x2*
, and *
y1*
and *
y2*
).

This function captures its mutable inputs; the consequences of modifying those objects are unspecified.

The following generic functions comprise the rectangle Application Programmer Interface. Only rectangle-edges* is in the rectangle protocol; that is, all classes that are subclasses of rectangle must implement methods for rectangle-edges* , but need not implement methods for the remaining functions.

rectangle-edges* [Generic Function]

Summary: Returns the coordinates of the minimum *
x*
and *
y*
and maximum *
x*
and *
y*
of the rectangle *
rectangle*
as four values, *
min-x*
, *
min-y*
, *
max-x*
, and *
max-y*
.

rectangle-min-point [Generic Function]

rectangle-max-point [Generic Function]

Summary: Returns the min point and max point of the rectangle *
rectangle*
, respectively. The position of a rectangle is specified by its min point.

CLIM supplies default methods for rectangle-min-point and rectangle-max-point on the protocol class rectangle that are implemented by calling rectangle-edges* .

rectangle-min-x [Generic Function]

rectangle-min-y [Generic Function]

rectangle-max-x [Generic Function]

rectangle-max-y [Generic Function]

Summary: Returns (respectively) the minimum *
x*
and *
y*
coordinate and maximum *
x *
and *
y*
coordinate of the rectangle *
rectangle*
.

CLIM supplies default methods for these four generic functions on the protocol class rectangle that are implemented by calling rectangle-edges* .

rectangle-width [Generic Function]

rectangle-height [Generic Function]

rectangle-size [Generic Function]

Summary:
rectangle-width
returns the width of the rectangle *
rectangle*
, which is the difference between its maximum and minimum *
x *
values.
rectangle-height
returns the height, which is the difference between its maximum and minimum *
y*
values.
rectangle-size
returns two values, the width and the height.

CLIM supplies default methods for these four generic functions on the protocol class rectangle that are implemented by calling rectangle-edges* .

*Common Lisp Interface Manager 2.0 User's Guide - 7 Aug 2017*