aabb_piece  R Documentation 
Calculate axisaligned bounding box (AABB) for set of game pieces with and without an “oblique projection”.
aabb_piece(
df,
cfg = getOption("piecepackr.cfg", pp_cfg()),
envir = getOption("piecepackr.envir"),
op_scale = getOption("piecepackr.op_scale", 0),
op_angle = getOption("piecepackr.op_angle", 45),
...
)
df 
A data frame of game piece information with (at least) the named columns “piece_side”, “x”, and “y”. 
cfg 
Piecepack configuration list or 
envir 
Environment (or named list) containing configuration list(s). 
op_scale 
How much to scale the depth of the piece in the oblique projection
(viewed from the top of the board).

op_angle 
What is the angle of the oblique projection? Has no effect if 
... 
Ignored 
The “oblique projection” of a set of (x,y,z)
points onto the xyplane
is (x + \lambda * z * cos(\alpha), y + \lambda * z * sin(\alpha))
where \lambda
is the scale factor and \alpha
is the angle.
A named list of ranges with five named elements x
, y
, and z
for
the axisaligned bounding cube
in xyzspace plus x_op
and y_op
for the axisaligned bounding box
of the “oblique projection” onto the xy plane.
df_tiles < data.frame(piece_side="tile_back", x=0.5+c(3,1,3,1), y=0.5+c(3,3,1,1),
suit=NA, angle=NA, z=NA, stringsAsFactors=FALSE)
df_coins < data.frame(piece_side="coin_back", x=rep(4:1, 4), y=rep(4:1, each=4),
suit=1:16%%2+rep(c(1,3), each=8),
angle=rep(c(180,0), each=8), z=1/4+1/16, stringsAsFactors=FALSE)
df < rbind(df_tiles, df_coins)
aabb_piece(df, op_scale = 0)
aabb_piece(df, op_scale = 1, op_angle = 45)
aabb_piece(df, op_scale = 1, op_angle = 90)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.