Click on a base R plot to draw a radius/height polygon for lathe_mesh().
After the second click, the preview joins the newest point to the first
point, updating the closing segment after each additional click.
Default c(0, 1). Increasing, finite radius limits for the
drawing area. Both limits must be nonnegative.
Default c(0, 1). Increasing, finite height limits for the
drawing area.
Default 0.02. Distance from radius zero within which clicks
snap to the axis, expressed as a fraction of the width of xlim. Set to
zero to disable snapping. Applies only when xlim starts at zero.
A numeric matrix with columns radius and height, ready to pass
as the profile argument of lathe_mesh(). Returns NULL if drawing is
finished with no points remaining.
Requires an interactive graphics device that supports graphics::locator().
Left-click to add vertices in boundary order. Click Undo above the plot
to remove the most recent vertex and update the preview. Undo can be used
repeatedly, including to clear the drawing; it has no effect when empty.
Finish using the device's
locator termination action: for example, Escape on Quartz, another mouse
button on X11, or Finish in RStudio. The plot uses equal X and Y scales.
Other clicks outside the supplied limits and consecutive duplicate clicks are
ignored. A dashed line marks the automatically supplied closing segment.
At least three noncollinear vertices are needed to finish a polygon. Self-intersections and retraced edges are rejected. Redundant collinear vertices are removed, and the boundary is oriented counterclockwise to produce outward-facing lathe surfaces.
For a polygon away from the axis, the first vertex is repeated at the end
so lathe_mesh() includes the closing segment. When the polygon meets the
axis, its boundary must touch it at a single vertex or along a single edge.
Axis vertices become the profile endpoints; an edge along the axis is
omitted because it does not sweep out a surface. This keeps radius-zero
vertices out of the profile interior, as required by lathe_mesh().
if (FALSE) { # interactive()
profile = draw_lathe_profile(xlim = c(0, 2), ylim = c(0, 4))
if (!is.null(profile)) {
mesh = lathe_mesh(profile)
rasterize_scene(mesh, lookfrom = c(6, 5, 8), lookat = c(0, 2, 0))
}
}