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

Username:   Password: 
 RegisterRegister   
 trig functions?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: Mon Apr 30, 2007 8:51 am   Post subject: trig functions?

I'm still trying to learn how to use the trig functions in turing. I know how to use basic trig in math, such as SOH CAH TOA, and the cosine and sine laws. I also took grade 12 physics breifly, but i didnt do too well, nor do i remember much of it.

Enough of my ranting, our teacher wants us to choose a topic on advanced programming and implement it in the language of our choice (no way in hell im using java) so i decided to do Physics and Turing. I wanted to make a simple pool game using circular col detection and physics to show how the balls would move when they hit. Im just wondering how i could do this, cause im completely lost.
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Mon Apr 30, 2007 11:13 am   Post subject: RE:trig functions?

I highly suggest checking out zylum's Perfect Circle Collision Detection tutorial in [Turing Tutorials]. You should find what you need to start there.
Drakain Zeil




PostPosted: Mon Apr 30, 2007 4:14 pm   Post subject: RE:trig functions?

What does your teacher mean by advanced programming?

Some teachers aren't quite teachers, and impressed by nifty spirals and flashing backgrounds. Some teachers want you to write over a thousand lines as their criteria... I've seen one who mandated that 50% of your code was commenting (moron got fired), and then you get teachers who ask for real things that don't 'look cool.'
ZeroPaladn




PostPosted: Tue May 01, 2007 8:45 am   Post subject: Re: trig functions?

@ Clayton - thanks for the pointer, ill check that out.

@ Drakain Zell - well, she wants us to explore different sections of preogramming, some ppl are doing human interfacing (robots and stuff) and other things, an in fact a few kids in my class are rediculing me for choosing an easy topic. Im just choosing something i feel comfotable with (physics) but the implementation of it in a language is something i was sketchy with.

Thanks guys
Drakain Zeil




PostPosted: Tue May 01, 2007 12:00 pm   Post subject: RE:trig functions?

Well, I wrote a silly intro screen for one of my project in highschool, using trig functions.

code:

View.Set ("graphics:max;max,nobuttonbar")
View.Set ("offscreenonly")
colourback (black)
cls

var font1: int
font1 := Font.New ("serif:40")
var l : int := 0

var ax, bx, cx := 0
var ay, b_y, cy := 0
var midx := maxx div 2
var midy := maxy div 2
var ac, c := 0
var col := 2560
var scale := 200
for decreasing d : col .. 0 by 3
    scale := d mod (255 * 5)
    ax := midx + round (sind (d) * scale)
    ay := midy + round (cosd (d) * scale)
    bx := midx + round (sind (d + 120) * scale)
    b_y := midy + round (cosd (d + 120) * scale)
    cx := midx + round (sind (d + 240) * scale)
    cy := midy + round (cosd (d + 240) * scale)
    c := round ((d / col) * 255)

    Draw.Line (ax, ay, bx, b_y, c)
    Draw.Line (bx, b_y, cx, cy, c)
    Draw.Line (cx, cy, ax, ay, c)
    %Draw.Fill (midx, midy, c, c)


    View.Update
    %    cls
end for
assert font1 > 0

I use turing cos/sin function in this.
And from what I remember turing doesn't have TAN, so remember the identity where sinX/cosX = tanX and make your own functions:

(I don't remember much turing, but this is what your functions should do anyway...)

tan(x)
{return: sin(x)/cos(x)}
tand(x)
{return: sind(x)/cosd(x)}

A good project could be encrpytion/decrpytion and file I/O... I also believe that turing documentation has a (somewhat broken) online chat program... perhaps you cold look into that and do TCP/IP. Both of these I would say are pretty good stater projects.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: