[Bf-committers] RE_rayobject_raycast divide by zero
André Susano Pinto
andresusanopinto at gmail.com
Wed Feb 3 21:48:44 CET 2010
Yes it was intentional (if i recall correctly)
its only used to calculate bv_indexs (only signal matters)
and then its used on raycasting against BB but by using code that deals well
with that.
On 3 February 2010 14:28, Campbell Barton <ideasman42 at gmail.com> wrote:
> noticed RE_rayobject_raycast will often divide by zero, perhaps this
> is ok but seems like it could lead to problems,
> is this intentional?
>
> ---- rayobject.cpp:383
> isec->idot_axis[i] = 1.0f / isec->vec[i];
> ----
>
> int RE_rayobject_raycast(RayObject *r, Isect *isec)
> {
> int i;
> RE_RC_COUNT(isec->raycounter->raycast.test);
>
> /* Setup vars used on raycast */
> isec->dist = len_v3(isec->vec);
>
> for(i=0; i<3; i++)
> {
> isec->idot_axis[i] = 1.0f / isec->vec[i];
>
> isec->bv_index[2*i] = isec->idot_axis[i] < 0.0 ?
> 1 : 0;
> isec->bv_index[2*i+1] = 1 - isec->bv_index[2*i];
>
> isec->bv_index[2*i] = i+3*isec->bv_index[2*i];
> isec->bv_index[2*i+1] = i+3*isec->bv_index[2*i+1];
> }
>
> --
> - Campbell
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>
More information about the Bf-committers
mailing list