18_rectangular_grids: Regularly-Spaced Grids

Description Usage Arguments Details Value See Also Examples

Description

Regularly-spaced or semi-regularly-spaced grids.

These functions take two vectors and a matrix.
For more general "grids", you can use the Grid and VImage functions, which take three matrices.

NOTE:
INTERNAL STRUCTURE OF OBJECTS IS SUBJECT TO CHANGE.
DO NOT USE SLOTS, DIRECTLY.

Usage

1
2
3
4
rectGrid (x, y, gv=NULL, ..., glist = list (),
    vlist=NULL)
rectVImage (x, y, gv=NULL, ..., tf=FALSE,
    colm, glist = list () )

Arguments

x, y

Equal length (ascending or descending) numeric vectors, giving the grid points, in x and y directions.

gv

A numeric matrix, giving the "z" value at each "x" and "y" pair.
If null, a 2D grid is greated.
Can also be a scalar value, but this is mainly for testing and demo purposes.

glist, vlist

Argument lists of graphical parameters using in the plotting functions.
glist applies to all polygons, in vlist the elements should be matrices, where each value is applied to separate polygons.

tf

Logical, transpose and flip gv, for rendering raster-style images, using the standard coordinate system.

colm

A character matrix, of colors.

...

Ignored.

Details

Note that vlist and colm arguments should have dimensions one less than the nrow/ncol of gv.

Value

A Grid or VImage object.

See Also

Grid, VImage

as.Grid
Which can be used on FGrid-class objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library (png)

#adapted from png package
im0 <- readPNG (system.file ("img", "Rlogo.png", package="png") )

#standard raster object
colm <- as.raster (im0)
headt (colm)

#smaller version
I <- seq (1, nrow (colm), 5)
J <- seq (1, ncol (colm), 5)
colm <- colm [I, J]
headt (colm)

#VImage
x <- seq (-1, 1,, ncol (colm) + 1)
y <- seq (-1, 1,, nrow (colm) + 1)
v <- rectVImage (x, y, 0, tf=TRUE, colm=colm)

if (interactive () )
    spin3d (v %]*% brot3x (pi / 4), t=10)

vectools documentation built on June 7, 2021, 9:08 a.m.