
Programming (18)
Programming information.
Optimizing atof and strtod in MSVC 2008

When parsing a 3d mesh from an OBJ file, it is optimal to collapse equal vertices into an indexed list. This is one of the more complicated steps so my suspicion was that something went wrong there. I was using a hash table to do the comparisons so it should have been fast. I disabled that section of code, and timed the load again. It barely affected the result.
Another common pitfall when parsing files is getting stalls from seeking through the file itself. I had already taken that into consideration and just loaded the whole thing into memory for processing. I was out of ideas and decided to profile the load and see what I had done wrong. I learned that almost all of my time was spent in strlen which was a big red flag considering I never even called strlen during my entire load.
Continue reading...Loading the Stanford Bunny

I decided to get a little framework set up that would let me play around with some graphics code. As a result, I decided that step one would be to get everyone's favorite test model, the Stanford Bunny, loaded and rendering. I'd never actually used the bunny or any of the other Stanford models before so after a little research into where to access them and what format they were in, I came up with a "pipeline" for loading them into my application. I wouldn't call it a great solution, but it worked pretty well for getting something up and running to play with.
Continue reading...Constraint Relaxation IK in 2D
Inverse kinematics (IK) solvers often become mathematically intensive or computationally expensive with long kinematic chains or when functioning in higher dimensions. I am going to cover an approach to solving IK that is easy to understand, handles any number of joints, and is easy to implement in any dimension. We will walk through a two dimensional example and I'll present sample code to perform the algorithm.
Cyclic Coordinate Descent in 2D

CCD solves the IK problem through optimization. Looping through the joints from end to root, we optimize each joint to get the end effector (tip of the final joint) as close to our target as possible. This loop is then repeated until we find a solution or we reach an iteration limit. You can download the RJ_Demo_IK application and source code to see an interactive implementation.
You might also be interested in the following articles on different IK solvers:
Continue reading...