[ODE] ODE Tutorial
Jon Watte (ODE)
hplus-ode at mindcontrol.org
Thu Aug 16 17:15:50 MST 2007
Yes, that code is totally buggy, and in fact would emit a warning on
many modern compilers.
The intention is to calculate the union of two axis-aligned bounding
boxes, so the innermost variable called "aabb" should really be called
"aabb2" and the code should say:
for (int i=0;i<3;++i) {
aabb[i] = min(aabb[i],aabb2[i]);
aabb[3+i]=max(aabb[3+i],aabb2[3+i]);
}
Given that you were confused by the obviously bad code, you should have
trusted your instincts and realized that it's a bug. In general, I've
found that tutorials on the Internet are often written by people with
more good will than actual experience -- in fact, you often see
statements like "I figured I should learn library X while learning
language Y, so I wrote a tutorial as a way of learning."
You should mail the tutorial author and let him know about the bug, btw.
Cheers,
/ h+
Morten Hoide wrote:
> In the ODE tutorial :
> http://artis.imag.fr/Membres/Xavier.Decoret/resources/ode/tutorial1.html
> theres this piece of code:
>
> for (int i=0;i<3;++i)
> {
> aabb[i] = min(aabb[i],aabb[i]);
> aabb[3+i]=max(aabb[3+i],aabb[3+i]);
> }
>
> I really dont get the purpose of that ! What is it good for ? Isn't
> min(x,y) returning the smaller value of x and y ?
> Because in the tutorial it is used with 2 times the same value, what
> is quite confusing..... ?
>
> Thx, Marten
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ODE Tutorial
> :http://artis.imag.fr/Membres/Xavier.Decoret/resources/ode/tutorial1.html
> in tutorial C in the viewer.cpp file theres this piece of code:
>
>
>
> ------------------------------------------------------------------------
> Wissenswertes für Bastler und Hobby Handwerker. *BE A BETTER
> HEIMWERKER!*
> <http://de.rd.yahoo.com/evt=48734/*http://de.promotions.yahoo.com/clever/be-a-better/heimwerker.html>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
More information about the ODE
mailing list