Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-03-2004, 04:19 PM   #1
Member (6 bit)
 
Join Date: Jul 2003
Location: NY
Posts: 49
Send a message via AIM to liquid_cool Send a message via Yahoo to liquid_cool
Graphics in SML/NJ

Would anyone be able to tell me how to do graphics in ML programming language? preferably SML/NJ. It is for drawing Lindenmayer systems and so basically just needs to support drawing lines of various lengths and at different angles on the screen... thanks for any help
liquid_cool is offline   Reply With Quote
Old 04-05-2004, 10:06 PM   #2
Member (7 bit)
 
Join Date: Sep 2003
Posts: 90
hmmm. . . graphics in ML . . .
well, the most i have done is to create a word array and then tell each pixel what color to be. then i dump the thing to a ppm (portable pixmap format). file i/o is a real you-know-what in ML.

people have done really cool things with this. the code i used to create a ppm was actually used in the ICFP programming contest to make an ML raytracer.

http://www.mlton.org/benchmarks/raytrace.sml

sorry i can't be much more help than that, but ML is just not nice for file i/o nor graphics.

AS
AerynSedai is offline   Reply With Quote
Old 04-06-2004, 10:26 PM   #3
Member (6 bit)
 
Join Date: Jul 2003
Location: NY
Posts: 49
Send a message via AIM to liquid_cool Send a message via Yahoo to liquid_cool
Thanks for the response, that sounds really cool, but it also sounds a bit too complicated for me... basically the idea is that I have to do lindenmayer systems in ml, and then find a way to output it, I get the normal points for text output, 30 point bonus or something like that for ascii graphics, and 50 bonus for full graphics... from your explination it sounds like the 50 points might not be worth the trouble...
liquid_cool is offline   Reply With Quote
Old 04-06-2004, 11:18 PM   #4
Member (7 bit)
 
Join Date: Sep 2003
Posts: 90
if you are savy with openGL, you could dump the results into a C program, but that would be cheating. hehe.

i might have the code for that raytracer in SML lying about, but you would have to write an iterative functions to color the pixels on the line. if they are only horizontal or vertical, it might not be too bad. i have never dealt with l-systems.

iterative functions are a trick in a functional language, but the raytracer basically loops over every pixel, so it can be done. i guess you would have to fold over all the lines and do the algebra. it would be quite a trick.

it seems everything you are doing in ML, file i/o, graphics, iterativeness, etc are all tricky in a functional language. good luck, you are the first person i have met who knows ML.

AS

Last edited by AerynSedai; 04-06-2004 at 11:20 PM.
AerynSedai is offline   Reply With Quote
Old 04-07-2004, 06:52 AM   #5
Member (6 bit)
 
Join Date: Jul 2003
Location: NY
Posts: 49
Send a message via AIM to liquid_cool Send a message via Yahoo to liquid_cool
That's the problem... I don't know ML, till this semester I've pretty much only used Java, C, and C++
Now I'm taking a programming languages class, and they are trying to teach us the ideas about a wide variety of languages, such as Forth, ML, LISP... It's really a pain because we get these projects in languages we've never used before and then have to rush to learn the language so we can do the project.
Supposedly the actually l-systems part isn't very difficult to do in ML just the output, unfortunately I don't know as much about programming as I guess I should by now, because I don't know anything about OpenGL or raytracers, but I don't think OpenGL is cheating. Someone brought that up I think and he said if you could figure it out that's fine, as long as it works on the school's Sun systems, I think he said that requirement was to prevent us from using .net stuff... I guess I should read up on this OpenGL stuff, seems like it might be the easiest way
liquid_cool is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:51 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2