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

Username:   Password: 
 RegisterRegister   
 TuringLib
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Catalyst




PostPosted: Thu May 08, 2003 9:30 pm   Post subject: TuringLib

heres a library i compiled of useful fucntion/procs a while ago so i wouldnt have to hunt for them (note: not all are made by me)

Ive posted in submissions since there is no attachments in source Sad



turinglib.t
 Description:

Download
 Filename:  turinglib.t
 Filesize:  8.17 KB
 Downloaded:  531 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Thu May 08, 2003 9:46 pm   Post subject: (No subject)

a nice little demo Smile

code:
View.Set ("graphics:400;400,nobuttonbar,position:300;300")
include "turinglib.t"
const mx := maxx div 2
const my := maxy div 2
var x, y : array 1 .. 3 of int
x (1) := mx-100
y (1) := my-100
x (2) := mx+100
y (2) := my-100
x (3) := mx
y (3) := my+141
const dist1 := Math2D.Distance (x (1), y (1), maxx div 2, maxy div 2)
const dist2 := Math2D.Distance (x (2), y (2), maxx div 2, maxy div 2)
const dist3 := Math2D.Distance (x (3), y (3), maxx div 2, maxy div 2)
for i : 1 .. maxx
    for k : 1 .. maxy
        drawdot (i, k, Color.putRGB ((Math2D.Distance (i, k, x (2), y (2)) / dist2), (Math2D.Distance (i, k, x (1), y (1)) / dist1), (Math2D.Distance (i, k, x (3), y (3)) / dist3)))
    end for
end for
Delta




PostPosted: Fri May 09, 2003 8:11 am   Post subject: (No subject)

Hey Catalyst can you post the code on here for it and then once I get it delete it because I can't download it because of the security settings on the school computers here.

THNX if you can(or can't)
Homer_simpson




PostPosted: Fri May 09, 2003 11:48 am   Post subject: (No subject)

bwahahahahaaaaaar..... nice demo 8)
Crono




PostPosted: Sat May 10, 2003 1:33 pm   Post subject: (No subject)

i didn't see any code for dividing complex #'s, so here's my code with a demo, it corresponds with the existing module already made by Catalyst, u can add it directly into his library, change the numbers around to test its validity if u wish

Code:
code:

    type complex :
        record
            r : real
            i : real
        end record
    function DivComplex (comp1, comp2 : complex) : complex
        var hold : complex
        hold.r := ((comp1.r * comp2.r) + (comp1.i * comp2.i)) / ((comp2.r) ** 2 + (comp2.i) ** 2)
        hold.i := ((comp1.i * comp2.r) - (comp1.r * comp2.i)) / ((comp2.r) ** 2 + (comp2.i) ** 2)
        result hold
    end DivComplex
    var m, n : complex
    m.r := 3
    m.i := 3
    n.r := 1
    n.i := 1
    put DivComplex (m, n).r, " + ", DivComplex (m, n).i, "i"
Catalyst




PostPosted: Sat May 10, 2003 1:42 pm   Post subject: (No subject)

thx for the function Very Happy I pulled the complex functions from a fractal prog i made which didnt need a div function ill put them in the file
Thuged_Out_G




PostPosted: Mon Mar 22, 2004 3:59 pm   Post subject: (No subject)

if you dont mind, would you please explain the Math2d and Math3d functions....i dont really understand them Confused lol. thanks in advance
Catalyst




PostPosted: Mon Mar 22, 2004 5:14 pm   Post subject: (No subject)

Math2D and Math3D are modules


code:

module Math2D
    %% By Catalyst
    export Distance, Slope
    function Slope (x1, y1, x2, y2 : real) : real
        result (y1 - y2) / (x1 - x2)
    end Slope
    function Distance (x1, y1, x2, y2 : real) : real
        result ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
    end Distance
end Math2D

module Math3D
    %% By Catalyst
    export Distance
    function Distance (x1, y1, z1, x2, y2, z2 : real) : real
        result ((x1 - x2) ** 2 + (y1 - y2) ** 2 + (z1 - z2) ** 2) ** 0.5
    end Distance
end Math3D


Math2D.Slope is the slope between to points
Math2D.Distance - 2D Distance
Math3D.Distance - 3D Distance
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Mon Mar 22, 2004 7:58 pm   Post subject: (No subject)

In the 'MathFunc' module, you've redeclared 'tan' and 'tand'.
I guess this was from a bit back, when they didn't exist...but now in 4.0.5 you'll have to change the syntax a tad.
Otherwise, great job.
the_short1




PostPosted: Tue Mar 23, 2004 11:21 pm   Post subject: (No subject)

WICKED FRIKCING STUFF!!! i made some functiosn at the end of the year... but i didn;t explore on it... i was too busy... now i will be learning them again and realy get into it.... makes it realy nice to incorparate the slope and distance that i learned last year... we used it to find radius and i just was lkie MEH!... i was kinda distacted by some girl too.......... ..... .... .... ... .... .... ... ... anyways... that and pac man.... COOL STUFF!!! WICKED PROGRAM! it will save me time and now i can ditch rapscalions tracker code and make my own.... ( i want to) ez as PIE! <<HAHAHAH>

+ MEGA BITS!!!!
30 !!!! the most ive ever gave...!!!!
shorthair




PostPosted: Thu Mar 25, 2004 6:17 am   Post subject: (No subject)

Beautilful , Powerful

" Exactly what i always wanted from Turing "


3 cheers forCatalyst , Way t ogo once again you have brought us a great app , i apreciate hte effort that went into this and good luck with future apps


have some bits that you probably dont want Very Happy Very Happy
sport




PostPosted: Mon Mar 29, 2004 8:13 pm   Post subject: Help

Great program all the help in one.
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 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: