![]() Home Overview FAQ Documentation Download Mailing List Geomview For Windows? Support Users Development Bug Reporting Contributing Contact Us Sponsors
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [burchard: HPt3SubPt3()]
In the following function from
/u/gcg/ngrap/src/lib/geometry/hpoint3/hpoint3.c,
it seems like there is a both a sign error and a division by zero in
the case that p2->w == 0. The division by zero will also bomb the
case when p1->w == p2->w and both are zero (which should just
result in vector subtraction).
void
HPt3SubPt3(register HPoint3 *p1, register HPoint3 *p2, register
Point3 *v)
{
if(p1->w == p2->w) {
v->x = p1->x - p2->x; v->y = p1->y - p2->y; v->z = p1->z -
p2->z;
} else if(p1->w == 0) {
*v = *(Point3 *)p1;
return;
} else if(p2->w == 0) {
*v = *(Point3 *)p2;
} else {
float s = p2->w / p1->w;
v->x = p1->x*s - p2->x; v->y = p1->y*s - p2->y; v->z =
p1->z*s - p2->z;
}
if(p2->w != 1)
v->x /= p2->w, v->y /= p2->w, v->z /= p2->w;
}
|
||
|
Home | Overview | FAQ | Documentation | Support | Download | Mailing List Windows? | Development | Bug Reporting | Contributing | Contact Us | Sponsors |
|||
|
site hosted by |
|||