Action:
|
Creates a continuous spline edge from a list of positions.
|
|
Filename:
|
cstr/cstr_scm/edge_scm.cxx
|
|
APIs:
|
api_curve_spline
|
|
Syntax:
|
(edge:spline position-list
|
|
|
[[start-angle | start-direction | spline-condition]
|
|
|
[end-angle | end-direction]] ["periodic"]
|
|
|
["exact"])
|
|
Arg Types:
|
position-list
|
position | (position ... )
|
|
start-angle
|
real
|
|
start-direction
|
gvector
|
|
spline-condition
|
boolean
|
|
end-angle
|
real
|
|
end-direction
|
gvector
|
|
"periodic"
|
string
|
|
"exact"
|
string
|
|
Returns:
|
spline-edge
|
|
Description:
|
The argument
position-list is a list of locations through which the spline should pass. The number of positions in the
position-list
must be at least two. The optional argument
start-direction is the gvector of the tangent to the spline at the start position. The optional argument
end-direction is the gvector of the tangent to the spline at the end position. If either
start-direction or
end-direction is not specified, a free end condition is used at that end. A "free" or "natural" spline condition means that the second derivative at that end is 0.
|
|
|
To force a "free" end condition, either assign
#f to the argument
spline-condition, or do not specify an argument for the end condition. Specifying
#f results in a "free" end condition at the start, so the tangent direction needs to be specified at the end.
|
|
|
Specifying an
end-direction vector indicates the end direction of the curve tangent at the end.
|
|
|
Specify the
start-angle and
end-angle in degrees. If an angle is specified, the curve is tangent to a vector in the
xy plane of the active WCS. The angle specifies the angle between the tangent vector and the
x-axis of the active WCS measured counterclockwise.
|
|
|
When
"periodic" is included, the interpolation produces a periodic spline, as long as the first and last position in the list are within resabs, and no end conditions are specified. This check is performed lower down the stack.
|
|
|
If the string
"exact" is included, the interpolation is as accurate as possible. Otherwise, it will be within resfit of the points being interpolated.
|
|
|
position-list is a list of locations through which the spline should pass.
|
|
|
start-direction is the gvector of the tangent to the spline at the start position.
|
|
|
start-angle and
end-angle in degrees specifies the angle between the tangent vector and the
x-axis of the active WCS measured counterclockwise.
|
|
|
spline-condition forces a "free" end condition by assigning
#f to the argument
spline-condition.
|
|
|
end-direction vector indicates the end direction of the curve tangent at the end.
|
|
|
"periodic" is included, the interpolation produces a periodic spline, as long as the first and last position in the list are within resabs, and no end conditions are specified. This check is performed lower down the stack.
|
|
|
"exact" is included, the interpolation is as accurate as possible. Otherwise, it will be within resfit of the points being interpolated.
|
|
Example:
|
; edge:spline
|
|
; Set the view's eye position, target position,
|
|
; and up vector.
|
|
(define viewset (view:set (position 0 0 100)
|
|
|
(position 0 0 0)
|
|
|
(gvector 0 1 0)))
|
|
;; viewset
|
|
; Define a new WCS.
|
|
(define wcs (wcs (position 0 0 0) (position 5 0 0)
|
|
|
(position 0 5 0)))
|
|
;; wcs
|
|
; Create 3 spline edges.
|
|
(define spline1 (edge:spline (list (position 0 0 0)
|
|
|
(position 5 5 0) (position 10 15 0)
|
|
|
(position 15 20 0) (position 20 15 0)
|
|
|
(position 25 5 0) (position 30 0 0))))
|
|
;; spline1
|
|
; spline 1 is shown in green.
|
|
|
(define spline2 (edge:spline (list (position 0 0 0)
|
|
|
(position 5 5 0) (position 10 15 0)
|
|
|
(position 15 20 0) (position 20 15 0)
|
|
|
(position 25 5 0) (position 30 0 0)) 0 45))
|
|
;; spline2
|
|
; spline 2 is shown in blue.
|
|
(define spline3 (edge:spline (list (position 0 0 0)
|
|
|
(position 5 5 0) (position 10 15 0)
|
|
|
(position 15 20 0) (position 20 15 0)
|
|
|
(position 25 5 0) (position 30 0 0))
|
|
|
(gvector 0 1 0) (gvector 0 1 0)))
|
|
;; spline3
|
|
; spline 3 is shown in magenta.
|
|
; OUTPUT Example
|
|
|
|
|
Figure 2-19. edge:spline
|