Articles
-
I suck at gaming but I can code
I played Final Fantasy X a lot on PS2 when I was in high school. Great RPG if you ask me, but it's riddled with punishing little mini-games that you have to complete in order to unlock certain items that ultimately make your characters stronger. One of them, arguably the most annoying, was remarkably efficient at making me rage quit: the lightning bolt dodging mini-game of the Thunder Plains. Today, I'm going to shamelessly brag about my way of cheating through this sadistic mini-game on the HD remaster PC version, by coding a Python bot.
[Read more] -
How to compute simplicial homology in Python
The last two weeks or so, I spent some time learning about homological algebra in algebraic topology. But I'm one of those guys who can't really familiarize with a concept until they write code for it, so I had to learn how to compute (real) homology algorithmically in the simple context of simplicial complexes. It turns out to be somewhat manageable once you understand a few tricks, and today I'm going to show you how I did it. At the end of this article, you'll be able to specify a simplicial complex as a set of k-simplices and automatically compute the boundary operators and bases of its homology spaces.
[Read more] -
They tried to scam me. This is what happened to their database.
Two years ago, fed up of receiving scam messages on my phone, I decided to fight back. My plan was to saturate the databases of some phishing websites that ask for credit card numbers, in hope that legit information sent by people who got scammed would forever be lost in an ocean of garbage data. I'm going to show you how I developed a tool to do exactly that, using some knowledge exposed in a previous article.
[Read more] -
Generating fake credit card numbers
In this short article we are going to see how to generate fake credit card numbers that will pass most online validation checks. There's nothing nefarious you can do with this, as a credit card number is far from being sufficient in order to make online payments. But maybe you need to generate some fake credit card numbers for testing purposes, when developing a website for example, in which case I wish you a good reading!
[Read more] -
Arc length parametrization: Hermite spline [part 2]
In a previous article we derived a few equations for the arc length parametrization of curves, and studied a specific class of curves for which a closed-form formula can be obtained. Today, we'll cover the case of Hermite splines, for which no such closed-form formula exists, and we'll see how numerical methods can be employed to solve the problem anyway. As you can guess, we'll do less maths but more code! I advise you to read at least the first section of the first part as I'm going to use it here.
[Read more] -
Arc length parametrization: catenary [part 1]
If you are using mathematical curves as input to skinning for procedural geometry, or as paths followed by an agent or a camera in game development, you might have suffered the effects of nonuniform sampling along the curve. The input parameter of the function describing your curve is not, in general, a fraction of the arc length along the curve. This translates to weirdly stretched skins on your procedural model, or non-uniform movement along your paths. Today, we are solving this problem for a specific type of curves for which a closed-form expression exists. In the next part we will address the same problem for a more uncooperative class of curves.
[Read more] -
Smooth parametrization of a family of lines
If you ever needed to parametrize a family of lines, you may have stumbled upon a discontinuity problem. When the slope of two consecutive lines in your discrete family change sign, it means that in the continuous family you're trying to fit, there is a vertical line somewhere inbetween. As you know, a vertical line has its slope and y-intercept both undefined, and if you were to plot them for the continuous family you would observe a singularity. So you can't use the slope-intercept form to parametrize your family of lines. Don't despair, here's a trick for you!
[Read more] -
Generalized quadratic interpolation
Bilinear and bicubic interpolations are the go-to methods when it comes to interpolate data on a regular grid. But experimental science being what it is, you don't always get your data nicely arranged in a rectangular 2D grid, in which case these two methods will not work. Here I present to you an extension of bilinear interpolation that works with arbitrary quadrilaterals. It is less generic than scatter interpolation, but nonetheless useful when you still have a grid, but a skewed one.
[Read more] -
Controlling a CRC-32 hash
Today, we are going to see why CRC32 is utterly broken as a crypto hash (which it is **not**!), and demonstrate a clever way to control CRC32 string hashes by only altering the case. This is for fun and giggles, I'm pretty sure nobody today uses CRC to protect files against *intentional* data alteration, but it's a good occasion to do some linear algebra in the Galois field of order 2.
[Read more] -
Surface flatness and mathematical optimization
The problem of estimating "how flat" a surface is comes up quite often in the industry. A machined surface can be subjected to a series of local height measurements with the use of a CNC height probe for example, giving rise to a point cloud from which the flatness information can be extracted. We are going to see how the principal component analysis method arises naturally when the flatness estimation problem is formulated as an optimization problem.
[Read more]
subscribe via RSS