generate_cylinder: Generate a cylinder mesh

View source: R/mesh_utils.R

generate_cylinderR Documentation

Generate a cylinder mesh

Description

Creates a cylinder from start to end with the given radius, subdivided into segments around the axis. Both end caps are included.

Usage

generate_cylinder(
  start,
  end,
  radius = 0.5,
  segments = 32,
  color = c(1, 1, 1, 1)
)

Arguments

start

Length-3 vector: cylinder start point.

end

Length-3 vector: cylinder end point.

radius

Cylinder radius.

segments

Subdivision count (default 32).

color

Length-4 RGBA colour.

Value

A mesh descriptor list.

Examples

mesh <- generate_cylinder(c(0, -1, 0), c(0, 1, 0), radius = 0.5)
nrow(mesh$vertices)


scimesh documentation built on Aug. 9, 2026, 9:07 a.m.