Povray Color Ramp 2014-01-14

I sometimes need to use a color ramp in povray to render the velocity of a particle. This is more of a reference for myself then anything else 2013-6-03 - Original Post 2014-1-14 - Updated

//velocity of object is stored in vx, vy, vz
#local c=<1,1,1>;
#local p=sqrt(vx*vx+vy*vy+vz*vz);
#if (p <= 0.5)
	//handle color values from blue to green
	#local c = (y * p *2.0  + z * (.5- p)*2.0);
#elseif (p > 0.5 & p < 1.0)
	//handle color values from green to red
	#local c = (x * (p - .5)* 2.0 + y * (1.0 - p)*2.0);
#else
	//clamp color to red for maximum value
	#local c=<1,0,0>;
#end

sphere {<0,0,0>, 1 translate < x, y, z >  pigment {color rgb c }finish {diffuse 1 ambient 0 specular 0 } }

Three.js Quaternion Camera 2013-12-25

This is a three.js camera class based on my quaternion camera code, math is very similar with syntax changes due to vector and quaternion classes in three.js

based on https://github.com/mrdoob/three.js/blob/master/examples/js/controls/PointerLockControls.js

Point Cloud From OBJ Mesh 2013-12-19

Sometimes it can be useful to be able to generate a point cloud out of an OBJ mesh. This cloud can then be used for simulation, visualization etc. The easisest way I have found to do this is to use Houdini.

It is an excellent piece of software and the developers provide a free learning edition which is what we will use.

So lets begin!

Alt text

ModernGL Camera 2013-12-16

This is an update to my previous OpenGL camera class. It uses GLM for all math operations and is better suited for use with modern opengl code based on shaders and such.

Code is also availible here:

https://github.com/hmazhar/moderngl_camera

Add custom compiler to Xcode 2013-11-13

Update 2013-11-13 Added paths for Xcode 4.2 and 3.6

I do a lot of my coding on osx, and was getting annoyed that I could not pick a specific compiler from within Xcode that I had installed. Using makefiles is an option but I wanted to see if I could add a new compiler to Xcode 4. This guide was the basis for mine, tweaked for Xcode 4

Xcode 4 and gcc-4.7 will be used as the example, in theory any compiler can be used (I have not tested this). This requires that you have installed gcc-4.7 from macports (usually gcc-mp-4.7)