Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
sin wave surface in 3D
Author Message
zylum

Posted: Sat Apr 03, 2004 5:18 pm   Post subject: sin wave surface in 3D

well, i was looking through the best of turing submissions thread and saw a few particle systems and thought i'd mak one in 3d... anyways, one thing lead to another and i came up with this.... sorry it's a bit slow but it has a lot of points to calculate.

 code: setscreen ("offscreenonly,graphics:1000;700,nobuttonbar,position:middle;middle") type _3D :     record         x : real         y : real         z : real     end record const xs := 30 const zs := 30 const perspective := 400 const spread := 10 const amplitude := 12 const wavelength := 2 var coords : array 1 .. xs * zs of _3D var depth : int var n : int := 0 var x, y, oldx, oldy : int var angX, angY : real := 45 var a : real := 0 const colors := 220 var clr : array - colors div 2 .. colors div 2 of int for i : 1 .. colors     clr (i - colors div 2) := RGB.AddColor (i / colors, i / colors, i / colors) end for var COS, SIN : array 0 .. 360 of real for i : 0 .. 360     COS (i) := cos (i * (Math.PI / 180))     SIN (i) := sin (i * (Math.PI / 180)) end for procedure rotate (xpp, ypp, zpp, ax, ay, az : real)     var temp : real     var xp, yp, zp : real     yp := ypp * COS (round (ax)) - zpp * SIN (round (ax))     zp := zpp * COS (round (ax)) + ypp * SIN (round (ax))     temp := zp     zp := zp * COS (round (ay)) - xpp * SIN (round (ay))     xp := xpp * COS (round (ay)) + temp * SIN (round (ay))     temp := xp     xp := xp * COS (round (az)) - yp * SIN (round (az))     yp := yp * COS (round (az)) + temp * SIN (round (az))     depth := round (zp)     x := round (xp / (1 - zp / perspective)) + maxx div 2     y := round (yp / (1 - zp / perspective)) + maxy div 2 end rotate for _x : 1 .. xs     for _z : 1 .. zs         n += 1         coords (n).x := _x * spread - (xs / 2) * spread         coords (n).z := _z * spread - (zs / 2) * spread         coords (n).y := (cos (_x / wavelength) * amplitude) + (sin (_z / wavelength) * amplitude)     end for end for loop     n := 0     a += 0.05     angX := sin (a) * 35 + 90     angY += 2     for _x : 1 .. xs         for _z : 1 .. zs             n += 1             rotate (coords (n).x, coords (n).y, coords (n).z, angX mod 360, 1, angY mod 360)             if _z > 1 then                 Draw.ThickLine (oldx, oldy, x, y, (depth + 250) div 15, clr (depth * -1))             end if             oldx := x             oldy := y         end for     end for     View.Update     cls end loop

-zylum

Tony

Posted: Sat Apr 03, 2004 5:23 pm   Post subject: (No subject)

nice looks good, too bad it runs slow +20Bits
Tony's programming blog. DWITE - a programming contest.
Paul

Posted: Sat Apr 03, 2004 5:24 pm   Post subject: (No subject)

omg thats crazy, its like when I first saw runescape, and thought it was crazy being done with java applet lol
recneps

Posted: Sat Apr 03, 2004 8:03 pm   Post subject: (No subject)

OMG that amazing. Teach us! lol +bits
zylum

Posted: Sun Apr 04, 2004 4:18 pm   Post subject: (No subject)

i'm glad you guys like it!

here's another similar effect... make sure you dont draw for too long cuz it will get lagy.

-zylum

3d_001.t
Description:
Filename:  3d_001.t
Filesize:  2.28 KB

Catalyst

Posted: Sun Apr 04, 2004 5:19 pm   Post subject: (No subject)

i like both of them
very creative

have ... 83 bits
Paul

Posted: Sun Apr 04, 2004 6:35 pm   Post subject: (No subject)

holy!!! that is just amazing? that second one, were you trying to achieve a 3D effect? cause thats what I see...
zylum

Posted: Sun Apr 04, 2004 6:39 pm   Post subject: (No subject)

wow thanks, nuf bits there catalyst

and yeah, i was trying to make it 3D

 well it is 3D[/edit]

-zylum

valor

Posted: Wed Apr 07, 2004 2:33 pm   Post subject: (No subject)

wow the day i learn how to do that is when Micheal Jackson isnt a Child Malester
i dont have much but here +10 bits
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 9 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: