Learn R Programming

isocubes (version 1.0.0)

calc_visibility: Calculate indices of visible voxels when rendered from the specified view.

Description

Returned value is depth-sorted in back-to-front rendering order

Usage

calc_visibility(
  coords,
  xyplane = "flat",
  handedness = "right",
  value = "index",
  verbosity = 0,
  ...
)

Value

if value argument is 'index' then integer vector of visible vertices in back-to-front draw ordering. For value = 'full' return a data.frame with more complete information.

Arguments

coords

data.frame of x,y,z coordinates for the cubes (integer coordinates)

xyplane

How is the xyplane oriented with respect to the unit isometric cube?. "left", "right", "flat" (or "top"). Default: "flat".

handedness

How is the z-axis positioned with respect to the xy-plane? I.e. is this a right-handed or left-handed coordinate system? Default: "right"

value

type of value to return. Default: 'index'. Valid values are 'index' and 'full'. If 'index', then returns an integer vector of which rows to render in back-to-front ordering. 'full' returns more information in a data.frame

verbosity

Verbosity level. Default: 0

...

other values passed to gpar() to set the graphical parameters e.g. lwd and col for the linewidth and colour of the outline stroke for each cube face.

Examples

Run this code
obj_sphere <- gen_sphere()
nrow(obj_sphere)
calc_visibility(obj_sphere) |>
   length()
   
calc_visibility(obj_sphere, value = 'full') |>
   head()

Run the code above in your browser using DataLab