Common Lisp Package: NET.TUXEE.PATHS

README:

FUNCTION

Public

CREATE-PATH (TYPE)

Create a new path of the given type. The type must be one of the following keyword: :open-polyline -- An open polyline path, :closed-polyline -- A closed polyline path, :polygon -- Like :closed-polyline, but implicitly filled.

MAKE-CIRCLE-PATH (CX CY RADIUS &OPTIONAL (RADIUS-Y RADIUS) (X-AXIS-ROTATION 0.0))

Construct a path to represent a circle centered at CX,CY of the specified RADIUS.

MAKE-DISCRETE-PATH (PATH)

Construct a path with only straight lines.

MAKE-SIMPLE-PATH (POINTS &OPTIONAL (TYPE OPEN-POLYLINE))

Create a path with only straight line, by specifying only knots.

PATH-ANNOTATED (PATHS &KEY (INCLUDE-TANGENTS NIL) (DECIMATE-KNOTS T) (ASSUME-TYPE NIL))

Annotate the path with visual effect (like color for each type of interpolation, circle to represent knots,..) path -- a path or a list of path Return a list of (color . paths).

PATH-CLEAR (PATH)

Clear the path such that it is empty.

PATH-CONCATENATE (PATH INTERPOLATION OTHER-PATH)

Append OTHER-PATH to PATH, joined by INTERPOLATION.

PATH-EXTEND (PATH INTERPOLATION KNOT)

Extend the path to KNOT, with INTERPOLATION.

PATH-LAST-KNOT (PATH)

Return the last knot of the path. Return NIL if the path is empty.

PATH-ORIENT (PATH ORIENTATION &OPTIONAL OTHER-PATHS)

Orient the path in the given orientation. If OTHER-PATHS is specified, then the paths are reversed inconditionnaly if PATH is also reversed.

PATH-REPLACE (PATH OTHER-PATH)

Replace PATH with contents of OTHER-PATH.

PATH-RESET (PATH KNOT)

Reset the path such that it is a single knot.

PATH-ROTATE (PATH ANGLE &OPTIONAL CENTER)

Rotate the whole path by ANGLE radian around CENTER (which is the origin if unspecified.)

PATH-SCALE (PATH SCALE-X SCALE-Y &OPTIONAL CENTER)

Scale the whole path by (SCALE-X,SCALE-Y) from CENTER (which is the origin if unspecified.) Warning: not all interpolations support non uniform scaling (when scale-x /= scale-y).

PATH-SIZE (PATH)

Return the number of knots on the path.

PATH-TRANSFORM-AS-MARKER (PATH PATH-REFERENCE SIDE &KEY (OFFSET 0.0) (SCALE 1.0) (ANGLE 0.0))

Translate, rotate and scale PATH representing a marker such that it is adapted to the PATH-REFERENCE. If SIDE is false, it is placed at the start of the path, otherwise it is placed at the end of the path.

PATH-TRANSLATE (PATH VECTOR)

Translate the whole path accordingly to VECTOR.

POINT-ANGLE (POINT)

Compute the angle of POINT relatively to the X axis.

POINT-DISTANCE (P1 P2)

Compute the distance between P1 and P2.

POINT-NORM (POINT)

Compute the distance of POINT from origin.

POINT-ROTATE (POINT ANGLE)

Rotate POINT by ANGLE radian around the origin.

Undocumented

CLIP-PATH (PATHS &REST ARGS)

CLIP-PATH/PATH (PATHS &REST ARGS)

DASH-PATH (PATHS &REST ARGS)

FILTER-DISTINCT (ITERATOR &OPTIONAL (PRESERVE-CYCLIC-END-P NIL))

MAKE-ARC (RX RY &KEY (X-AXIS-ROTATION 0.0) (LARGE-ARC-FLAG NIL) (SWEEP-FLAG NIL))

MAKE-BEZIER-CURVE (CONTROL-POINTS)

MAKE-CATMULL-ROM (HEAD CONTROL-POINTS QUEUE)

MAKE-POINT (X Y)

MAKE-RECTANGLE-PATH (X1 Y1 X2 Y2 &KEY (ROUND NIL) (ROUND-X NIL) (ROUND-Y NIL))

MAKE-RECTANGLE-PATH/CENTER (X Y DX DY &REST ARGS)

MAKE-REGULAR-POLYGON-PATH (X Y RADIUS SIDES &OPTIONAL (START-ANGLE 0.0))

MAKE-STRAIGHT-LINE

P* (POINT SCALE &OPTIONAL (SCALE-Y SCALE))

P+ (P1 P2)

P- (P1 P2)

PATH-CLONE (PATH)

PATH-ITERATOR (PATH)

