entity:reflect
List of: Scheme Extensions
Subjects: Entity
Contents: Kernel

Action: Reflects an entity or list of entities.

Filename: kern/kern_scm/transform_scm.cxx

APIs: api_transform_entity

Syntax: (entity:reflect body-list [xorigin=0 yorigin=0 zorigin=0]


xnormal ynormal znormal [fix-transform])

Arg Types: body-list entity | entity ...

xorigin real

yorigin real

zorigin real

xnormal real

ynormal real

znormal real

fix-transform boolean

Returns: (entity | entity ...)

Errors: Given entity or entities must be a body.

Description: This is a faster way to reflect entities in Scheme. Before (entity:reflect), one had to type:


(entity:transform ent


(transform:reflection


(position x y z) (gvector x y z)))


This shorthand version lets you do the same operation with:


(entity:reflect ent x y z x y z)


body-list specifies an entity or a list of entities that has to be reflected.


xorigin, yorigin, and zorigin specifies the origin point for reflection. If the origin values are not specified, then (0,0,0) is taken as the default origin.


xnormal, ynormal, and znormal specifies the axis for reflection.


fix-transform is an optional argument that allows the transforms to be fixed to the bodies (#t).

Example: ; entity:reflect

; Create a cylinder

(define c (solid:cylinder


(position 0 0 0) (position 10 10 10) 5))

;; c

; Move the cylinder.

(define move (entity:move c 10 0 0))

;; move

; Scale the cylinder.

(define scale1 (entity:scale c 3 1 1))

;; scale1

; Apply uniform scale.

(define scale2 (entity:scale c 2))

;; scale2

; Rotate about (position 20 0 0) (vector 0 0 1)

; by 90 degrees.

(define rotate1 (entity:rotate c 20 0 0 0 0 1 90))

;; rotate1

; Rotate about (position 0 0 0) (vector 0 0 1)

; by 90 degrees.

(define rotate2 (entity:rotate c 0 0 1 90))

;; rotate2

; Reflect across (position 40 0 0) (vector 1 0 0).

(define reflect1 (entity:reflect c 40 0 0 1 0 0))

;; reflect1

; Reflect across (position 0 0 0) (vector 1 0 0).

(define reflect2 (entity:reflect c 1 0 0))

;; reflect2
PDF/KERN/12SCA.PDF
HTM/DATA/KERN/KERN/12SCA/0097.HTM