CMake Unable to Find AMD’s ACML Files Under Windows

One popular BLAS implementation under Windows is AMD’s ACML.
CMake has some modules that can find certain required dependency libraries. As far as I know, under Windows the “FindBLAS” and “FindLapack” modules are unable to locate AMD’s ACML libraries. This is because ACML > v4.0 does not include the “mv” related packages anymore.

I looked around a little bit and I found a patched version of these files here and here. However, I couldn’t get them to work. If anyone was able to get them to work, comment below.

Cannot Find “getopt.h” File When Compiling Under Windows

Often times, issues arise when compiling C/C++ code developed for Linux under Windows. One annoying problem is when the code requires some header which is only available in the POSIX API. A header commonly used for parsing the command line arguments is getopt.h. Unfortunately, this header is only available under Linux. After some digging around, I found a port of this header file for Windows here.

In case the repository went down in the future, I’ve pasted the code here. All credits go to the original author. Click on the link below for the full code.

Continue reading Cannot Find “getopt.h” File When Compiling Under Windows

Rotate a 3D object around its center and own axes in WPF 3D

In WPF 3D, various transformations could be applied to an object. One particular problem that I occasionally run into is when I want to apply a rotation transformation to an object and rotate it around its own center and axes.

The way I do it is as follows. First I apply 3 identity RotateTransform3D‘s to the object with AxisAngleRotation3D‘s objects underneath: one for the X axis, one for the Y axis and one for the Z axis. Then whenever I want to rotate the object around a certain axis, I obtain the corresponding RotateTransform3D object, set its center according to the (possibly) translated center of the object, and apply the rotation angle to the underlying AxisAngleRotation3D object. Some code will make this more clear.

First apply the 3 identity transforms to the object:

Let’s say the function SetRotation is to be used for setting the rotation of the object. It will work as follows:

Orient a Transform to a Specific Direction in Unity 3D

If you are too lazy to do the math to orient an object to a specific direction, this tip is useful for your.

The Transform objects in unity have the Forward, Up and Right properties. You probably don’t know that they are not only accessors but also mutators! You can simply assign a direction vector to an object’s Forward direction and the object will face that direction:

This can be handy sometimes, especially when you want to use the Kinect sensor inside the game. If the players arm direction signifies the orientation of something (eg. a sword), this tip saves you some time.