Friday, January 05, 2007

Rotations

I didn't have time or motivation lately to talk about the things I am doing but today I wanted to mention something because I think it will make your life a little more exciting (that's assuming you like adding eye-candy to your applications).

Andreas and I were talking yesterday and to my great surprise he mentioned that not everyone can do 3D math in their heads. Furthermore he insisted that some people might have a problem with using QTransform::quadToQuad method which I added as a convenience method to the QTransform class. He went as far as to say that some people might not know how to transform one quad into another in 3D space. Of course in no way do I believe him, but after a short discussions we decided that adding QTransform::rotate(qreal angle, Qt::Axis axis) method to QTransform which lets one rotate an object about any arbitrary axis (X, Y and Z) would help some people.
I'm swamped with work so Samuel took this task of me and implemented that method today.

Anyway, if you quickly need to add some nice effects to your application without feeling like doing any work just use QTransform::rotate and blow people's mind ;) A short Ogg movie showing qtransform2 (you'll of course need the latest Qt snapshot to compile it) in action is here and it looks like this:

5 comments:

Anonymous said...

Hi Zack,

The .ogg file gives me a 403 :(

We all hope that you're feeling a little more motivated at a later date as hearing about the stuff you're working on is always a treat :)

Anonymous said...

Great rocking Zack !!

Thank you.

Anonymous said...

good thing you keep adding even the most useless of features to a library. it means that eventually only useful features will be left to implement. i'm just waiting for a particle system in qt so that we can implement our closeEvents in QWidgets by making them explode into a cloud of pixels. *sigh*

Zack said...

@last anonymous: QMatrix, which is being replaced by QTransform, already has a rotate method. We just extended it to allow rotating by arbitrary axis. So I guess what you arguing is that this whole vector graphics stuff. where rotations are actually at the core, this Qt library is doing is pretty useless. It's definitely one opinion - good news is that you can email qt-bugs and point out that you're writing push button simulator (or something along those lines) and don't need vector graphics and all those other widgets that Qt provides and since you don't use them they obviously all should be removed.

Anonymous said...

Sorry to comment on an old post: how hard would it be to apply rotations to a pre-existing widget? For example, providing a container widget that can be "flipped" to show the other side (e.g. the configuration for the front widget). As it would be just a container, it would be reusable for anything (picture thumbnails, slide previews, etc.)

The desktop widgets in MacOSX do something similar, but I was thinking of doing it in the middle of a (KDE) application.

Can QMatrix do this already?