C version of the simulated ptam