[R] distance to eye in persp()

Robin Hankin r.hankin at noc.soton.ac.uk
Mon Sep 19 16:15:07 CEST 2005


> 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  
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

More information about the R-help mailing list