[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Openexr-devel] Request for trivial addition?
From: |
E. Scott Larsen |
Subject: |
[Openexr-devel] Request for trivial addition? |
Date: |
Fri, 24 Jan 2003 21:35:19 -0500 (EST) |
As I was flipping through the code this afternoon to get a look at the
usefulness of it all, I was struck by the <object>::intersect(Line3....)
functions (specifically in Imath/ImathSphere.h and Imath/ImathPlane.h).
For the plane, there are two:
bool Plane::intersect(const Line3<T>&, Vec3<T>&)const;
bool Plane::intersectT(const Line3<T>&, T&)const;
the first passes back the point of intersection and the second the
distance along the line of the intersection. Good. For the sphere, there
is only one:
bool Sphere::intersect(const Line3<T>&, Vec3<T>&)const;
which finds the point of intersection. The distance along the line is
sure useful though. Yea, distance from a point to a point will give that,
but that's costly, and the dumb thing then would be that the distance is
already computed! Implementation of Sphere::intersect() looks like this:
{
//find the distance along the line of the intersection, call it t
//get the point via the nice line(t) call
}
So, would it be possible to add an additional function:
bool Sphere::intersectT(const Line3<T>&, T&)const;
which is implemented exactly like the other one, except it doesn't do the
last step and passes t back instead of the point? This is exactly what
the Plane code does (identical copy, just omits the last line).
This should take 48 seconds, and I can give you a patch if you want, any
format you like (whoever you is).
Thanks!
//Scott