op_transform() guesses z coordinates and
sorting order to more easily
make 3D graphics with pmap_piece().
marbles_transform() is a wrapper around op_transform() that handles the special case
of stacking 1" marbles in a pyramid with a square base on a holed board.
Arguments
- df
A data frame with coordinates and dimensions in inches
- ...
Ignored by
op_transform().marbles_transform()passes toop_transform().- cfg
Piecepack configuration list or
pp_cfg()object, a list ofpp_cfg()objects, or a character vector of the names ofpp_cfg()objects contained inenvir.- envir
Environment (or named list) containing configuration list(s).
- op_angle
Intended oblique projection angle (used for re-sorting)
- pt_thickness
Thickness of pyramid tip i.e. value to add to the z-value of a pyramid top if it is a (weakly) smaller ranked pyramid (top) placed on top of a larger ranked pyramid (top).
- as_top
Character vector of components whose “side” should be converted to “top” e.g.
"pawn_face".- cfg_class
Either
"list"(default) or"character". Desired class of thecfgcolumn in the returned tibble."list"is more efficient for use withpmap_piece()butgeom_piece()needs"character".
Details
The heuristics used to generate guesses
for z coordinates and sorting order
aren't guaranteed to work in every case.
In some cases you may get better sorting results
by changing the op_angle or the dimensions of pieces.
See also
https://trevorldavis.com/piecepackr/3d-projections.html for more details
and examples of oblique projections in piecepackr.
Examples
df <- tibble::tibble(piece_side="tile_back",
x=c(2,2,2,4,6,6,4,2,5),
y=c(4,4,4,4,4,2,2,2,3))
cfg <- game_systems()$piecepack
pmap_piece(df, op_angle=135, trans=op_transform,
op_scale=0.5, default.units="in", cfg=cfg)