Re: [R] distance to eye in persp()

From: Robin Hankin <>
Date: Tue 20 Sep 2005 - 00:15:07 EST


> You can probably just do what trans3d does, but keep the
> z-coordinate, to get a reasonable measure of depth. i.e.
> depth3d <- function(x,y,z, pmat) {
> tr <- cbind(x, y, z, 1) %*% pmat
> return(tr[,3]/tr[,4])
> }

fantastic! This is exactly what I was looking for.

> This is sufficient for doing fog calculations. For perspective
> shrinkage, you'll need to say where the user's eye is in these
> coordinates (or just use depths as distances).

I was going to use hsv(h=1, v=1, s=exp(d/d0) )

(some people believe that red light [ie hsv(h=1, ....)] penetrates further
through mist than other colours. I can now test this !-)

The other idea I had was to plot points with less than the median depth with big symbols and the others with small symbols. That would seem to be a nice nonparametric way to do it. Any other ideas?

very best wishes to everyone



Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Wed Sep 21 02:38:46 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:21:38 EST