5.2 Dictionary

  1. 5.2.1 Points
    1. create-point
    2. point-x
    3. point-y
    4. p+
    5. p-
    6. p*
    7. point-rotate
    8. point-angle
    9. point-norm
    10. point-distance
  2. 5.2.2 Paths
    1. create-path
    2. path-clear
    3. path-reset
    4. path-extend
    5. path-concatenate
    6. path-replace
    7. path-type
    8. path-size
    9. path-last-knot
    10. path-clone
    11. path-reverse
    12. path-translate
    13. path-rotate
    14. path-scale
  3. 5.2.3 Interpolations
    1. make-straight-line
    2. make-arc
    3. make-catmull-rom
    4. make-bezier-curve
    5. interpolation-segment
    6. interpolation-clone
    7. interpolation-reverse
  4. 5.2.4 Iterators
    1. path-iterator-reset
    2. path-iterator-next
    3. path-iterator
    4. path-iterator-segmented
    5. filter-distinct
  5. 5.2.5 Basic shape
    1. make-circle-path
    2. make-rectangle-path
  6. 5.2.6 Transformations
    1. make-discrete-path
    2. stroke-path
    3. dash-path
    4. round-path
    5. clip-path
    6. clip-path/path

Important: We consider a coordinate system with X axis being positive on the left of the origin and Y axis being positive to the bottom of the origin, like for a screen with top-left pixel with (0,0) coordinate. This is important because sometimes I use term such as "left", "top" or "clockwise". If you intend to use another coordinate system, make sure to take care of that.

A path is described by a serie of knots joined by various type of interpolations. The library support 4 types of interpolation:

See the constructor for each type of interpolation for more details. Each interpolations are implemented by a class and a set of CLOS methods. This way, it is easy to implement new interpolation scheme inside the library.

A path can be of 3 types:

Paths of types :closed-polyline and :polygon are always closed implicitly by a straight line (or a custom interpolation) from the last knot to the first knot.

5.2.1 Points

A point is called a knot when it specify a position along the path (vs points used for Bezier control points.)

Function CREATE-POINT

Function POINT-X

Function POINT-Y

Function P+

Syntax

Arguments and Values:

Description:

Function P-

Arguments and Values:

Description:

Notes:

Function P*

Syntax:

Arguments and Values:

Description:

Function POINT-ROTATE

Syntax:

Arguments and Values:

Description:

Function POINT-ANGLE

Syntax:

Arguments and Values:

Description:

Notes:

Function POINT-NORM

Syntax:

Arguments and Values:

Description:

Function POINT-DISTANCE

Syntax:

Arguments and Values:

Description:

Notes:

5.2.2 Paths

