Action:
|
Gets the normal projection of a position onto an edge or curve.
|
|
Filename:
|
kern/kern_scm/crv_scm.cxx
|
|
Syntax:
|
(curve:project-pos edge-or-curve in-pos [parameter=0])
|
|
Arg Types:
|
edge-or-curve
|
curve | edge
|
|
in-pos
|
position
|
|
parameter
|
real
|
|
Returns:
|
pair (position . real)
|
|
Errors:
|
EDGE with no
CURVE
|
|
Description:
|
This extension returns a pair (position .
real). The first term
position is the orthogonal projection of the input
test-position onto the input
curve curve. The second term
real is the corresponding parameter value in the range 0 to 1.
|
|
|
edge-or-curve specifies an edge or a curve.
|
|
|
in-pos specifies the location to compute the parameter on the curve.
|
|
|
parameter is an optional argument specifying the location on the curve to compute from the
in-pos. If
parameter is not specified, the closest parameter is computed from the start of the curve. If
parameter is specified, the parameter is computed from the input
in-pos value and is always applied in the positive parameter direction.
|
|
Example:
|
; curve:project-pos
|
|
; Create a circular edge.
|
|
(define edge1
|
|
|
(edge:circular
|
|
|
(position 0 0 0) 25 0 185))
|
|
;; edge1
|
|
; Compute the normal projection of two positions
|
|
; onto the edge.
|
|
(curve:project-pos edge1 (position 0 0 0) 0.63)
|
|
;; (#[position -11.174465516778 22.3636159959506 0]
|
|
;; . 0.63)
|
|
(curve:project-pos edge1 (position 25 25 25))
|
|
;; (#[position 17.6776695296637 17.6776695296637 0]
|
|
;; . 0.243243243243243)
|