Skip to content

piecepackr v1.5.1

Compare
Choose a tag to compare
@trevorld trevorld released this 10 Aug 17:46
· 242 commits to master since this release

Breaking changes

There are no user-facing breaking changes in piecepackr's API
but the internal grid structure of the grobs drawn/returned by grid.piece(), pieceGrob(), and pmap_piece()
have been changed to make it easier to query or edit the grid graphics post initial drawing
with functions like grid::grid.get(), grid::grid.edit(), grid::grid.reorder() etc. (#205).

  • The "grob" returned by grid.piece() and pieceGrob() now has a "piece" class and "named slots" which match the arguments of grid.piece().
  • The new "piece" class grob only generates its content to draw at drawing time, one must use grid::grid.force() to view/edit its internal grob "children".
  • The internal grob layout for included grob functions are better named and structured to more easily generate a matching grid::gPath.
  • grobPoints() methods have been written for the "grob" returned by grid.piece() / pieceGrob() and the "grob" returned by pmap_piece().
  • If no unique name in .l then pmap_piece() will now generate/replace a unique name
    by concatenating piece. with a unique id if it exists or if it does not then by row number
    in order to better label the "children" of the returned gTree grob object (#223).

Deprecated functions

The following utility functions have been deprecated in favor of methods provided by the new pp_shape() object:

  • checkersGrob(c, s, t, n), use pp_shape(s, t)$checkers(n, gp=gpar(fill=c)) instead.
  • concaveGrobFn(n, t, r), use pp_shape(paste0("concave", n), t, r)$shape instead.
  • convexGrobFn(n, t), use pp_shape(paste0("convex", n), t)$shape instead.
  • get_shape_grob_fn(s, t, r, b), use pp_shape(s, t, r, b)$shape instead.
  • gridlinesGrob(c, s, t, l, n), use pp_shape(s, t)$gridlines(n, gp=gpar(col=c, lex=l)) instead.
  • halmaGrob(...), use pp_shape("halma")$shape(...) instead.
  • hexlinesGrob(c, s, n), use pp_shape(s)$hexlines(n, gp=gpar(col=c)) instead.
  • kiteGrob(...), use pp_shape("kite")$shape(...) instead.
  • matGrob(c, s, t, mw, n), use pp_shape(s, t)$mat(mw, n, gp=gpar(fill=c)) instead.
  • pyramidGrob(...), use pp_shape("pyramid")$shape(...) instead.

New features

  • New function pp_shape() returns an R6 object that provides the following methods to create
    various grobs for all the "shape"'s supported by pp_cfg():

    • shape() returns a grob of the shape.
    • mat() returns a grob of a matting "mat" within the shape.
      Its argument mat_width controls how "wide" the matting should be.
    • gridlines() returns a grob of "gridlines" within the shape.
    • checkers() returns a grob of "checkers" within the shape.
    • hexlines() returns a grob of "hexlines" within the shape.
    • polyclip() returns a grob that is an "intersection", "minus", "union", or "xor" of another grob.
      Note unlike gridGeometry::polyclipGrob it can directly work with a pieceGrob "clip grob" argument.
  • Default functions used by save_piece_obj(), piece3d(), piece() now support a
    "top", "base", "left", and "right" side for the two-sided token components:
    "bit", "board", "card", "matchstick", "pawn", "saucer", and "tile" (#135).

  • Function game_systems now returns a "meeple" configuration with "standard" meeple "bit" pieces (#232).

Bug fixes and minor improvements

  • pp_cfg() now supports a "roundrect" (rounded rectangle) shape (#214, #229).
    Curvature of the corners are controlled by the shape_r style.
  • pp_cfg() now supports a "meeple" shape (#104).
    Meeple coordinates were extracted from Meeple icon
    by Delapouite / CC BY 3.0.
  • pp_cfg() now supports setting multiple styles by using a greater-than-length-one vectors
    (as well as continuing to support previously-supported comma-separated strings).
  • The default OBJ generating function (used by the default rgl and rayrender functions)
    now produces six-faced cubes for the dice component (#186).
  • R_to_AA() now always returns an axis-angle parameterization with positive axis_z value (#219).
  • Fixes bug in R_to_AA() for some 3D rotations with an "exactly" 180 degree angle (in the axis-angle representation).
  • AA_to_R() now accepts an optional axis_z argument and automatically normalizes the axis vector.
    In particular R_to_AA(AA_to_R(...)) can now be used to normalize alternative axis-angle parameterizations
    with non-unit axis vectors and/or negative axis_z values.
  • Improved drawing of oblique projection edges for the "oval" shape (#212) and the "halma" shape (#213).
  • In oblique projection obscured edges are now drawn in case of transparent backgrounds (#221).
  • is_color_invisible() will now correctly classify as "invisible" colors with an alpha channel value set to 0.
  • The named list returned by pp_cfg()$get_piece_opt() now also contains a back value indicating whether this is a back of a piece
    (and hence for some shapes may need to be flipped across a vertical line) and a bleed_color value indicating a good
    color for a "bleed" effect (e.g. for print-and-play layouts) (#211).
  • Fixes bug in "circle" shape "mat" when drawn in a non-square grid viewport.
  • Fixes bug in op_transform() for pieces whose "shape" is a non-symmetric (across vertical axis) polygon.
  • grid.piece() and pmap_piece() now returns the grob invisibly if draw=TRUE as documented
    (while continuing to draw the grob to the active graphics device).
  • By default piece3d() will now try to infer a reasonable textype value by manually checking the png texture's alpha channel.