Learn R Programming

molaR (version 6.0)

OPC3d: Plot results of OPC analysis of a surface (3D HTML widget; numbered legend; distinct colors)

Description

Produces a three-dimensional rendering of face orientation on a surface and returns an HTML widget with a clean, numbered pie legend Wedges can be scaled by patch counts. Default colors emphasize clarity.

Usage

OPC3d(
  OPC_File,
  binColors = NULL,
  patchOutline = FALSE,
  outlineColor = "black",
  maskDiscard = FALSE,
  legend = TRUE,
  main = "",
  cex = 1,
  scaleLegend = FALSE,
  legendTextCol = "black",
  legendLineCol = "black",
  leftOffset = 0,
  fieldofview = 0,
  widget_size_px = 768,
  scene_zoom = 1.5,
  title_font_size_px = 30,
  title_font_family =
    "system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
  legend_magnify = 1,
  fileName = NA,
  binary = FALSE
)

Value

  • Interactive: an htmltools-browsable object (title, 3D widget, legend).

  • Non-interactive: (invisibly) a list with class "OPC3d_spec" containing: title, bin_colors, face_colors, bin_sizes, bin_labels, legend, scaled.

Arguments

OPC_File

An object that stores the output of OPC()

binColors

Optional character vector of colors for each directional bin. If not supplied, a high-contrast set is generated automatically (Okabe–Ito <= 12 bins; vivid HCL rainbow for more).

patchOutline

Logical; draw patch boundary outlines on the mesh (default FALSE)

outlineColor

Color for patch outlines (default "black")

maskDiscard

Logical; color discarded/small patches black in the mesh (default FALSE)

legend

Logical; show a right-hand legend (default TRUE)

main

Character; plot title (default "")

cex

Numeric; relative size multiplier for legend text (default 1)

scaleLegend

Logical; scale legend pie wedges by patch counts (default FALSE)

legendTextCol

Color for legend text (default "black")

legendLineCol

Color for legend ring/lines (default "black")

leftOffset

Numeric (-1..1); small horizontal camera nudge (default 0)

fieldofview

Numeric; field of view in degrees; 0 = isometric (default 0)

widget_size_px

Integer; square size of the 3D widget in pixels (default 768)

scene_zoom

Numeric; initial zoom on the 3D scene (default 1.5)

title_font_size_px

Integer; title font size in pixels (default 30)

title_font_family

CSS font-family for title/legend (default system UI stack)

legend_magnify

Numeric; additional legend scale factor (default 1)

fileName

Character or NA; if non-NA, write a colored *.ply to disk (default NA)

binary

Logical; write PLY as binary (default FALSE, i.e., ascii)

Details

Run OPC() first to compute patches and directional bins.

Legend Wedges are numbered (1..N) and can be scaled to patch counts.

Saving a PLY When fileName is provided, a colorized PLY is written. Colors are assigned per face via a vertex-duplication strategy so external tools (e.g., MeshLab) show the same appearance. For ascii PLY, a comment line notes the generator/version.

Examples

Run this code
# OPC_out <- OPC(Tooth)
if (interactive()) {
  OPC3d(OPC_out, legend = TRUE, scaleLegend = TRUE,
        main = "OPC -- Numbered Bins")
}

Run the code above in your browser using DataLab