pick:face
List of: Scheme Extensions
Subjects: Model Topology, Picking
Contents: Scheme Support

Action: Gets a face from a pick event.

Filename: scm/scmext/pick_scm.cxx

Syntax: (pick:face {event | pick-ray} [face-index] [filter])

Arg Types: event pick-event

pick-ray ray

face-index integer

filter entity-filter

Returns: face | (face ... ) | boolean

Description: event specifies the event used, typically, a mouse click.


pick-ray specifies the ray.The pick event's ray starts at the eye position in the viewing plane and goes through the pick event point. Therefore, faces closer to the eye position are listed first. The ray extends infinitely in the positive direction. Only faces that are in the forward direction from the ray are picked.


The optional filter specifies the entity to include with the pick event.


The optional face-index specifies the nth face that the ray pierces. If face-index is not specified, the extension returns a list of all faces in the order that the ray pierces them. If face-index is greater than the number of faces hit by the ray, the last face to be hit is returned.


This extension returns #f if no face was registered by the pick event.

Example: ; pick:face

; Extract a face from a pick-event.

; Create a solid block.

(define block1


(solid:block (position -10 -10 0)


(position 25 25 25)))

;; block1

; Get a list of the faces so we know what the

; entities could be

(define list (entity:faces block1))

;; list

; Extract planar-face 1 from a pick-event.

(define face1 (pick:face (read-event)))

; Using the mouse, select a face on the block.

;; face1

; Returns #f in nothing selection.

; Extract planar-face 2 from a pick-event using

; a face-index integer.

(define face2 (pick:face (read-event) 2))

; Using a mouse, select a face on the block.

;; face2

; Returns #f in nothing selection.
PDF/SCM/04SC.PDF
HTM/DATA/SCM/SCM/04SC/0096.HTM