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.
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
)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.
An object that stores the output of OPC()
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).
Logical; draw patch boundary outlines on the mesh (default FALSE)
Color for patch outlines (default "black")
Logical; color discarded/small patches black in the mesh (default FALSE)
Logical; show a right-hand legend (default TRUE)
Character; plot title (default "")
Numeric; relative size multiplier for legend text (default 1)
Logical; scale legend pie wedges by patch counts (default FALSE)
Color for legend text (default "black")
Color for legend ring/lines (default "black")
Numeric (-1..1); small horizontal camera nudge (default 0)
Numeric; field of view in degrees; 0 = isometric (default 0)
Integer; square size of the 3D widget in pixels (default 768)
Numeric; initial zoom on the 3D scene (default 1.5)
Integer; title font size in pixels (default 30)
CSS font-family for title/legend (default system UI stack)
Numeric; additional legend scale factor (default 1)
Character or NA; if non-NA, write a colored *.ply to disk (default NA)
Logical; write PLY as binary (default FALSE, i.e., ascii)
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.
# 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