This is the cl-catmull-rom-spline Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:43:38 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-catmull-rom-spline
Catmull-Rom Spline
Kevin Secretan <github@thejach.com>
Public Domain
0.1.0
spline.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-catmull-rom-spline/cl-catmull-rom-spline.asd
cl-catmull-rom-spline
(system).
cl-catmull-rom-spline/spline.lisp
cl-catmull-rom-spline
(system).
add-knot
(generic function).
next-point
(generic function).
reset
(generic function).
scale
(generic function).
spline
(class).
coeff->idx
(function).
coeff-x
(function).
coeff-y
(function).
coeffs
(reader method).
(setf coeffs)
(writer method).
coeffs-computed?
(reader method).
(setf coeffs-computed?)
(writer method).
compute-coefficients
(function).
compute-endpoints
(method).
cur-knot
(reader method).
(setf cur-knot)
(writer method).
cur-t
(reader method).
(setf cur-t)
(writer method).
dot-product
(function).
dt
(reader method).
(setf dt)
(writer method).
endpoints-computed?
(reader method).
(setf endpoints-computed?)
(writer method).
knot-i-x
(macro).
knot-i-y
(macro).
knots
(reader method).
(setf knots)
(writer method).
knots-count
(reader method).
(setf knots-count)
(writer method).
set-coeffs
(function).
Packages are listed by definition order.
cl-catmull-rom-spline
cr-spline
com.thejach.cl-catmull-rom-spline
common-lisp
.
add-knot
(generic function).
next-point
(generic function).
reset
(generic function).
scale
(generic function).
spline
(class).
coeff->idx
(function).
coeff-x
(function).
coeff-y
(function).
coeffs
(generic reader).
(setf coeffs)
(generic writer).
coeffs-computed?
(generic reader).
(setf coeffs-computed?)
(generic writer).
compute-coefficients
(function).
compute-endpoints
(generic function).
cur-knot
(generic reader).
(setf cur-knot)
(generic writer).
cur-t
(generic reader).
(setf cur-t)
(generic writer).
dot-product
(function).
dt
(generic reader).
(setf dt)
(generic writer).
endpoints-computed?
(generic reader).
(setf endpoints-computed?)
(generic writer).
knot-i-x
(macro).
knot-i-y
(macro).
knots
(generic reader).
(setf knots)
(generic writer).
knots-count
(generic reader).
(setf knots-count)
(generic writer).
set-coeffs
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Given a knot as a sequence pair representing an x,y point, add it to this spline’s control knots.
For the current segment between knots, calculates the next point and
returns it as a two element vector.
If the spline contains fewer than 3 knots, an error signal is raised.
This method returns two extra multiple values for special conditions:
* When the next point has reached or would reach beyond the final knot,
#(0.0 0.0) is returned along with a second value set to T.
Otherwise this second value is nil.
* When the returned point is the final point of a segment, a third value will be T.
Reinitializes the spline state so the next call to next-poin will return the beginning point of the spline.
Multiplies each knot’s x and y values by the scale factor.
Catmull-Rom splines are composed of a number of knots
(at least 3) with a piecewise path computed between
each knot, with the overall path from the first to
last knot appearing smooth. Each knot will be crossed
along the path.
Point: two-element vector representing an (x, y) coordiante.
Knots: control points determining the shape of the complete spline path.
Spline segments: the path between knots. Can be thought of as functions of time
path(t) : R -> point, from t=0 to t=1.
path(0) is the first knot in the segment, path(1) is the last knot.
(make-array 1 :fill-pointer 0 :adjustable t)
(make-array 1 :fill-pointer 0 :adjustable t)
0
1
0.0
By default this 0.1 dt means that for the first
segment, it will take 11 calls (t goes from =0 to =1)
to complete, but every other segment will start at t=0.1
to avoid repeating the knot value at t=0 and thus take
10 calls to go through. Use either shorter point distances,
or a lower dt to have smoother interpolation.
A point on a segment can be found by applying the equation
p(t) = at^3 + bt^2 + ct + d
with coeffs a, b, c, d. The coeffs are computed below,
with e.g. a_x = 1/2(-x_{i-1} + 3x_i - 3_x{i+1} + x_{i+2})
Note the basis matrix for cardinal spline coeffs is:
[[-a 2-a a-2 a]
[2a a-3 3-2a -a]
[-a 0 a 0]
[0 1 0 0]]
where a is the spline ’tension’. As a approaches 1, the bend at each knot is less.
Catmull-Rom splines typically use the value of 0.5, we use the same.
spline
)) ¶Should be called after all knots have been added. Called automatically by next-point if user forgot.
Once the user-facing knots are added, we need to compute two ’true’ auxilliary endpoints for the whole path.
Currently this is done by duplicating the the first and last knots, though this can cause kinking.
A future approach is to use reflection, which can still cause pinching but may be better.
Of course, they can be set manually if needed. (Consider subclassing rather than direct knot access.)
spline
)) ¶spline
)) ¶By default this 0.1 dt means that for the first
segment, it will take 11 calls (t goes from =0 to =1)
to complete, but every other segment will start at t=0.1
to avoid repeating the knot value at t=0 and thus take
10 calls to go through. Use either shorter point distances,
or a lower dt to have smoother interpolation.
Jump to: | (
A C D E F G K M N R S |
---|
Jump to: | (
A C D E F G K M N R S |
---|
Jump to: | C D E K S |
---|
Jump to: | C D E K S |
---|
Jump to: | C F P S |
---|
Jump to: | C F P S |
---|