view_srep: s-rep viewer

View source: R/sreps.R

view_srepR Documentation

s-rep viewer

Description

Plots a skeletal representation (s-rep) object based on its three-dimensional base, spokes, and boundary.

Usage

view_srep(base, dirs, bdry, radii, show_base = TRUE, show_base_pt = TRUE,
  show_bdry = TRUE, show_bdry_pt = TRUE, show_seg = TRUE,
  col_base = "red", col_bndy = "blue", col_seg = "green",
  static = TRUE, texts = NULL, cex_base = ifelse(static, 0.5, 6),
  cex_bdry = ifelse(static, 1, 8), lwd_seg = ifelse(static, 1, 2),
  cex_texts = 1, alpha_base = 0.1, alpha_bdry = 0.15, r_texts = 1.25,
  alpha_ashape3d_base = NULL, alpha_ashape3d_bdry = NULL, lit = FALSE,
  ...)

Arguments

base

base points, a matrix of size c(nx, 3).

dirs

directions of spokes, a matrix of size c(nx, 3) with unit vectors.

bdry

boundary points, a matrix of size c(nx, 3).

radii

radii of spokes, a vector of size nx.

show_base, show_base_pt

show base and base grid? Default to TRUE.

show_bdry, show_bdry_pt

show boundary and boundary grid? Default to TRUE.

show_seg

show segments? Defaults to TRUE.

col_base, col_bndy, col_seg

colors for the base, boundary, and segments. Default to "red", "blue", and "green", respectively.

static

use static (scatterplot3d) or interactive (plot3d) plot? Default to TRUE.

texts

add text labels? If given, it should be a vector of size nx with the labels. Defaults to NULL.

cex_base, cex_bdry

size of the base and boundary points.

lwd_seg

width of the segments.

cex_texts

size of the text labels. Defaults to 1.

alpha_base, alpha_bdry

transparencies for base and boundary. Default to 0.1 and 0.15, respectively.

r_texts

magnification of the radius to separate the text labels. Defaults to 1.25.

alpha_ashape3d_base, alpha_ashape3d_bdry

alpha parameters for ashape3d. Default to NULL.

lit

lit parameter passed to material3d. Defaults to FALSE.

...

further arguments to be passed to plot3d or scatterplot3d.

Value

Creates a static or interactive plot.

Examples

base <- r_unif_polysph(n = 50, d = 2)
dirs <- base
radii <- runif(nrow(base), min = 0.5, max = 1)
bdry <- base + radii * dirs
view_srep(base = base, dirs = dirs, bdry = bdry, radii = radii,
          texts = 1:50, xlim = c(-2, 2), ylim = c(-2, 2), zlim = c(-2, 2))

polykde documentation built on April 16, 2025, 1:11 a.m.