SRL Archive - Other Scripts

Interesting script (trigonometry + for loops + hsl, and this is what you get)


Smartzkid

2008-04-02 23:00:24

Ask anything you like about it; first day of trig in school, so I felt like making a script to take advantage of my new knowledge. Mess around with the HSL settings (relating them to s can make some really neat effects!) if you want to see some interesting designs.

program CircleDraw;
var
i, s, img: integer;
begin
img := BitmapFromString(360, 360, '');
DisplayDebugImgWindow(360, 360);
for s := 179 downto 1 do
begin
for i := 0 to 360 do
FastSetPixel(img, round(abs(cos(i) * s + 180)), round(abs(sin(i) * s + 180 + ((180 - s) / 5))), HSLtoColor(i/(360/255), 179, 50));
SafeCopyCanvas(GetBitmapCanvas(img), GetDebugCanvas, 1, 1, 360, 360, 1, 1, 360, 360);
end;
FreeBitmap(img);
end.

HyperSecret

2008-04-03 02:42:04

lol you nub :P, trig was an awesome class for me in high school rarely did my homework, daily hw grade avg 58.%, but i understood it 100% and did really well on tests, test grade avg 96.3%. the teacher said i could have easily got an A and what not but i settled with a B :D it was a great class. He said he has never seen anyone be able to get that low of a hw grade and do such little homework and get such a good test grade.

homework i would do the easiest/first 2-3 problems and the hardest/last 2-3 problems of each type and move on, came out to about 15 problems for every assignment that was 30-50 problems long :D

palmpilot71

2008-04-03 13:42:11

That's really cool! Love it! I'm in Gr.7 so no Trig till mabey a bit in math club(9) and probably around gr.10 I'll start!

Smartzkid

2008-04-04 20:57:09

Some more I made, messing around with different stuff looking for patterns I find interesting :)

program CircleDraw2;
const
XMOD = 2;
YMOD = 2;
//{$define DirectionIN} //Comment out this line for outwards direction
var
i, s, img: integer;
begin
img := BitmapFromString(360, 360, '');
DisplayDebugImgWindow(360, 360);
{$ifdef DirectionIN}
for s := 1 to 179 do
{$else}
for s := 179 downto 1 do
{$endif}
begin
for i := 0 to 720 do
FastSetPixel(img, round(abs(cos(i/XMOD) * s + 180)), round(abs(sin(i/YMOD) * s + 180 + ((180 - s) / 5))), HSLtoColor(i/(360/255), 179, 50));
SafeCopyCanvas(GetBitmapCanvas(img), GetDebugCanvas, 1, 1, 360, 360, 1, 1, 360, 360);
end;
FreeBitmap(img);
end.

program CircleDraw3;
const
XMOD = 1;
YMOD = 1;
SPEED= 1; //1 - 360, lower is faster.
var
i, s, img, spd: integer;
begin
img := BitmapFromString(360, 360, '');
DisplayDebugImgWindow(360, 360);
spd := speed;
if(spd > 360) then spd := 360;
if(spd < 1) then spd := 1;
for s := 1 to 179 do
begin
for i := 0 to 360 do
begin
FastSetPixel(img, round(abs(cos(i/XMOD) * s + 180)), round(abs(sin(i/YMOD) * s + 180 + ((180 - s) / 5))), HSLtoColor(i/(360/255), 179, 50));
if i mod (361 - spd) = 0 then
SafeCopyCanvas(GetBitmapCanvas(img), GetDebugCanvas, 1, 1, 360, 360, 1, 1, 360, 360);
end;
end;
for s := 179 downto 1 do
begin
for i := 0 to 360 do
begin
FastSetPixel(img, round(abs(cos(i/XMOD) * s + 180)), round(abs(sin(i/YMOD) * s + 180 + ((180 - s) / 5))), HSLtoColor(i/(360/255), 125, 50));
if i mod (361 - spd) = 0 then
SafeCopyCanvas(GetBitmapCanvas(img), GetDebugCanvas, 1, 1, 360, 360, 1, 1, 360, 360);
end;
end;
FreeBitmap(img);
end.

Dan Cardin

2008-04-04 21:40:15

i like the 3rd one, cuz it goes back and redraws:).
too bad i have no clue what any of that means :p(well i do, but i wouldnt be able to control it to make something specific :(). taking trig next year so ;), definitely something ill be interested in.:)

Benson

2008-04-05 02:20:38

trigonometery…reminds me of the easy stuff, im jsut starting about half way into grade 11 math…so just starting quadratic formulas. easy stuff so far :D


PS:CANADA PWNS…i saw that grade 7 guy up there from western canada …me too :D