pathRandom derived from ygTransform Example Source Header

Description: a transform that will move an object throught a random path inside a volume

notes:
Category: Transformation
Author: Javier I. Girado, Brenda Lopez
Revision: 11/10/01

#define DEBUG

Static functions


standard Yg template functions

    Messages
start begin random movement
stop stop random movement
speed float set the speed of the random movement between 0 and 1
box three floats, three floats set absolute box coordinates
allrot three floats, three floats, three floats set roll, pitch, and heading minimum, maximum, and speed
    Events
pathRandomPos str
    Comments

constructor pathRandom

destructor ~pathRandom

method reset

1 Define box as (-5,2.5,5) and (5,5,10)
2 Degine points in the random path as 100
3
4 Set speed to 0.001
5
6 First, determine initial position based on box dimensions
7 Add to that initial position a series of
8 Defualt random rotation
9
10 Define rotation angle range
11
12 set roll_min to -180, pitch_min to -180, head_min to -180
13 set roll_max to 180, pitch_max to 180, head_max to 180
14 set roll_speed, pitch_speed, head_speed to 0.1

method message

1 begin random movement
2 stop random movement
3 set the speed of the random movement between 0 and 1
4 set absolute box coordinates
5 set roll, pitch, and heading minimum, maximum, and speed
5.1 get minimun
5.2 get maximun
5.3 get rot speed

method app

0.0.1 invert increment
0.0.2 return inside limits
0.1 Now the random rotation stuff
0.2
0.2.0.1 invert increment
0.2.0.2 return inside limits
0.2.0.1 invert increment
0.2.0.2 return inside limits
0.2.0.1 invert increment
0.2.0.2 return inside limits
0.3 Calculate new position and orientation
0.4 send an event with this new
0.5 position information

method setInitPos

method loadPath

1 First point is the initial position
2 Then, generate random points and add them
2.1 get a random number between minX and maxX

method interpolate

constructor pathRandomCatmullRomCurve

method setControlPoints

method value

method tangent

method computeCoefficients