Qt

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

QtRay (Step 1)

I always wan't to make my own raytracer. I have the oportunity in the university, but the raytracer that I want to do then was bigger than the one that I need to do for the university so I get out of time (and didn't pass that assignment). So after reading a lot about realtime raytracers in Codepixel and in Jon Valdes blog I decided to make a really small raytracer.

The first step was remember all about math. I ned to remember what I have to do to know if a ray intersects a triangle. There a lot of methods about it, and a lot of changes to make it faster using sse instructions and stuff like that. But I need the earlier and easiest way. So I get my "Collision detection in interactive 3d enviroments" and I read the easy way to do that. The easy way use Cramer's method to solve an ecuations system. And I didn't remember how It works. So I spend one full night to understand all of this. If someone wants more information about the other methods you can take a look to Codepixel Wiki entry about it. I'll probably talk about all the math stuff when I'll do it in code but today I only wan't to give an overview of what I have now.

I also need more information on how to transform the screen positions into world positions to calculate the ray, after some time trying to figure how to do that. I asked to Jon Valdes and he send me to an old post in codepixel mailing list where he ask the same thing. I've read Alex Méndez answer and I get the solution.

The next thing to solve was a technological problem, what to use? OpenGL? Qt? in which language? C? C++? Ruby? Other? Finally I'm quite sure to do it in C++ with Qt. So I start again to make some test to remember how Qt works. (You know hello world tutorial and something like that).

Ok when I thougth that I can begin with the math part in code, and make appear a white plane on my screen, I found another problem. Qt don't have a 3 dimensional point into their classes. So using the code of QPointF I'll start to make a QPointF3d. And that's my actual state.

I'll try to do something every day (at least a few lines and a post) tomorrow (or even tonight) I'll try to make another class QLineF3d to hold ray's informations.

Distribuir contenido