Skip to contents

Creates a gaussian_splat object from 3D coordinates, point clouds, or bounding geometries. Automatically computes initial isotropic scales based on k-nearest neighbor (k-NN) distances, initializes rotation quaternions to identity, opacities to initial transmittance, and Spherical Harmonics degree 0 coefficients from RGB colors.

Usage

gs_create(
  points,
  colors = NULL,
  initial_scale = NULL,
  initial_opacity = 0.15,
  sh_degree = 0
)

Arguments

points

Numeric matrix or data.frame with 3 columns (x, y, z).

colors

Optional matrix or data.frame of RGB colors in [0, 1] or [0, 255]. Defaults to uniform green c(0.2, 0.75, 0.25) for plant points.

initial_scale

Optional numeric scalar. If NULL (default), scales are automatically computed per point as the root-mean-square distance to its 3 nearest neighbors (the initialization of Kerbl et al., 2023).

initial_opacity

Numeric scalar between 0 and 1. Initial Gaussian opacity. Defaults to 0.15.

sh_degree

Integer. Maximum Spherical Harmonics degree (0, 1, 2, or 3). Defaults to 0.

Value

An S3 object of class gaussian_splat.

Examples

if (FALSE) { # interactive()
library(pliman)

# Create 500 random points representing a small plant canopy
pts <- matrix(rnorm(1500, mean = 0, sd = 0.5), ncol = 3)
splat <- gs_create(pts)
print(splat)
}