Learn R Programming

vectorialcalculus (version 1.0.5)

binormal3d: Binormal vectors along a 3D parametric curve

Description

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.

Usage

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
)

Value

A tibble with columns t, x, y, z, Bx, By and Bz, containing the components of the binormal vector at each evaluation point.

Arguments

X

Function returning the x coordinate of the curve as a function of the parameter t.

Y

Function returning the y coordinate of the curve as a function of the parameter t.

Z

Function returning the z coordinate of the curve as a function of the parameter t.

a

Lower endpoint of the parameter interval.

b

Upper endpoint of the parameter interval.

t_points

Numeric vector of parameter values for evaluation and optional plotting.

h

Step size for centered finite-difference approximations.

plot

Logical; if TRUE, produces a plotly 3D visualization showing the curve and the binormal vectors.

n_samples

Number of points used to sample and display the curve in the plot.

vec_scale

Base length used for binormal segments. If NULL, it is estimated as a small proportion of the size of the sampled curve.

vec_factor

Multiplicative factor applied to vec_scale to adjust segment length.

curve_line

List with plotly style options for drawing the base curve.

B_line

List with plotly style options for the binormal segments.

show_curve

Logical; if TRUE, the base curve is included in the plot.

show_points

Logical; if TRUE, the evaluation points are marked in the plot.

point_marker

List with plotly marker options for the evaluation points.

scene

List with 3D scene settings for the plotly figure.

bg

Background color configuration for the plotly figure.

tol

Numeric tolerance for detecting situations in which the derivative information is too weak to determine a stable binormal direction.

Details

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.

Examples

Run this code
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