piece creates 3d board game piece objects for use with the rayrender package.

piece(
piece_side = "tile_back",
suit = NA,
rank = NA,
cfg = getOption("piecepackr.cfg", pp_cfg()),
x = 0,
y = 0,
z = NA,
angle = 0,
axis_x = 0,
axis_y = 0,
width = NA,
height = NA,
depth = NA,
envir = getOption("piecepackr.envir"),
...,
scale = 1,
res = 72
)

## Arguments

piece_side A string with piece and side separated by a underscore e.g. "coin_face" Number of suit (starting from 1). Number of rank (starting from 1) Piecepack configuration list or pp_cfg object, a list of pp_cfg objects, or a character vector referring to names in envir or a character vector referring to object names that can be retrieved by base::dynGet(). Where to place piece on x axis of viewport Where to place piece on y axis of viewport z-coordinate of the piece. Has no effect if op_scale is 0. Angle (on xy plane) to draw piece at First coordinate of the axis unit vector. Second coordinate of the axis unit vector. Width of piece Height of piece Depth (thickness) of piece. Has no effect if op_scale is 0. Environment (or named list) containing configuration list(s). Ignored. Multiplicative scaling factor to apply to width, height, and depth. Resolution of the faces.

## Value

A rayrender object.

See https://www.rayrender.net for more information about the rayrender package. See geometry_utils for a discussion of the 3D rotation parameterization.

## Examples

  # \donttest{
if (require("rayrender")) {
cfg <- game_systems("sans3d")\$piecepack
render_scene(piece("tile_face", suit = 3, rank = 3, cfg = cfg))
render_scene(piece("coin_back", suit = 4, rank = 2, cfg = cfg))
render_scene(piece("pawn_face", suit = 2, cfg = cfg))
}