11.01.2015 Views

CLIM 2 User Guide

CLIM 2 User Guide

CLIM 2 User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.6.3 <strong>CLIM</strong> point objects<br />

A point is a mathematical point in the drawing plane, which is identified by its coordinates, a pair of real<br />

numbers. Points have neither area nor length. Note that a point is not the same thing as a pixel; <strong>CLIM</strong>'s<br />

model of the drawing plane has continuous coordinates.<br />

You can create point objects and use them as arguments to the drawing functions. Alternatively, you can<br />

use the spread versions of the drawing functions, that is the drawing functions with stars appended to their<br />

names. For example, instead of draw-point, use draw-point* which take two arguments specifying<br />

a point by its coordinates. (Note that we generally recommend the use of the spread versions, since the<br />

<strong>CLIM</strong> implementation is optimized for those functions.)<br />

The operations for creating and dealing with points are:<br />

point<br />

[Class]<br />

■ The protocol class that corresponds to a mathematical point. If you want to create a new class that<br />

obeys the point protocol, it must be a subclass of point.<br />

standard-point<br />

■ A class that implements a point. This is the class that make-point instantiates.<br />

[Class]<br />

make-point<br />

Arguments: x y<br />

[Function]<br />

■ Creates and returns a point object whose coordinates are x and y. The point object is an instance<br />

of standard-point.<br />

point-position<br />

Arguments: point<br />

■ Returns two values, the x and y coordinates of point.<br />

point-x<br />

Arguments: point<br />

■ Returns the x coordinate of point.<br />

point-y<br />

Arguments: point<br />

■ Returns the y coordinate of point.<br />

[Generic function]<br />

[Generic function]<br />

[Generic function]<br />

3.6.4 Polygons and polylines in <strong>CLIM</strong><br />

A polyline is a path that consists of one or more line segments joined consecutively at their end-points. A<br />

line is a polyline that has only a single segment.<br />

Polylines that have the end-point of their last line segment coincident with the start-point of their first line<br />

segment are called closed; this use of the term ‘closed’ should not be confused with closed sets of points.<br />

A polygon is an area bounded by a closed polyline.<br />

If the boundary of a polygon intersects itself, the odd-even winding-rule defines the polygon: a point is<br />

inside the polygon if a ray from the point to infinity crosses the boundary an odd number of times.<br />

46 <strong>CLIM</strong> 2.2 <strong>User</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!