PATH-ITERATOR-SEGMENTED (PATH &OPTIONAL (PREDICATE (CONSTANTLY T)))

PATH-REVERSE (PATH)

PATH-REVERSED (PATH)

POINT-X (POINT)

POINT-Y (POINT)

STROKE-PATH (PATHS &REST ARGS)

Private

DASH-PATH/1 (PATH SIZES &KEY (TOGGLE-P NIL) (CYCLE-INDEX 0))

Dash path. If TOGGLE-P is true, segments of odd indices are kept, while if TOGGLE-P is false, segments of even indices are kept. CYCLE indicate where to cycle the SIZES once the end is reached.

DISCRETE-BEZIER-CURVE (POINTS FUNCTION &KEY (INCLUDE-ENDS T) (MIN-SUBDIVIDE NIL) (MAX-SUBDIVIDE 10) (DISTANCE-TOLERANCE *BEZIER-DISTANCE-TOLERANCE*) (ANGLE-TOLERANCE *BEZIER-ANGLE-TOLERANCE*))

Subdivize Bezier curve up to certain criterions.

EVALUATE-BEZIER (POINTS POSITION)

Evaluate the point at POSITION on the Bezier curve described by POINTS.

LINE-INTERSECTION (X1 Y1 X2 Y2 X3 Y3 X4 Y4)

Compute the intersection between 2 lines (x1,y1)-(x2,y2) and (x3,y3)-(x4,y4). Return the coordinates of the intersection points as 2 values. If the 2 lines are colinears, return NIL.

LINE-INTERSECTION/DELTA (X1 Y1 DX1 DY1 X2 Y2 DX2 DY2)

Compute the intersection between the line by (x1,y1) and direction (dx1,dy1) and the line by (x2,y2) and direction (dx2,dy2). Return the coordinates of the intersection points as 2 values. If the 2 lines are colinears, return NIL.

LINE-NORMAL (X1 Y1 X2 Y2)

Normalize the vector (X2-X1,Y2-Y1). See NORMALIZE.

NORMALIZE (X Y &OPTIONAL (LENGTH 1.0))

Normalize the vector (X,Y) such that its length is LENGTH (or 1.0 if unspecified.) Return the component of the resulting vector as 2 values. Return NIL if the input vector had a null length.

PATH-FROM-ITERATOR (ITERATOR TYPE)

Construct a new path from the given iterator.

PATH-GUESS-ORIENTATION (PATH)

Guess the orientation of the path. This is implemented loosely because we don't take care about interpolations. We only consider a polygon described by the knots. However, it should work.. Update path orientation flag, and returns either :CW or :CCW.

