curve:ray-pos
List of: Scheme Extensions
Subjects: Construction Geometry, Picking
Contents: Kernel

Action: Gets the position on a curve closest to the pick-ray.

Filename: kern/kern_scm/crv_scm.cxx

Syntax: (curve:ray-pos [curve pick-ray] | [entray])

Arg Types: curve curve

pick-ray ray

entray entray

Returns: pair

Errors: EDGE with no CURVE

Description: The gvector on the curve can determine which end of a curve has been picked. If (< 0.5 (cdr (curve:ray-pos pick))), the curve is picked near the start position; otherwise, it is picked near the end position. This extension returns a pair-pair, where the first element is the position on the curve closest to the input ray. The second element is the corresponding parameter of the position in the range 0 to 1.


curve specifies the curve.


pick-ray specifies the ray. The ray is a position on the curve and a gvector closest to the pick.


entray specifies the curve and the ray. entray could be used in place of curve and pick-ray.

Example: ; curve:ray-pos

; Create a spline edge.

(define edge1


(edge:spline (list (position 0 0 0)


(position 0 -30 0) (position -30 18 0)) 0 45))

;; edge1

; Determine the position on the edge that

; is closest to the specified position.

(curve:ray-pos (entray edge1


(ray (position 0 -30 0) (gvector 0 0 1))))

;; (#[position 8.88178419700125e-16 -30 0] .

;; 0.346404775941922)
PDF/KERN/12SCA.PDF
HTM/DATA/KERN/KERN/12SCA/0044.HTM