SchemeExt:Entity:reflect

From DocR23

Jump to: navigation, search
Showdoc.png



Contents

Action

Reflects an entity or list of entities.

Filename

scm/scmext/kern/transform_scm.cpp

APIs

api_transform_entity, api_change_body_trans

Syntax

(entity:reflect body-list [xorigin=0 yorigin=0 zorigin=0] xnormal ynormal znormal [fix-transform])

Argument Types

Argument Scheme Data Type
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. Earlier, you had to type:

(entity:transform ent (transform:reflection (position a b c) (gvector x y z)))

This shorthand version lets you do the same operation with:

(entity:reflect ent a b c x y z)

Arguments

  • 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. The default is #f (FALSE).

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

See Also

Personal tools