PATH-INTERPOLATIONS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PATH-ITERATOR-STATE-INDEX (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PATH-ITERATOR-STATE-PATH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PATH-KNOTS (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PATH-ORIENTATION (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PATH-TYPE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PI-SEGMENTED-STATE-END-P (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PI-SEGMENTED-STATE-INDEX (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PI-SEGMENTED-STATE-PATH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PI-SEGMENTED-STATE-PREDICATE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

PI-SEGMENTED-STATE-QUEUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

POINT-MIDDLE (P1 P2)

Compute the point between P1 and P2.

SPLIT-BEZIER (POINTS &OPTIONAL (POSITION 0.5))

Split the Bezier curve described by POINTS at POSITION into two Bezier curves of the same degree. Returns the curves as 2 values.

STROKE-PATH/1 (PATH THICKNESS &KEY (CAPS BUTT) (JOINT NONE) (INNER-JOINT NONE) ASSUME-TYPE)

Stroke the path.

SVG-ARC-PARAMETERS (P1 P2 RX RY ROTATION LARGE-ARC-FLAG-P SWEEP-FLAG-P)

Conversion from endpoint to center parameterization of SVG arc. Returns values RC, RX, RY, START-ANGLE and DELTA-ANGLE, where RC is the center of the ellipse, RX and RY are the normalized radii (needed if scaling was necessary).

SVG-ARC-PARAMETERS/REVERSE (CENTER RX RY ROTATION START-ANGLE DELTA-ANGLE)

Conversion from center to endpoint parameterization of SVG arc. Returns values P1, P2, LARGE-ARC-FLAG-P, SWEEP-FLAG-P.

Undocumented

CLIP-PATH/1 (PATH X Y DX DY)

CLIP-PATH/PATH/1 (PATH LIMIT)

COPY-PATH (INSTANCE)

COPY-PATH-ITERATOR-STATE (INSTANCE)

COPY-PI-SEGMENTED-STATE (INSTANCE)

MAKE-PATH (&KEY ((TYPE DUM58) OPEN-POLYLINE) ((ORIENTATION DUM59) UNKNOWN) ((KNOTS DUM60) (MAKE-ARRAY 0 ADJUSTABLE T FILL-POINTER 0)) ((INTERPOLATIONS DUM61) (MAKE-ARRAY 0 ADJUSTABLE T FILL-POINTER 0)))

MAKE-PATH-ITERATOR-STATE (&KEY ((PATH DUM267) NIL) ((INDEX DUM268) NIL))

MAKE-PI-SEGMENTED-STATE (&KEY ((PATH DUM348) NIL) ((INDEX DUM349) NIL) ((PREDICATE DUM350) NIL) ((END-P DUM351) NIL) ((QUEUE DUM352) NIL))

PATH-END-INFO (PATH SIDE)

SETFPATH-INTERPOLATIONS (NEW-VALUE INSTANCE)

SETFPATH-ITERATOR-STATE-INDEX (NEW-VALUE INSTANCE)

PATH-ITERATOR-STATE-P (OBJECT)

SETFPATH-ITERATOR-STATE-PATH (NEW-VALUE INSTANCE)

SETFPATH-KNOTS (NEW-VALUE INSTANCE)

SETFPATH-ORIENTATION (NEW-VALUE INSTANCE)

PATH-P (OBJECT)

SETFPATH-TYPE (NEW-VALUE INSTANCE)

SETFPI-SEGMENTED-STATE-END-P (NEW-VALUE INSTANCE)

SETFPI-SEGMENTED-STATE-INDEX (NEW-VALUE INSTANCE)

PI-SEGMENTED-STATE-P (OBJECT)

SETFPI-SEGMENTED-STATE-PATH (NEW-VALUE INSTANCE)

SETFPI-SEGMENTED-STATE-PREDICATE (NEW-VALUE INSTANCE)

SETFPI-SEGMENTED-STATE-QUEUE (NEW-VALUE INSTANCE)

STRAIGHT-LINE-P (VALUE)

MACRO

Private

DEFINE-FOR-MULTIPLE-PATHS (NAME-MULTIPLE NAME-SINGLE &OPTIONAL DOCUMENTATION)

Define a new function named by NAME-MULTIPLE which accepts either a single path or a list of paths as input from a function named by NAME-SINGLE accepting only a single path and producing a list of paths.

Undocumented

DO-PATH ((PATH INTERPOLATION KNOT) &BODY BODY)

GENERIC-FUNCTION

Public

PATH-ITERATOR-NEXT (ITERATOR)

Move the iterator to the next knot, and return 3 values: INTERPOLATION, KNOT and END-P. INTERPOLATION is the interpolation between the previous knot and the current one. For the first iteration, INTERPOLATION is usually the implicit straight line between the last knot and the first knot. KNOT and INTERPOLATION are null if the path is empty. END-P is true if the knot is the last on the path or if the path is empty.

PATH-ITERATOR-RESET (ITERATOR)

Reset the iterator before the first knot.

Private

INTERPOLATION-CLONE (INTERPOLATION)

Duplicate INTERPOLATION.

INTERPOLATION-NORMAL (INTERPOLATION K1 K2 SIDE)

Compute the normal, going "outside" at either K1 (if SIDE is false) or K2 (if SIDE is true). Return NIL if the normal cannot be computed. Return a point otherwise.

INTERPOLATION-REVERSE (INTERPOLATION)

Reverse the path described by INTERPOLATION in-place.

INTERPOLATION-REVERSED (INTERPOLATION)

Duplicate and reverse the INTERPOLATION.

INTERPOLATION-SEGMENT (INTERPOLATION K1 K2 FUNCTION)

Segment the path between K1 and K2 described by the INTERPOLATION. Call FUNCTION for each generated point on the interpolation path.

Undocumented

INTERPOLATION-ROTATE (INTERPOLATION ANGLE)

INTERPOLATION-SCALE (INTERPOLATION SCALE-X SCALE-Y)

INTERPOLATION-TRANSLATE (INTERPOLATION VECTOR)

VARIABLE

Public

*ARC-LENGTH-TOLERANCE*

The maximum length of segment describing an arc.

*BEZIER-ANGLE-TOLERANCE*

The default angle tolerance (in radian) used when rendering Bezier curves

*BEZIER-DISTANCE-TOLERANCE*

The default distance tolerance used when rendering Bezier curves.

Private

*MITER-LIMIT*

Miter limit before reverting to bevel joint. Must be >=1.0.

CLASS

Private

Undocumented

ARC

BEZIER

CATMULL-ROM

FILTER-DISTINCT-STATE

PATH

PATH-ITERATOR-STATE

PI-SEGMENTED-STATE