Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Attempt at 3D ...
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Andy




PostPosted: Mon Feb 02, 2004 7:19 pm   Post subject: (No subject)

no the shrinking of it makes it look like its rotating cuz the lines arent straight
Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Mon Feb 02, 2004 8:11 pm   Post subject: (No subject)

i think its being moved inward probably makes the rotational effect
Kuntzy




PostPosted: Mon Feb 02, 2004 9:24 pm   Post subject: (No subject)

yeah it's not rotating its just the persepective, the math for rotation is still a bit fussy to me, but anyway homer and catalyst are right. and also pic scale or pic rotate is slower for turing to run, simple lines and math and a much faster approach for your game.
TheXploder




PostPosted: Mon Feb 02, 2004 11:03 pm   Post subject: (No subject)

but what if you draw polygons instead of simple lines, that could work...
Catalyst




PostPosted: Mon Feb 02, 2004 11:04 pm   Post subject: (No subject)

this should help

code:

    proc Rotate (X,Y,Z, XA, YA, ZA : real)

            relZ := (((Z - z) * cosd (XA)) + ((Y - y) * sind (XA)))
            relY := (((Y - y) * cosd (XA)) - ((Z - z) * sind (XA)))
            y := Y - relY
            z := Z - relZ

            relZ := (((Z - z) * cosd (YA)) + ((X - x) * sind (YA)))
            relX := (((X - x) * cosd (YA)) - ((Z - z) * sind (YA)))
            x := X - relX
            z := Z - relZ

            relX := (((X - x) * cosd (ZA)) + ((Y - y) * sind (ZA)))
            relY := (((Y - y) * cosd (ZA)) - ((X - x) * sind (ZA)))
            y := Y - relY
            x := X - relX

    end Rotate
Kuntzy




PostPosted: Tue Feb 03, 2004 8:58 pm   Post subject: (No subject)

wow, thanx catalyst ... don't know what to say
valor




PostPosted: Wed Mar 24, 2004 10:33 pm   Post subject: (No subject)

wow thats sweet, i didnt know that turing could make 3d things, very interesting
zylum




PostPosted: Wed Mar 24, 2004 11:58 pm   Post subject: (No subject)

here's the source to a very simple wireframe program which is really a simplified version of my full 3d engine:

code:
setscreen ("offscreenonly")

const faces := 8
const perspective := 250

var xpp : array 1 .. faces, 1 .. 3 of real := init (-50, 0, 50, 50, 0, 50, -50, 0, 50, -50, 0, -50, -50, 0, 50, 50, 50, 50, -50, 0, 50, -50, -50, -50)
var ypp : array 1 .. faces, 1 .. 3 of real := init (0, 50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0, -50, 0, 0, -50, 0, 0, -50, 0, 0, -50, 0)
var zpp : array 1 .. faces, 1 .. 3 of real := init (50, 0, 50, 50, 0, -50, -50, 0, -50, -50, 0, 50, 50, 50, 50, 50, 0, -50, -50, -50, -50, -50, 0, 50)

var xp : array 1 .. faces, 1 .. 3 of real
var yp : array 1 .. faces, 1 .. 3 of real
var zp : array 1 .. faces, 1 .. 3 of real

var x : array 1 .. 3 of int
var y : array 1 .. 3 of int
var z : array 1 .. 3 of int

var ax, ay, az : int := 0

var mx, my, md : int

procedure rotate (face : int)
    var temp : real
    for i : 1 .. 3
        yp (face, i) := ypp (face, i) * cosd (ax) - zpp (face, i) * sind (ax)
        zp (face, i) := zpp (face, i) * cosd (ax) + ypp (face, i) * sind (ax)
        temp := zp (face, i)
        zp (face, i) := zp (face, i) * cosd (ay) - xpp (face, i) * sind (ay)
        xp (face, i) := xpp (face, i) * cosd (ay) + temp * sind (ay)
        temp := xp (face, i)
        xp (face, i) := xp (face, i) * cosd (az) - yp (face, i) * sind (az)
        yp (face, i) := yp (face, i) * cosd (az) + temp * sind (az)
        x (i) := round (xp (face, i) / (1 - zp (face, i) / perspective)) + maxx div 2
        y (i) := round (yp (face, i) / (1 - zp (face, i) / perspective)) + maxy div 2
    end for
end rotate

loop
    drawfillbox (0, 0, maxx, maxy, 200)
    mousewhere (mx, my, md)
    ax := my mod 360
    ay := mx mod 360
    for i : 1 .. faces
        rotate (i)
        drawpolygon (x, y, 3, black)
    end for
    View.Update
end loop


-zylum
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Fri Mar 26, 2004 6:29 pm   Post subject: (No subject)

leave it to zylum to create the most complex and wicked programs....
.

nice 3d triangle...kruntz......... have urs rotate would look wicked.... also having the lines drawn in a neon ./ bright color and having the backround color black would look sweet

and zylumm... THAT IS AMZING!!!!!!!!!!!!!!!
zylum




PostPosted: Fri Mar 26, 2004 6:51 pm   Post subject: (No subject)

it's really not that complicated once you know trig... the hard part is rotating the points in 3d space (the rotate procedure)... and that's ALL trig... so after grade 10 math you should be able to make a basic 3d wireframe program like the one above Wink

-zylum
the_short1




PostPosted: Fri Mar 26, 2004 7:02 pm   Post subject: (No subject)

im from BC.,.,. since highscoll in BC starts at gr.8... i did trig and everyting last year.... so... i have done everything for most clases last year,... sucks repeating... but meh.!.... some things they teach are different ... but the basics i already learned... geting VERY BORING in math...

next year in compsci i will be integrating math into compsci... rite now its still too much object thinking... and ill just wait...

but math.,.. ERR!!!! feel like killing myself having to listen to the teacher explain something i alredy know for like 2 hours... Rolling Eyes Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad Mad Mad Mad Mad Mad Mad Mad
RETARD32




PostPosted: Sat Apr 03, 2004 10:24 pm   Post subject: (No subject)

If you think that wire fram is good than you should see some of the things that catalyst has made.
Delta




PostPosted: Sun Apr 18, 2004 11:24 pm   Post subject: (No subject)

Your wireframe is screwed to the max zylum... your rotating something in there wrong because if you make the spikes (open sides) face towards you and then move them left and right you can see that they rotate wrongly. But otherwise it looks nice... just fix the rotation problem
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 28 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: