
-----------------------------------
Catalyst
Thu May 08, 2003 9:30 pm

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 :(

-----------------------------------
Catalyst
Thu May 08, 2003 9:46 pm


-----------------------------------
a nice little demo :)

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
Fri May 09, 2003 8:11 am


-----------------------------------
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
Fri May 09, 2003 11:48 am


-----------------------------------
bwahahahahaaaaaar..... nice demo  8)

-----------------------------------
Crono
Sat May 10, 2003 1:33 pm


-----------------------------------
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:

    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
Sat May 10, 2003 1:42 pm


-----------------------------------
thx for the function :D  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
Mon Mar 22, 2004 3:59 pm


-----------------------------------
if you dont mind, would you please explain the Math2d and Math3d functions....i dont really understand them :? lol. thanks in advance

-----------------------------------
Catalyst
Mon Mar 22, 2004 5:14 pm


-----------------------------------
Math2D and Math3D are modules



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

-----------------------------------
Delos
Mon Mar 22, 2004 7:58 pm


-----------------------------------
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
Tue Mar 23, 2004 11:21 pm


-----------------------------------
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! 