|
|
Peter Popov wrote:
> > // supposing that 'Direction' actually is a unit vector
>
> Or if it's not:
>
> #macro Dist(RayOrigin, Direction, Point)
> #local Dir=vnormalize(Direction);
> ((Point.x-RayOrigin.x)/Dir.x)
> #end
>
Will try this - actually this is for part of a patch (ParticlePatch)
Chris Huff wrote:
> I think you are looking for the distance between two points. In POV
> scenes, just use vlength(PtA-PtB). If in a POV patch, I think there is a
> VDist() macro.
> If in something else, it can be implemented like this:
>
> double vdist(double x, double y, double z, double a, double b, double c)
> { return sqrt(sqr(x-a) + sqr(y-b) + sqr(z-c));}
>
> Of course, you should probably use some kind of vector data type to
> simplify things.
>
> This gives you the distance, the direction(+/-) should be pretty easy to
> figure out.
I tried using VDist & the result is always positive because -ve * -ve = +ve
Thanks all
Pabs
Post a reply to this message
|
|