### Add custom compiler to Xcode2013-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)

Open up a terminal window (Root privileges will be required for some steps!) Go to you applications folder and open up the "Xcode.app" package.

cd /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins


For Xcode 4.2 the correct path is (thanks to Joram Vanhaerens for this info) stack overflow

cd /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/


For Xcode 3.6 the correct path is (untested)

cd /Developer/Library/Xcode/Plug-ins


### Importing Into Maya From Physics Engine2013-9-28

Maya is a useful tool for visualizing simulation results. However sometimes coordinate systems get messed up when loading in data.

Using A vector for position and a quaternion for rotation we have:

Negate the X direction


maya_pos.x = -original_pos.x;
maya_pos.y =  original_pos.y;
maya_pos.z =  original_pos.z;



Negate the Quaternion's x component and magnitude


maya_quat.e0 = -original_quat.e0
maya_quat.e1 = -original_quat.e1
maya_quat.e2 =  original_quat.e2
maya_quat.e3 =  original_quat.e3



Maya does not have direct support for quaternions but if you use python you can use the OpenMaya module


import maya.OpenMaya as OpenMaya
...
rotation = OpenMaya.MQuaternion(-e1,e2,e3,-e0);
euler = rotation.asEulerRotation().asVector();


### Povray Color Ramp2013-6-03

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


#local c=<1,1,1>;
#local p=sqrt(vx*vx+vy*vy+vz*vz);
#if (p <= .5)
#local c = (y * p *2.0  + z * (.5- p)*2.0);
#else
#local c = (x * (p - .5)* 2.0 + y * (1.0 - p)*2.0);
#end

sphere {<0,0,0>, 1 translate  pigment {color  rgbt  }finish {diffuse 1 ambient 0 specular 0 } }



### Compiling GCC 4.6.3 on Fedora 182013-3-14

This guide assumes a 64 bit architecture First get gcc 4.6.3

GCC 4.6.3

Extract the tar

tar -xvf gcc-4.6.3.tar.gz


Install wget (required by prequesites command), development tools and 32 bit glibc headers

yum install wget glibc-devel.i686
yum groupinstall "Development Tools"


Enter the directory, download prerequisites and run configure with prefix to set the install directory, change this to your liking

cd gcc-4.6.3/
./configure --prefix=/usr/local/gcc/4.6.3


A compilation error will result when you run make so either apply the following patch or change the lines modified by the patch

patch -p1 < {/path/to/patch/file}


### Installing cuda sdk 5.0 on fedora 182013-3-14

This guide assumes a 64 bit architecture First install gcc 4.6.3 using this guide

Compiling GCC 4.6.3

Ensure that your kernel and selinux policy are up to date

yum update


Install RPM fusion

yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-18.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-18.noarch.rpm


Install the nvidia graphics driver

yum install akmod-nvidia xorg-x11-drv-nvidia-libs


We need to get the cuda sdk, in this case get the version for fedora16

yum install glut-devel