vcg_subset_vertex: Subset mesh by vertex

View source: R/vcg.R

vcg_subset_vertexR Documentation

Subset mesh by vertex

Description

Subset mesh by vertex

Usage

vcg_subset_vertex(x, selector)

Arguments

x

surface mesh

selector

logical vector (must not contain NA), and length must be consistent with the number of vertices in x.

Value

A triangular mesh of class 'mesh3d', a subset of x

Examples


sphere <- vcg_sphere()

nv <- ncol(sphere$vb)

selector <- seq_len(nv) > (nv / 2)

sub <- vcg_subset_vertex(sphere, selector)

if(is_not_cran()) {
  rgl_view({

    # subset sphere will be displayed in red
    rgl_call("shade3d", sub, col = 'red')

    # Original sphere will be displayed as wireframe
    rgl_call("wire3d", sphere, col = (2 - selector))

  })
}



dipterix/ravetools documentation built on June 13, 2025, 11:37 a.m.