Constructs a ruled surface generated by a three-dimensional parametric curve and a chosen direction field. At each sampled point on the curve, a straight segment is extended in a specified direction, producing a surface composed of line elements. Optionally, the resulting surface can be visualized using plotly.
cylindrical_surface3d(
X,
Y,
Z,
a,
b,
s_range,
dir,
n_t = 200,
n_s = 60,
plot = FALSE,
surface_colorscale = "Blues",
surface_opacity = 0.35,
show_surface_grid = TRUE,
surface_grid_color = "rgba(60,80,200,0.25)",
surface_grid_width = 1,
show_curve = TRUE,
curve_line = list(color = "red", width = 2, dash = "solid"),
show_edge_a = TRUE,
show_edge_b = FALSE,
edge_line = list(color = "blue", width = 2, dash = "solid"),
show_rulings = TRUE,
rulings_count = 12,
rulings_at = NULL,
rulings_line = list(color = "black", width = 1, dash = "solid"),
show_axis_grid = FALSE,
scene = list(aspectmode = "data", xaxis = list(title = "x"), yaxis = list(title = "y"),
zaxis = list(title = "z")),
bg = list(paper = "white", plot = "white"),
lighting = list(ambient = 1, diffuse = 0.15, specular = 0, roughness = 1, fresnel = 0)
)A list with:
t_seq, s_seq: parameter grids used to build the mesh,
Xmat, Ymat, Zmat: matrices of coordinates
for the ruled surface,
curve: data frame with the sampled generating curve,
edge_a, edge_b: data frames for boundary edges
(possibly NULL if not requested),
u_hat: normalized ruling direction vector.
Functions of one variable t returning the coordinate
components of the base curve.
Numeric values giving the endpoints of the parameter interval.
Numeric vector of length two giving the lower and upper bounds for the ruling parameter.
Numeric vector of length three c(ux, uy, uz) giving
the ruling direction. It will be normalized internally.
Integers giving the sampling resolution along the t
and s directions.
Logical; if TRUE, displays the ruled surface using
plotly.
Character string or vector specifying the colorscale used for the surface.
Numeric value between 0 and 1 controlling the opacity of the surface.
Logical; if TRUE, draws grid lines on the
surface.
Color for the surface grid lines.
Numeric width for the grid lines.
Logical; if TRUE, overlays the generating curve.
List of plotly style options for the curve.
Logical; if TRUE, draws the boundary
edges at the extremes of the ruling parameter.
List of plotly style options for boundary edges.
Logical; if TRUE, draws a subset of rulings on
the surface.
Integer giving the number of rulings to draw when
rulings_at is not provided.
Optional numeric vector giving the parameter values at which rulings should be displayed.
List of plotly style options for displayed rulings.
Logical; if TRUE, shows axis gridlines in the
3D scene.
Optional list with 3D scene settings for plotly.
Optional list with background color settings for the figure.
Optional list with lighting parameters for surface shading in plotly.
The function samples the base curve at n_t parameter values and,
for each sampled point, generates a set of points along a line segment
determined by the ruling parameter. These segments are interpolated over
the interval specified in s_range.
In this implementation, the ruling direction is given by a fixed
three-dimensional vector dir. This vector is normalized
internally before constructing the surface.
If plot = TRUE, a 3D visualization is produced using plotly.
The plot may include the ruled surface, grid lines on the surface,
boundary edges corresponding to the extremes of the ruling parameter,
and a selection of rulings. The generating curve can also be displayed.
X <- function(t) cos(t)
Y <- function(t) sin(t)
Z <- function(t) 0.3 * t
dir_vec <- c(0, 0, 1)
rs <- cylindrical_surface3d(
X, Y, Z,
a = 0, b = 2 * pi,
s_range = c(-0.2, 0.2),
dir = dir_vec,
n_t = 100, n_s = 40,
plot = FALSE
)
Run the code above in your browser using DataLab