I might release some documentation explaining all my algorithms. Don't know if anyone'd be interested though.
;Sphere
;Made by BlueThen on May 16, 2009
;To install, paste this script in your Remotes (Alt + R)
;Then type /sphere or right click the channel or status and click "Sphere".
menu channel,status {
Sphere: sphere
}
alias sphere {
window -paoCzdk0 +tnbL @Sphere -1 -1 400 400
set %sphere.a 0
set %sphere.a2 0
%sphere.t = 1
%sphere.x = 15
while (%sphere.x) {
%sphere.y = 15
while (%sphere.y) {
hadd -m X %sphere.t %sphere.x
hadd -m Y %sphere.t %sphere.y
inc %sphere.t
dec %sphere.y
}
dec %sphere.x
}
set %sphere.tok tokenize 32 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 $&
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 $&
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 $&
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 $&
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 $&
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 $&
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 $&
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
sphere.frame
}
alias -l sphere.frame {
if ($window(@sphere)) {
clear -n @sphere
drawfill -n @sphere 1 1 1 1
%sphere.tok
scon -r .!drawdot -nr @sphere $!rgb( $!calc( 143+( $* /2)), $!calc( 143+( $* /2)), $!calc(143+ ( $* /2))) 1 $!sphere.iso( $!calc( (7.5- $!hget(Y, $* ))*15* $!cos( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg), $!calc( 75* $!sin( $!calc( $!hget(Y, $* )*24)).deg), $!calc( (7.5- $!hget(Y, $* ))*15* $!sin( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg))
set %sphere.a $calc(100 * $sin(%sphere.a2).deg)
inc %sphere.a2 4
drawline @sphere
.timer 1 0 sphere.frame
}
else unset %sphere.*
}
alias -l sphere.iso return $calc(($1 - $3)*0.866+200) $calc(($1 + $3)*0.5- $2 +200)
@knoeki: i dont speak english verry well but look at my comments
if u want u can use one comand for not use 2 like "inc" "dec" u can use "var"
so i told "if u want" and i never tell people how to do but that can learn u more
i was like u and i learn where is the problem?
anyway i'll comment always your post and if u wanna do like FordLawnmower no problem but read it before cz that can learn u somme thing and that's not bad :)
[quote]WorldDMT should stop tooting his own useless horn and post a script
do u see any thing not good about my comments?[/quote]
yes. for example, constantly telling people how to do it differently. Seriously, even if you know it better, there's no need to keep telling people HOW to do it, you can also just give some tips or shut up, whatever suits you best.
Right now you just come across to me as a wiseass with an obession of proving his superiority.
@tv3636
inc %sphere.t
dec %sphere.y
can be one commande also like this
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
here we have one commande not 2 is a little faster wen i changed all that thing u can see the difference
the time of execution for his code is between 172 - 187 ticks or mine is 140 - 156
is faster :)
@FordLawnmower:
WorldDMT should stop tooting his own useless horn and post a script
do u see any thing not good about my comments?
inc %sphere.t
dec %sphere.y
can be one commande also like this
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
How is that better in any way? The computer is still performing the same processes, you're just saving a line. You could also just do inc %sphere.t | dec %sphere.y but it doesn't matter at all.
FordLawnmower: WorldDMT has posted a script. http://www.hawkee.com/snippet/6149/
hi
for %sphere.a, and %sphere.a2
no need to set it 0 the "inc", and "set" command into alias sphere.frame will set it, and wen u close the windows, that will unset so u can remove it
for %sphere.t,%sphere.x, and %sphere.y set it local
var %sphere.t 1,%sphere.x 15,%sphere.y 15
for %sphere.tok u can do this
set %sphere.tok tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))
and no need to set it, put it directly into the alias sphere.frame
if u want u can use one comand for not use 2 like "inc" "dec" u can use "var"
so
inc %sphere.t
dec %sphere.y
can be one commande also like this
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
and finaly dont forget to remove hash tables hfree x/y
so your code can be like this
menu channel,status {
Sphere:sphere
}
alias sphere {
window -paoCzdk0 +tnbL @Sphere -1 -1 400 400
var %sphere.t 1,%sphere.x 15,%sphere.y 15
while %sphere.x {
while %sphere.y {
hadd -m X %sphere.t %sphere.x
hadd -m Y %sphere.t %sphere.y
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
}
dec %sphere.x
}
sphere.frame
}
alias -l sphere.frame {
if ($window(@sphere)) {
clear -n @sphere
drawfill -n @sphere 1 1 1 1
tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))
scon -r .!drawdot -nr @sphere $!rgb( $!calc( 143+( $* /2)), $!calc( 143+( $* /2)), $!calc(143+ ( $* /2))) 1 $!sphere.iso( $!calc( (7.5- $!hget(Y, $* ))*15* $!cos( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg), $!calc( 75* $!sin( $!calc( $!hget(Y, $* )*24)).deg), $!calc( (7.5- $!hget(Y, $* ))*15* $!sin( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg))
set %sphere.a $calc(100 * $sin(%sphere.a2).deg)
inc %sphere.a2 4
drawline @sphere
.timer 1 0 sphere.frame
}
else {
unset %sphere.a*
hfree x
hfree y
}
}
alias -l sphere.iso return $calc(($1 - $3)*0.866+200) $calc(($1 + $3)*0.5- $2 +200)
Hey BlueThen. Another cool snippet.
I've recently taken a brief look at trigonometry and I've gotten down some of the basics (cosine, sine, tangent, and their opposites); and yeah, it's quite interesting.
However, I haven't actually started making picture window animations/games yet, but they seem to be a fine challenge. :d
And to answer your question, I think it'd be a good idea to release your documentation of algorithms.