obj_fns: Alternative Wavefront OBJ file generators

save_ellipsoid_objR Documentation

Alternative Wavefront OBJ file generators

Description

These are alternative Wavefront OBJ generators intended to be used as a obj_fn attribute in a pp_cfg() “configuration list”. save_ellipsoid_obj saves an ellipsoid with a color equal to that piece's background_color. save_peg_doll_obj saves a “peg doll” style doll with a color equal to that piece's edge_color with a “pawn belt” around it's waste from that suit's and rank's belt_face.

Usage

save_ellipsoid_obj(
  piece_side = "bit_face",
  suit = 1,
  rank = 1,
  cfg = getOption("piecepackr.cfg", pp_cfg()),
  ...,
  x = 0,
  y = 0,
  z = 0,
  angle = 0,
  axis_x = 0,
  axis_y = 0,
  width = NA,
  height = NA,
  depth = NA,
  filename = tempfile(fileext = ".obj"),
  subdivide = 3
)

save_peg_doll_obj(
  piece_side = "pawn_top",
  suit = 1,
  rank = 1,
  cfg = getOption("piecepackr.cfg", pp_cfg()),
  ...,
  x = 0,
  y = 0,
  z = 0,
  angle = 0,
  axis_x = 0,
  axis_y = 0,
  width = NA,
  height = NA,
  depth = NA,
  filename = tempfile(fileext = ".obj"),
  res = 72
)

Arguments

piece_side

A string with piece and side separated by a underscore e.g. "coin_face"

suit

Number of suit (starting from 1).

rank

Number of rank (starting from 1)

cfg

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().

...

Ignored.

x

Where to place piece on x axis of viewport

y

Where to place piece on y axis of viewport

z

z-coordinate of the piece. Has no effect if op_scale is 0.

angle

Angle (on xy plane) to draw piece at

axis_x

First coordinate of the axis unit vector.

axis_y

Second coordinate of the axis unit vector.

width

Width of piece

height

Height of piece

depth

Depth (thickness) of piece. Has no effect if op_scale is 0.

filename

Name of Wavefront OBJ object.

subdivide

Increasing this value makes for a smoother ellipsoid (and larger OBJ file and slower render). See ellipse3d.

res

Resolution of the faces.

See Also

See pp_cfg() for a discussion of “configuration lists”. Wavefront OBJ file generators are used by save_piece_obj() and (by default) piece3d() (rgl wrapper), piece() (rayrender wrapper), and piece_mesh() (rayvertex wrapper).


trevorld/piecepack documentation built on Jan. 19, 2024, 5:41 a.m.