Constructs a narrow ribbon that follows a three-dimensional parametric curve. The ribbon is based on the Frenet-Serret frame of the curve, computed numerically along a set of sample points. The ribbon extends a small distance in the normal direction of the curve, producing a thin band that helps visualize how the curve bends and twists in space.
osculating_ribbon3d(
X,
Y,
Z,
a,
b,
h = 1e-04,
plot = FALSE,
n_t = 400,
n_u = 25,
u_max = 1,
colorscale = "Blues",
opacity = 0.35,
show_curve = TRUE,
show_centers = TRUE,
curve_line = list(color = "black", width = 2),
centers_line = list(color = "red", width = 2),
show_surface_grid = TRUE,
surface_grid_color = "rgba(60,80,200,0.25)",
surface_grid_width = 1,
show_axis_grid = FALSE,
scene = list(aspectmode = "data", xaxis = list(title = "x(t)"), yaxis = list(title =
"y(t)"), zaxis = list(title = "z(t)")),
bg = list(paper = "white", plot = "white"),
lighting = list(ambient = 1, diffuse = 0.15, specular = 0, roughness = 1, fresnel = 0),
tol = 1e-10
)A list with two components:
dataA tibble containing the sampled parameter values, the coordinates of the curve, and the corresponding tangent, normal and binormal directions.
plotA plotly object if plot = TRUE, otherwise
NULL.
Functions returning the coordinate components of the curve as
functions of the parameter t.
Numeric values giving the endpoints of the parameter interval.
Step size used in the finite-difference approximations.
Logical; if TRUE, produces a 3D visualization of the
ribbon using plotly.
Number of sample points along the curve.
Number of subdivisions across the width of the ribbon.
Half-width of the ribbon, measured in units of the normal direction.
Character string giving the plotly colorscale used for the ribbon surface.
Numeric value between 0 and 1 controlling the transparency of the ribbon.
Logical; if TRUE, draws the base curve.
Logical; if TRUE, draws the centerline joining
the midpoints of the ribbon cross-sections.
List with plotly style options for the base curve.
List with plotly style options for the centerline.
Logical; if TRUE, draws a grid on the
surface of the ribbon.
Character string giving the color of the grid lines on the ribbon.
Numeric value giving the width of the surface grid lines.
Logical; if TRUE, displays gridlines on the
coordinate axes in the plotly scene.
List with 3D scene settings for the plotly figure.
List defining the background colors of the figure, typically
with entries paper and plot.
List with lighting settings for the surface in plotly.
Numeric tolerance used to detect numerical instabilities when computing the derivative-based frame vectors.
The function samples the curve at n_t points and computes the
numerical tangent, normal and binormal directions using finite-difference
approximations of the derivatives. At each sampled point, a short segment
is taken in the normal direction to define the width of the ribbon. These
segments are interpolated across the curve and subdivided according to
n_u to produce a mesh that represents the ribbon surface.
Optionally, the function can display the ribbon in an interactive 3D plot using plotly. The base curve, the centerline, and optional grid lines on the ribbon surface can be shown or hidden independently.
X <- function(t) cos(t)
Y <- function(t) sin(t)
Z <- function(t) 0.2 * t
osculating_ribbon3d(X, Y, Z, a = 0, b = 4*pi, plot = FALSE)
Run the code above in your browser using DataLab