Cuts a mesh by a plane and returns either one side or both sides of the cut. The result is also previewed as an HTML widget (no Quartz/X11) with the kept side in solid color, the other side semi-transparent, and the cutting plane shown.
plyPlaneCut(
plyFile,
axis = "Z",
vertIndex = NA,
cut_value = NA,
keepBoth = FALSE,
plane = NA,
flipAxis = FALSE,
display = TRUE,
kept_col = "#3C8DFF",
other_col = "gray70",
plane_col = "firebrick",
plane_alpha = 0.35,
main = "",
widget_size_px = 768,
scene_zoom = 1.5,
leftOffset = 0,
fieldofview = 0,
title_font_size_px = 30,
title_font_family =
"system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif"
)If keepBoth = FALSE, a 'mesh3d' for the retained side.
If keepBoth = TRUE, a list with elements 'meshA' and 'meshB'.
The returned object also carries an attribute 'widget' with the
htmltools::browsable preview when display = TRUE.
An object of class 'mesh3d'.
Character, one of "X","Y","Z"; used when deriving the plane from a vertex index or a numeric cut value (ignored when 'plane' is supplied). Default "Z".
Integer index of a mesh vertex used to place an orthogonal plane through that vertex along 'axis'. Ignored if 'plane' or 'cut_value' is supplied.
Numeric coordinate along 'axis' at which to place the orthogonal plane. Ignored if 'plane' is supplied. (HTML-friendly alternative to interactive pick)
Logical; if TRUE and the plane intersects the mesh, return both sides as a list with elements 'meshA' and 'meshB'. Default FALSE.
Numeric vector c(a,b,c,d) giving a plane in ax + by + cz + d = 0 form. If provided, overrides 'axis', 'vertIndex', and 'cut_value'.
Logical; reverse the plane normal direction used to decide which side is kept when keepBoth = FALSE. Default FALSE.
Logical; if TRUE, render an HTML widget preview. Default TRUE.
Color for the kept portion in the preview (default "#3C8DFF").
Color for the other portion in the preview (default "gray70").
Color for the plane polygon in the preview (default "firebrick").
Alpha for the plane polygon (default 0.35).
Plot title (default "")
Square widget size in pixels (default 768)
Initial zoom for the 3D scene (default 1.5)
Horizontal camera nudge (-1..1 recommended) (default 0)
Field of view in degrees (0 = isometric) (default 0)
Title font size in pixels (default 30)
CSS font-family list for the title (default system UI stack)
This HTML-widget version avoids opening a native rgl window and mirrors the
device-and-layout pattern you used in your updated DNE3d. Interactive vertex
picking (select3d) isn’t supported in widget mode; supply the cut as plane,
vertIndex + axis, or cut_value + axis. The kept side selection is
controlled by the normal direction and flipAxis.