QtRay (Step 2)

Today I've tried to make my QLineF3d class, but I find something that don't let me finish it.

I tried to make this class reading the code of QLineF that comes with the Qt distribution but one more time the math part kill me. When I tried to convert to 3d all the methods (or almost the main methods of the two dimensional class) I realised that I don't know how to build a line in 3d in polar cordinates... Should be Spherical coordinates? Or Cilindrical coordinates? (I mean, two angles an the lenght of the line or one angle, one height and one lenght?).

The problems appears again with the angles, I have clear how to define angles between two dimensional lines but... in 3d? two angles? the 3d angle between the lines? If I use the last approach should I give the plane that holds the lines?

Reading the Qt code I found things that I don't want to do. Some referent to the style, like define the function with variables named diferent than the ones in the implemention and something like that ( maybe I'll send a patch to the Qt guys) . And some releated to speed of the maths, I found that they use a function from graphics gems III to make intersection between a segment and a point. I'm not really sure but I thing that I've read somewhere better ways to do that (I have to search in my books, in codepixel list , in google....)

I have also some things that I should use. Some friends talk me every day about tests. I know that are usefull, I had the oportunity to "test the test" in work and its great to catch the bugs. I'm not using any test but I should do it. For the math parts will be really usefull, so propably I'll spend part of the weekend looking for testing tools for C++, learning how to use them, and reading details about math problems. I'll try to have on monday a the QLineF3d class finished. Then probably I'll try to make my camera class and start studing what I'll use to store the data.

Like in AC/DC the song.... "It's a long way to the top if you wanna rock and roll" :D

Comentarios

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.

Hi Manolo! I'm using

Hi Manolo! I'm using UnitTest++ as a unit testing framework, and it works really well. It doesn't integrate into QT at all, though, so if you want that, you might want to try another one.

About your QPoint3D and QLine3D... I say you probably won't need so much work to get started. If you try to add every possible method from the start, you'll end up with lots of methods you'll never use, and you'll still need some methods you hadn't thought of. Myself, I just create a minimal Line class, and I add new methods as I need them :)

By the way, to get started with raytracing, I recommend you take a look at the Physically Based Rendering book and its raytracer: pbrt. Very approachable book and code ;) As an example, geometry-related code in pbrt ;) http://github.com/mmp/pbrt-v1/blob/217445c2eaafd63b7ecf5fd7a5b7ed01bad50...

Good luck ;)

Christian Louboutin

great information you write it very clean. I am very lucky to get this tips from you.

QTestLib

Take a look at QTestLib.

 

See ya!