For a three-dimensional parametric curve, this function constructs numerical approximations to the osculating circles (and associated discs) at a set of parameter values. At each requested point on the curve, it approximates the Frenet frame and the curvature, and then uses this information to define the center and radius of the local osculating circle. Optionally, it can display these circles or discs in an interactive 3D visualization using plotly.
osculating_circle3d(
X,
Y,
Z,
a,
b,
t_points,
h = 1e-04,
plot = FALSE,
n_samples = 400,
fill = c("disk", "ring"),
ru = 24,
rv = 72,
colorscale = "Reds",
opacity = 0.6,
ring_line = list(color = "red", width = 4, dash = "solid"),
show_curve = TRUE,
show_points = TRUE,
curve_line = list(color = "blue", width = 2, dash = "solid"),
point_marker = list(color = "black", size = 3, symbol = "circle"),
show_radius = FALSE,
radius_phase = 0,
radius_line = list(color = "orange", width = 5, dash = "solid"),
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 with columns
t, x, y, z, kappa, cx, cy, cz, radius,
Tx, Ty, Tz, Nx, Ny, Nz, Bx, By, Bz, containing the parameter
values, the curve coordinates, the numerical curvature, the centers
and radii of the osculating circles, and the associated Frenet frame
vectors.
plotA plotly object when plot = TRUE,
otherwise NULL.
Functions of t returning the coordinate components
of the curve.
Numeric endpoints of the parameter interval.
Numeric vector of parameter values at which osculating circles or discs are constructed.
Step size for centered finite-difference approximations.
Logical; if TRUE, creates a 3D visualization using
plotly.
Number of sample points used to draw the base curve
when show_curve = TRUE.
Character; either "disk" for a filled surface or
"ring" for the circumference only.
Number of radial subdivisions when drawing a filled disc.
Number of angular subdivisions; also used as the number of points on each ring.
Character string giving the plotly colorscale used for the discs.
Numeric value between 0 and 1 controlling the opacity of
the discs when fill = "disk".
List with style options for the ring when
fill = "ring".
Logical values indicating whether the base curve and the corresponding points on the curve should be displayed.
Lists with plotly style options for the base curve and the points.
Logical; if TRUE, draws a radius segment from
the center of each osculating circle to its boundary.
Angle, in radians, that determines the direction of the displayed radius.
List with plotly style options for the radius segment.
List with 3D scene settings for the plotly figure.
List defining background colors for the figure, typically with
entries paper and plot.
List with lighting options for add_surface when
fill = "disk".
Numeric tolerance used in derivative-based checks and to detect degenerate cases in which curvature or frame vectors cannot be computed reliably.
For each parameter value in t_points, the function:
evaluates the curve and approximates its first and second derivatives,
constructs approximate tangent, normal and binormal directions,
estimates the curvature from the derivative information,
defines the center of the osculating circle by moving from the curve point along the normal direction by a distance equal to the reciprocal of the curvature,
records the corresponding radius as that same reciprocal quantity.
Depending on the value of fill, the function either:
builds a filled disc that lies in the osculating plane and is bounded by the osculating circle, or
draws only the circumference corresponding to that circle.
A regular sampling of angles around the osculating circle is used to generate the discrete representation. For filled discs, radial subdivisions are added to obtain a surface mesh. The resulting objects can be combined with a sampled version of the base curve and additional elements such as radius segments.
X <- function(t) cos(t)
Y <- function(t) sin(t)
Z <- function(t) 0.2 * t
osculating_circle3d(
X, Y, Z,
a = 0, b = 6 * pi,
t_points = c(pi, 2 * pi),
plot = FALSE
)
Run the code above in your browser using DataLab