MATHEMATICS

Rabu, 27 Juli 2011

The ColorFunction Option in Mathematica

Scenegraphica progress: programming ( how I prefer to do it anyway ) involves a lot of throwing away of code. Start again from scratch often but with the know-how ( and portions of code ) of the previous version. Eventually entire classes survive and a system emerges. There must be a name for this 'method'. Probably something with agile in it.

I just started on the third cycle of scenegraphica: x3. Not much of x2 survived. I am concentrating on color, surface properties of objects, light, shadow and viewpoints in this release. - I am redesigning the root scenegraph class. It gets a property of type collection to store all the light sources in the universe. - Instead of using Mathematica's own List I am developing an OO-System List class. It will implement Java's Collection interface. Think of a little brother of ListArray.

To get ideas for scenegraphica I look a lot at professional ( Mathematica ) generated graphics. Here for example.

It will take a while ( if at all ) before I can create graphics like that. Because the author of the article, Jean-Pierre Hebert, was so kind to provide his formulas it inspired me to try something like this:

ContourPlot[{Sin[x + y + Sin[x] + Sin[y]]}, {x, 0, 12 \[Pi]}, {y, 0, 12 \[Pi]}, Frame -> False, ColorFunction -> "Rainbow"]


and this:

ContourPlot[{Sin[x + y + 3 Sin[x] + 4 Sin[y]]}, {x, 0, 4 \[Pi]}, {y, 0, 4 \[Pi]}, Frame -> False, ColorFunction -> "Rainbow"]


Note the usage of ColorFunction which is an option for graphics functions which specifies a function to apply to determine colors of elements. "Rainbow" is just a standardfnction that comes equipped with Mathematica. The fun starts when you start making your own color functions.

It would be nice if I could use these patterns as textures for 3D objects. Not sure yet how to do that though.

Tidak ada komentar:

Posting Komentar