Learn R Programming

grip (version 0.3.0)

mesh_surface_helpers: Weighted mesh surface helpers

Description

Convenience helpers that lift a rectangular mesh parameter grid into \(\mathbb{R}^3\) and use the induced Euclidean edge lengths as positive graph weights. These helpers are intended for benchmark families where the topology is a plain mesh but the intended metric comes from a curved ambient geometry.

Usage

mesh.surface.graph(
  h,
  w = h,
  surface = c("saddle", "paraboloid", "ripple"),
  amplitude = 0.75,
  freq.u = 1,
  freq.v = 1,
  x.scale = 1,
  y.scale = 1,
  connectivity = c("orthogonal", "diagonal"),
  normalize = c("median", "mean", "none")
)

Value

The coords_surface component is an n x 3 numeric matrix with columns x, y, and z.

mesh.surface.graph() returns a list with components:

  • edges: the undirected mesh edges,

  • n: number of vertices,

  • edge_weights: induced positive edge lengths,

  • coords_surface: the 3D surface embedding,

  • coords_param: the 2D parameter-grid coordinates,

  • weight_scale: the normalization constant applied to the raw edge lengths,

  • family: always "mesh",

  • surface: the chosen surface name,

  • connectivity: the chosen mesh connectivity rule,

  • label: a human-readable family label.

Arguments

h

Number of rows.

w

Number of columns. Defaults to h.

surface

Surface family used for the lift. One of "saddle", "paraboloid", or "ripple".

amplitude

Finite numeric amplitude controlling the non-flat displacement.

freq.u

Positive ripple frequency in the horizontal parameter direction. Used only when surface = "ripple".

freq.v

Positive ripple frequency in the vertical parameter direction. Used only when surface = "ripple".

x.scale

Positive horizontal scaling of the parameter domain.

y.scale

Positive vertical scaling of the parameter domain.

connectivity

Mesh neighborhood rule. "orthogonal" keeps the four-neighbor grid; "diagonal" also adds both diagonals of every unit square.

normalize

Normalization applied to the induced edge lengths. One of "median", "mean", or "none".

Details

The coords.surface component contains the 3D coordinates of the lifted grid. mesh.surface.graph() returns a reusable weighted-graph bundle containing the mesh edges, induced edge weights, the 3D surface coordinates, and the 2D parameter coordinates.

Examples

Run this code
mesh <- mesh.surface.graph(4, 5, surface = "saddle")

Run the code above in your browser using DataLab