PDA

View Full Version : Any way to do "pen down"? Any thing like a graph? Community objects?


Sophie
06-04-2009, 05:40 PM
I'd like to graph some numeric properties (mostly, but not exclusively, against time), and wonder if there is (a) some existing graph like object I could use, or (b) something like 2-D "pen-down" onto some 2-D-ish surface so I can build a grapher myself.

Any pointers / suggestions welcome.

Related question: is there some community collection of shared objects/classes? Is the "Web Gallery" it? Is there an easy way to find things, or contribute to them?

Thanks.

lanceA
06-04-2009, 06:37 PM
"pen down" reminds me of Turtles. Barbara Ericson, et. al. have a new book out: "Exploring Wonderland: ......" that incorporates her original book Media Computation and Alice. But that is the only 'turtles' reference that I am aware of.

ttkrakus
06-05-2009, 12:26 AM
There are no built-in components for making a graph (2D or otherwise).
You could tinker with Alice's source code and add this feature. In the case of a 2D graph, one cheap and dirty way of doing it would be to render the graph as an image and create a billboard object with it. If you have some experience in Java, you may be able to add this feature by creating a new kind of object. It would be neat that when you import this new "2D Graph" object from the gallery, Alice asked you for the function to plot, the clipping region, whether or not to show the axes, etc, etc.

You could fake a 2D graph by creating an array of spheres, one next to the other --as many spheres as x-values you want for your graph. Use a loop to evaluate each x-value with the function to plot: use the y-value obtained to raise (or lower) each sphere. Think a graphical equalizer. This is so crude that I am not sure it is worth doing. But, it is possible.

Sophie
06-05-2009, 09:55 AM
The array of spheres may work (not ready to hack the Java source). On a reasonable machine (intel core-2 mac, 2G+) will Alice bog down at 10 visual objects? 100? 500?

Thanks

ttkrakus
06-06-2009, 01:14 AM
It all depends on the number, size, texture of the spheres and other elements in the world like light sources. Actually, using cubes instead of spheres should improve performance --they are going to be tiny anyway.

Of course, this could be offset by the kind of computer you will be using: more memory and processor power will allow you to have more objects --a decent graphics card should help too.

There is a big caveat here, however. I do not know of a way to create objects in Alice 2.X programmatically --I think this will definitely change in Alice 3.0. As far as I know, you have to add all 100, 200 or whatever number of cubes you want to use, manually into an Alice world. Not only that, once you are done adding those objects, you will create an array containing these objects which you have to, again, manually add to the array --one cell at a time. On the other hand, after doing this once, you can create copies of your world whenever you want to plot a different function.

DrJim
06-06-2009, 11:25 AM
While, as noted, it obviously depends on model complexity - my own experience (XP, 2G memory) is that things start to slow down for over a couple dozen typical models (i.e. more than a couple hundred objects and sub-objects).

It has been reported that copying an instance of a model instead of placing a second instance will also help. I really havent observed this - but also haven't looked very hard. It certainly can't hurt.

Also be careful with "undo"s. If you have done a lot of them, that can start to slow things down also. Just save the world, exit Alice and restart.