* Vincenz
wrote a cat and a tee utility in ocaml, his first 'real' progs
<seth_>
Vincenz: I am bringing my first fairly large ocaml program on line.
<Vincenz>
neat :)
<seth_>
It even works, almost. :)
<Vincenz>
what is it?
<seth_>
It is part of an internet site filtering system. So it is fairly involved. I originally wrote it in Ruby, and now I've converted it to ocaml.
<Vincenz>
neat
* Vincenz
learned ruby before meeting ocam
<Vincenz>
what do you use for sockets?
<seth_>
standard library stuff, UnixLabels module stuff, and the rest I wrote myself.
<Vincenz>
ah
<Vincenz>
isn't it a pain to use something so lowlevel?
<Vincenz>
I know ruby has some nice std libs for that stuff
<seth_>
well, there is always a trade off between the level and the degree of flexibility. But, actually, ocaml has just as much as ruby, if you use the cdk libraries.
<seth_>
I didn't use the cdk libraries, though, because I wanted to maintain control.
<seth_>
So I wrote some classes to fill in the missing functionality.
<seth_>
Now that I am over the hump of understanding the compiler's messages and the general framework, I am very pleased with ocaml.
<seth_>
It takes some mental reorientation, though.
<Vincenz>
hmm
* Vincenz
reminds himself to look up cdk
<seth_>
there is a link to it on the main ocaml page. It is a fairly extensive set of additional libraries, and IDL compiler for interfacing to C, a lot of interesting stuff.
<seth_>
s/and IDL/an IDL/
lament has quit ["Support Darwin Awards! Join the military!"]
lus|wazze has quit ["*liephab* <3 <3 <3"]
* Vincenz
has the IDL he thinks
<Vincenz>
I have the standard windows-install
<seth_>
Don't know, I don't use windows.
Kinners has joined #ocaml
mattam_ has quit [Read error: 110 (Connection timed out)]
lament has joined #ocaml
exa has joined #ocaml
<exa>
anybody around?
<exa>
need help with module compilation :(
<exa>
File "dynarray.ml", line 13, characters 13-84:
<exa>
Unbound record field label vec
<exa>
I get this error, but in dynarray.mli the record including vec field is defined correctly
<exa>
And when I copy/paste the error-yielding function, it works in the interpreter
<pattern_>
vincenz, if you like that you should try to find the domokun movies
<pattern_>
they're hilarious
<Vincenz>
alright :)
<vegai>
hmm, will the O'reilly ocaml-book be online forever?
<vegai>
why is it online? are the authors rich already? =)
<baader>
i've downloaded and printed it
<vegai>
awfully nice, though
<pattern_>
yes, just think of the millions that the authors could make by printing and selling an ocaml book ;)
<baader>
i'd buy a final englisch version anytime
<vegai>
pattern_: it seems authors are more selfish usually regardless of the demand
<pattern_>
true
systems has joined #ocaml
systems has quit [Read error: 60 (Operation timed out)]
Vincenz has quit [Read error: 104 (Connection reset by peer)]
<emu>
"on the look-out" meaning "for suspicious characters writing camls"
<lus|wazze>
?
<exa>
emu: are you naturally high?
exa has quit ["using sirc version 2.211+KSIRC/1.3.4"]
lament has quit ["Support Darwin Awards! Join the military!"]
hitachi has joined #ocaml
<hitachi>
seems dead in here...
<hitachi>
anyone wouldn't happen to know anything about raytrace?
<lus|wazze>
depends
<lus|wazze>
what do you want to know?
<hitachi>
hehe what I would need to know to start making myown raytracing program
<lus|wazze>
hm
<lus|wazze>
theres actually nothing special you need to know
<lus|wazze>
some math
<lus|wazze>
and some coding
<lus|wazze>
some elementary linear algebra should suffice in the math department
<hitachi>
not even light physics? I am currently in Algebra II and i mostly use python but also used c
<lus|wazze>
then the basic principle is this
<lus|wazze>
no you don't need much if any physics knowledge really :)
<lus|wazze>
raytracing is actually pretty far away from real life physics
<lus|wazze>
if you want to model light behaviour realistically you'll need radiosity
<lus|wazze>
but that is very complicated and uses prettyadvanced math
<lus|wazze>
but raytracing is acutally relatively simple
<lus|wazze>
for each pixel in the screen
<lus|wazze>
you calculate a ray
<lus|wazze>
which starts at the observer position
<lus|wazze>
then goes through that pixel
<lus|wazze>
and find where it intersects with objects
<lus|wazze>
you then take the closest of those intersections
<lus|wazze>
calculate how much light of whicch colors it reflects
<lus|wazze>
and make that pixel that color
<lus|wazze>
for the calculating the color step there are several models, that is, formulas, the most common one being the phong model
<lus|wazze>
suppose for example a simple raytracer which only supports spheres as the only object type
<lus|wazze>
in ocaml, for example, you could represent a sphere as a record { orgx:float;orgy:float;orgz:float;rad:float }
<lus|wazze>
you could then have a list of those spheres
<lus|wazze>
and apply a function which calculates the intersection distance along a ray for a sphere
<lus|wazze>
and simply map that function to the sphere list
<lus|wazze>
take the minimum
lament has joined #ocaml
<hitachi>
heh make it sound simple ^_^
<lus|wazze>
you would then loop through all the pixels like this: for ix = xmin to xmax do for iy = ymin to ymax do let ray = {startx=0.0; starty=0.0; startz=0.0; directx = float_of_int ix; directy = float_of_int iy; directz = 1.0 } in ... done done
<lus|wazze>
well the basic principle behind it IS very simple
<lus|wazze>
what makes it complicated is only advanced features based on the basic princinple, and speed improvements, that is, optimizations
<hitachi>
how long would you say it would take for someone new to ocaml and some coding to develope? (i kinda want to develope this before by the end of my senior yeat in HS, i am in 11th right now, maybe it would help me get into college )
<hitachi>
3-4 months?
<lus|wazze>
hm
<lus|wazze>
its hard to say#
<lus|wazze>
it really depends too much on the feature set
<lus|wazze>
a really basic one you might hack out in a matter of a few days
<lus|wazze>
with a basic model and support for the most common shapes and lighting models id say, a good coder who understands his math, and not counting the parsing of the input language, maybe a month or two
<lus|wazze>
but
<lus|wazze>
there are really extreme cases
<lus|wazze>
you might want to consider, for example, that one of the ifcp contest challenges in the last few years was to write a raytraces
<lus|wazze>
complete with parsing of a moderately complex source language
<hitachi>
where?
<hitachi>
on the site?
<lus|wazze>
they did it, iirc, all over the course of a weekend
<lus|wazze>
it only needed to support phong lighting and no shadows, though, as far as i remember
<hitachi>
heh cool!
<lus|wazze>
i suppose it should be in some of the archives there
<lus|wazze>
as i said, the basic layout of a raytracing engine is VERY simple
<lus|wazze>
you should have your program up and running on the same day you begin
<lus|wazze>
then you begin to add features which is what takes time
<hitachi>
heh for me maybe longer I just began to use ocaml 2 days ago...
<hitachi>
whats the difference from .ml and .mli
<lus|wazze>
.ml is the implementation
<lus|wazze>
if you know C the following analogy might help:
<lus|wazze>
.ml is like .c
<lus|wazze>
.mli is like .h
<hitachi>
oh!
<lus|wazze>
.mli contains type definitions and "prototypes"
<lus|wazze>
which will be exported from the .ml module of the same name
<lus|wazze>
eg you have an .ml file with the contents
<lus|wazze>
let private_put_the_string () = print_string "this is private!"
<lus|wazze>
let public_put_the_string () = private_put_the_string (); print_string "\nthis, however, is public!"
<lus|wazze>
and then a .mli file with the contzents
<lus|wazze>
val public_put_the_string : unit -> unit
<lus|wazze>
and you could ony call public_put_the_string from other modules
<hitachi>
unit is like void in c right?
<lus|wazze>
pretty much
<lus|wazze>
only that its a valid datatype
<lus|wazze>
it just contains only 1 value, ()
<hitachi>
cool I remebered that from yesterday heh
<lus|wazze>
you can make a perfectly valid array of unit's for example
<lus|wazze>
it's just that each one will be the same value, ()
<hitachi>
about putting the pixels on the scene...i would use the graphic lib the comes with ocaml right?
<lus|wazze>
you could use whatever you want
<lus|wazze>
personally i wouldn't really care about that at first
<lus|wazze>
best might be, in fact, to declare a class type for outputting pixels or something
<lus|wazze>
and then using that
<hitachi>
just work on he point&vector math and calculations right?
<lus|wazze>
and at first only dumping the pixel values directly in some file or something
<lus|wazze>
but the graphics library that comes with ocaml is ok - why not
<hitachi>
for testing? thats smart hehe
<lus|wazze>
well you can create your image without any interaction from the user once you've read and parsed the scene description