Quaternions vs. Euler Angles

Euler angles are more human understandable and also good for decomposing rotations into individual degrees of freedom (for kinematic joints and the like) but have disadvantages like ambiguity and gimbal lock. In practice I would prefer quaternions, as they are easier to compute with (for the computer, not for humans) and more efficient. You have … Read more

Fast work with Bitmaps in C#

You can do it a couple of different ways. You can use unsafe to get direct access to the data, or you can use marshaling to copy the data back and forth. The unsafe code is faster, but marshaling doesn’t require unsafe code. Here’s a performance comparison I did a while back. Here’s a complete … Read more

Drawing Sequence Diagrams [closed]

PlantUML. http://plantuml.sourceforge.net/sequence.html PlantUML is used to draw UML diagram, using a simple and human readable text description. The generated images can then be used without any reference to the GPL/LGPL/ASL/EPL/MIT license. It is not even necessary to stipulate that they have been generated with PlantUML, although this will be appreciate by PlantUML team. In my … Read more

Find if a point is inside a convex hull for a set of points without computing the hull itself

The problem can be solved by finding a feasible point of a Linear Program. If you’re interested in the full details, as opposed to just plugging an LP into an existing solver, I’d recommend reading Chapter 11.4 in Boyd and Vandenberghe’s excellent book on convex optimization. Set A = (X[1] X[2] … X[n]), that is, … Read more

When transforming textures (drawn as flat 3D objects) to mimic depth, black lines appear randomly

Look at the rock of the bottom of that last image – it’s got sandy-colored lines going through it. Presumably, you are drawing the sand first, then the rock on top. This tells me it’s not “black lines being drawn” through the textures, but that parts of the textures are not being drawn. Since it … Read more

Calculating a LookAt matrix

Note the example given is a left-handed, row major matrix. So the operation is: Translate to the origin first (move by –eye), then rotate so that the vector from eye to At lines up with +z: Basically you get the same result if you pre-multiply the rotation matrix by a translation –eye: [ 1 0 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)