Computes numerical binormal vectors of a three-dimensional parametric curve at selected parameter values. The curve is given by three coordinate functions. At each evaluation point, the first and second derivatives of the curve are approximated numerically, and their cross-product direction is normalized to obtain the binormal vector.
binormal3d(
X,
Y,
Z,
a,
b,
t_points,
h = 1e-04,
plot = FALSE,
n_samples = 400,
vec_scale = NULL,
vec_factor = 1,
curve_line = list(color = "blue", width = 2, dash = "solid"),
B_line = list(color = "black", width = 5, dash = "solid"),
show_curve = TRUE,
show_points = TRUE,
point_marker = list(color = "black", size = 3, symbol = "circle"),
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"),
tol = 1e-10
)A tibble with columns t, x, y, z,
Bx, By and Bz, containing the components of the
binormal vector at each evaluation point.
Function returning the x coordinate of the curve as a
function of the parameter t.
Function returning the y coordinate of the curve as a
function of the parameter t.
Function returning the z coordinate of the curve as a
function of the parameter t.
Lower endpoint of the parameter interval.
Upper endpoint of the parameter interval.
Numeric vector of parameter values for evaluation and optional plotting.
Step size for centered finite-difference approximations.
Logical; if TRUE, produces a plotly 3D
visualization showing the curve and the binormal vectors.
Number of points used to sample and display the curve in the plot.
Base length used for binormal segments. If NULL,
it is estimated as a small proportion of the size of the sampled curve.
Multiplicative factor applied to vec_scale to
adjust segment length.
List with plotly style options for drawing the base curve.
List with plotly style options for the binormal segments.
Logical; if TRUE, the base curve is included in
the plot.
Logical; if TRUE, the evaluation points are
marked in the plot.
List with plotly marker options for the evaluation points.
List with 3D scene settings for the plotly figure.
Background color configuration for the plotly figure.
Numeric tolerance for detecting situations in which the derivative information is too weak to determine a stable binormal direction.
For every value in t_points, the function:
computes centered finite-difference approximations of the first and second derivatives,
forms a direction perpendicular to both derivatives,
normalizes that direction to obtain a unit binormal vector.
If the first derivative is extremely small or if the first and second
derivative vectors are nearly parallel, the binormal direction cannot be
determined reliably. In these cases, the function returns NA for
the affected components.
Optionally, the function can display the curve and the associated binormal segments in an interactive 3D plot using plotly. The sampled curve, evaluation points and binormal segments can be shown or hidden independently.
X <- function(t) t * cos(t)
Y <- function(t) t * sin(3 * t)
Z <- function(t) t
binormal3d(X, Y, Z, a = 0, b = 2 * pi, t_points = c(pi / 3, pi, 5 * pi / 3))
Run the code above in your browser using DataLab