Rev | Line | |
---|
[3921] | 1 | !--------------- Copy this to the beginning of a lua script to use the functions ---------------! |
---|
| 2 | |
---|
[3927] | 3 | -- Initialises the random number generator |
---|
| 4 | randinit = false |
---|
[3921] | 5 | function randInit() |
---|
| 6 | |
---|
| 7 | if not randinit then |
---|
| 8 | math.randomseed(os.clock()) |
---|
| 9 | randinit = true |
---|
| 10 | end |
---|
| 11 | |
---|
| 12 | end |
---|
[3927] | 13 | |
---|
| 14 | |
---|
| 15 | -- Returns the distance between (x1,x2,x3) and (y1,y2,y3) |
---|
| 16 | function dist( x1,x2,x3, y1,y2,y3 ) |
---|
| 17 | |
---|
| 18 | return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) |
---|
| 19 | |
---|
| 20 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.