A path is made of knots and interpolations. All the points used to represent knots are immutable, they are never updated in place. (They're never destructively modified.)

Function CREATE-PATH

Syntax

Arguments and Values:

Description:

Function PATH-CLEAR

Syntax:

Arguments and Values:

Description:

Function PATH-RESET

Syntax:

Arguments and Values:

Description:

Function PATH-EXTEND

Syntax:

Arguments and Values:

Description:

Examples:

(let ((path (create-path :polygon)))
  (path-extend path (make-straight-line)
                    (make-point 10.0 10.0))
  (path-extend path (make-straight-line)
                    (make-point 50.0 20.0))
  (path-extend path (make-bezier-curve (list (make-point 80.0 30.0)))
                    (make-point 40.0 90.0))
  (path-extend path (make-arc 90.0 90.0 :sweep-flag t)
                    (make-point 20.0 30.0))
  (do-something path))

Function PATH-CONCATENATE

Syntax:

Arguments and Values:

Description:

Function PATH-REPLACE

Syntax:

Arguments and Values:

Description:

Function PATH-TYPE

Syntax:

Arguments and Values:

Description:

Function PATH-SIZE

Syntax:

Arguments and Values:

Description:

Function PATH-LAST-KNOT

Syntax:

Arguments and Values:

Description:

Function PATH-CLONE

Syntax:

Arguments and Values:

Description:

Function PATH-REVERSE

Syntax:

Arguments and Values:

Description:

Function PATH-TRANSLATE

Syntax:

Arguments and Values:

Description:

Function PATH-ROTATE

Syntax:

Arguments and Values:

Description:

Examples:

Function PATH-SCALE

Syntax:

Arguments and Values:

Description:

5.2.3 Interpolations

Interpolations describe how knots are connected along a path.

An interpolation only specify the information needed in addition to the knots already on the path. For example, for a bezier curve of degree 2, only a single control point is necessary since the library will use the two knots around the interpolation to render it.

The 4 types of interpolations currently supported are represented in the picture below. The picture show a surface (in light cyan) described by 5 knots (blue circles.) In clockwise order, starting from the upper left knot (with double circles, which represent the first knot of a path, while the filled circle represent the second knot), we have the following interpolations:

The path is closed with an implicit straight line (dashed blue line.)

[image]

The path was constructed with the following code:

(let ((path (create-path :polygon)))
  (path-reset path (make-point 25 15))
  (path-extend path (make-straight-line) (make-point 250 25))
  (path-extend path (make-bezier-curve (list (make-point 300 40)
                                             (make-point 400 150)
                                             (make-point 200 100)))
                    (make-point 250 250))
  (path-extend path (make-arc 100 200 :x-axis-rotation -0.8)
                    (make-point 25 250))
  (path-extend path (make-catmull-rom (make-point 10 270)
                                      (list (make-point 10 200)
                                            (make-point 40 160)
                                            (make-point 25 120)
                                            (make-point 60 90))
                                      (make-point 70 40))
                    (make-point 55 55))
  (show-annotated-path path))

Note: The show-annotated-path function is included in the library, but rely on an external program (image viewer.)

Function MAKE-STRAIGHT-LINE

Syntax

Arguments and Values:

Description:

Function MAKE-ARC

Syntax:

Description:

Examples:

Function MAKE-CATMULL-ROM

Syntax:

Description:

Examples:

Function MAKE-BEZIER-CURVE

Syntax:

Arguments and Values:

Description:

Examples:

Method INTERPOLATION-SEGMENT

Syntax:

Arguments and Values:

Description:

Limitations:

Method INTERPOLATION-CLONE

Syntax:

Arguments and Values:

Description:

Method INTERPOLATION-REVERSE

Syntax:

Arguments and Values:

Description:

5.2.4 Iterators

A path iterator basically provide a way to iterate over all the knots and interpolations of a path. But this is also used to iterate over a "virtual" path (a path constructed as needed at each iteration.)

When the end of the path is reached, the iterator loop at the beginning. A marker is available to detect end of path.

When an iterator takes another iterator (instead of a path), it will be called a filter in this documentation.

Two functions are part of the iterator protocol:

Method PATH-ITERATOR-RESET

Syntax:

Arguments and Values:

Description:

Method PATH-ITERATOR-NEXT

Syntax:

Arguments and Values:

Description:

There is three iterators defined in the library:

Function PATH-ITERATOR

Syntax:

Arguments and Values:

Description:

Function PATH-ITERATOR-SEGMENTED

Syntax:

Arguments and Values:

Description:

Function FILTER-DISTINCT

Syntax:

Arguments and Values:

Description:

5.2.5 Basic shape

Function to generate basic path shape are provided.

Function MAKE-CIRCLE-PATH

Syntax:

Arguments and Values:

Description:

Examples:

Function MAKE-RECTANGLE-PATH

Syntax:

Arguments and Values:

Description:

Examples:

5.2.6 Transformations

Some transformations can produce more than one path. So, it was decided that by default most transformation return a list of path (possibly none, or usually only one.) And they can take either a single path or a list of path as parameter.

Function MAKE-DISCRETE-PATH

Syntax:

Arguments and Values:

Description:

Limitations:

Examples:

Function STROKE-PATH

Syntax:

Arguments and Values:

Description:

Examples:

Function DASH-PATH

Syntax:

Arguments and Values:

Description:

Examples:

Function ROUND-PATH

Syntax:

Arguments and Values:

Description:

Examples:

Function CLIP-PATH

Syntax:

Arguments and Values:

Description:

Function CLIP-PATH/PATH

Syntax:

Arguments and Values:

Description:

Examples:

Generated by CL-Crock on 2010-09-25T15:20:58Z