[R] vector field from a 3D scalar field

2013-03-21 Thread Waichler, Scott R
I have a 3D field of a scalar variable (x, y, z, value).  Is there a way to 
generate a vector field from this data--gradient at defined points?  I found 
the rasterVis package for 2D data, but as yet nothing for 3D data.

Thanks,
Scott Waichler
Pacific Northwest National Laboratory
Richland, WA
scott.waich...@pnnl.gov

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] vector field from a 3D scalar field

2013-03-21 Thread David Winsemius

On Mar 21, 2013, at 4:40 PM, Waichler, Scott R wrote:

 I have a 3D field of a scalar variable (x, y, z, value).  Is there a way to 
 generate a vector field from this data--gradient at defined points?  I found 
 the rasterVis package for 2D data, but as yet nothing for 3D data.

Can't you just think of 'value' as a potential and then differentiate (using 
sweep?) along the three principal axes to construct the partial derivatives 
(eg. diff(value)/diff(x) at constant y and z)  which would then form the 
components of the vector field? That's how one goes from gravitational or 
electrical potential to the corresponding vector fields. E - grad(V),

As always: Data would help clarify.

-- 
David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.