7th Annual Scene.org Awards

If you’re in Germany, go check out Breakpoint 2009, held from 10th to 13th April 2009. It’s when the winners of the Scene.org award nominees will be announced.

3 of the nominated demos were also featured here. Well, 2 actually. The third was discussed in an issue of the newsletter, which is “Metamorphosis” by Andromeda Software Development. Great music accompanying the melding of scenes and objects, both organic and mechanic.

As for the other 2 demos, we have “Inflorescence” by mfx.

And the 2nd demo is “The Seeker” by Still.

If you’re new to the demoscene, go to pouet and experience a few demos yourself.

[Vincent is currently on vacation. I'm his blog, taking over for a while. He never said blogging was this hard! I have new-found appreciation for my master now...]

Factorials, prime numbers and a puzzle

There is this interesting math tidbit about composite numbers and factorials by Ned Batchelder. Now prime numbers never appear consecutively (except for 2 and 3). Ned then answered this question: how many composites can appear consecutively?

His explanation involves the use of factorials, and you can read about it using the link above. His explanation also gave me something to think about…

Now the factorial of n, denoted by n! is
1*2*3*4* … *(n-1)*n
which is a product of 1 through n.

Let’s define a function F such that F(n) is the product of
(1st prime)*(2nd prime)* … * (nth prime)

For example, the first few prime numbers are 2, 3, 5, 7, 11, 13. So
F(1)=2,
F(2)=2*3=6, and
F(5)=2*3*5*7*11=2310.
This is different from factorial primes (I was actually going to name this special function “prime factorial”).

Now, n! is divisible by 2, n! is divisible by 3 and n! is divisible by 4.
F(n) is divisible by 2, F(n) is divisible by 3, but F(n) is not divisible by 4!

My question: Describe the group of numbers where F(n) cannot divide, in as plain an English as possible. This group of numbers will necessarily be between 2 and F(n)-1.

Your knee-jerk answer could be “all composite numbers between 2 and F(n)-1!”. Ahh, but F(n) is divisible by 10, and 10 is a composite number (assumption, n is a fairly large number, say greater than 5). This puzzle should be easy to figure out. Articulation of the solution into a couple of sentences might be harder…

[Vincent is currently away on vacation. He asked me, the blog, to take over for a while. Using a proprietary algorithm involving language semantics and neural networks (written by me), I came up with the blog post you've just read. It even seems coherent! I mean, uh, of course it makes sense. Oh, the things I do for my master... He'd better come back with lots of pictures for me to post, or he and I are going to have words...]

Certifications, standards or just codswallop?

Recently, I attended a 1 day course on Information Technology Infrastructure Library or ITIL. It’s just an awareness course, so I only learned what it is, what it’s used for, why it should be used and so on. Basically ITIL is a set of best practices for doing IT work.

Truth be told, I didn’t want to attend the course. Due to management targets and budget considerations, I was “strongly encouraged” to attend the course (it is the end of the financial year…). Ah well, so I did. Man, did I have to rearrange my coding deadlines… One never knows how much 1 day of coding means, till one loses that 1 day…

Anyway, I learnt what ITIL is, and what the associated ISO 20000 is too. ITIL, as my instructor mentioned, is “documented common sense“. Also, an organisation (or process) can’t be certified in ITIL, as there might be some recommendations that conflict with each other within your business scope. An individual can be ITIL certified though.

Businesses can be ISO 20000 certified. The process of certification, as I understand it, is tedious. You need documentation of processes, and you need proof that you’ve been following the standards and your own documentation. And the first thought that came to my mind was Evidence Based Scheduling and FogBugz. I talked with the instructor and he agreed that, having a system that’s part of the workflow, and that it captures proof as it goes, is the best solution. And you need at least 3 months worth of proof.

I can see 2 benefits to certification. Boost in credibility (people trust companies with certifications?) and actual improvements in financial bottom lines (whether it’s cost savings or profit).

Frankly speaking, I don’t know why I’m attending the course. That I’ll push for a more structured IT environment back at work, following ITIL recommendations? That I can be part of the certification process team? I’m a messy person. What do they think I can do?

Ok, the course wasn’t a complete loss for me. At least I learnt about the certification process. Still, I keep wondering, could the entire thing be condensed into the Joel Test?

At the team I’m working at, we’d maybe pass 3 out of the 12 points on the check list. If we can’t pass that, we can’t pass ITIL, and we certainly can’t pass ISO 20000. I’m just saying…

[Vincent is currently preparing to go to the land of the rising sun, and hopefully see sakura blossoms. Comments and responses will be slower. I'll be taking over for a while, and remember, I'm just a blog.]

Bilinear interpolation article referenced in another language

I’m thrilled. I’m also confused. I wrote an article on bilinear interpolation, specifically for image rotations, and it was provided as a link in a comment to this post. Thanks to vottini for referencing my article (it was used in a good light, right?)

I’ve got a problem. I don’t know what’s the language of the site! I think it’s French or Spanish, but I can’t be sure. If you know what’s the language, please let me know. Better yet, translate and summarise that article and tell me, because I only understood it as a example of how to expand an image and fill in the extra pixels. Thanks.

UPDATE: Thanks to an anonymous commentor, I finally found that the article (and site) is in Portuguese. I tried online translation tools and Portuguese-English yielded enough for me to understand what was going on. The commentor recommended the tool by Google, but I got barred with “automated request” error.

So I used the Babel Fish.

Excerpt of translated comment:

the solution, after all, was well simple. Instead of rotacionar pixels of the source, it rotacionava pixels of the destination and discovered in which place of the source would go to be. Joining with the technique of the bilinear interpolation or some most advanced one, the result is really impressive.

In the article, I suggested starting from the destination image, and find out what pixels to use from the source. This sort of assumes that both source and destination speak the same “language” (both are talking about RGB pixels).

The irony? In this incident, I don’t know anything about the source language (Portuguese), so I don’t know how to start from the destination (translated article in English).

UPDATE: Actually Christopher also commented that it’s in Portuguese (missed his comment in the diligent black hole SPAM processor…). Thanks Christopher!

And the owner of the site came to confirm that it’s in Portuguese! Wow. He (“o velho” means “old man” in Portuguese) apparently posted an English post about this, specially for me. Wow. Thanks.

Stationary camera, moving scene

Previously, we talked about revolving the entire 3D scene about the camera, and also the problem of the camera looking directly downwards. Today, we’ll look at the mechanics of implementing that stationary camera (it ain’t pretty).

There are 2 transformations to take care of: translation and rotation. Translation takes care of the distance between the camera and the point it’s looking at. Rotation takes care of simulating the camera turning around to look at objects, roughly speaking. Let me use a 2D version to illustrate the concept.

Reverse translation and rotation of 2D scene

Suppose the camera is at some arbitrary position looking at an object. Based on the positions of the camera and the object, you can find the distance between them. You know, with this:
d = sqrt( (cx-ox)^2 + (cy-oy)^2 )
where cx and cy are the x-coordinate and y-coordinate of the camera respectively, and ox and oy are the x-coordinate and y-coordinate of the object respectively.

The camera is looking at the object, so the angle (theta) of its line of sight with respect to the (for example) x-axis can be calculated.

Suppose we want the stationary camera to look in the direction of the positive y-axis, and be positioned at the origin (0,0). To make the scene viewed through a stationary camera the same as that in the original version (the default by the 3D engine), we would rotate the entire scene (90 – theta) degrees, then translate the result of that d units along the positive y-axis.

Remember that order of transformations is important. Rotating first then translating, is (generally) different from translating then rotating.

So that’s the general idea of making a stationary camera work, by moving and rotating the entire scene. The fun part comes because it’s in 3D.

The distance calculation still holds true:
d = sqrt(x^2 + y^2 + z^2)

The angle… not so much. Because it’s in 3D, I adopted spherical coordinates. The radius would simply be the distance calculated previously. But there are now 2 angles to calculate, theta and phi.

Spherical coordinate angles

Suppose the camera is at (a,b,c) and the viewed object is at (p,q,r). We make the viewed object the centre of our attention, so we start our calculations with the object at the origin. Therefore, the camera is at (a-p, b-q, c-r).

We can calculate the distance between them as
d = sqrt( (a-p)^2 + (b-q)^2 + (c-r)^2 )

Then we also solve for the following set of simultaneous equations (note I’m using y-axis as the “upward” axis)
x = r * sin(theta) * sin(phi)
y = r * cos(phi)
z = r * cos(theta) * sin(phi)

==>

a-p = d * sin(theta) * sin(phi)
b-q = d * cos(phi)
c-r = d * cos(theta) * sin(phi)

to look for the angles theta and phi, where
0 <= theta <= 2*PI
0 <= phi < PI

Once found, the rendering occurs by rotating the entire scene phi degrees about the positive z-axis (starting from negative y-axis as 0 degrees), then rotate about the positive y-axis (starting from the positive z-axis as 0 degrees), then translate by (-a,-b,-c) (this moves the entire scene away from the camera positioned at the origin).

Well, that was a lot of trouble. What was I trying to solve again? Oh yeah, that looking down and losing the “up” vector problem. Notice anything wrong in this implementation? The “up” vector of the camera was never considered.

But figuring out all the math was fun… if only it solved something too… *sigh*

[Note: all use of "degrees" in this article can be substituted with "radians", depending on your situation. Use accordingly.]