Irregular rectangle surface helpers
Source:R/graph_helpers.R
irregular_rectangle_surface_helpers.RdConvenience helpers that keep ordinary rectangular-mesh adjacency but replace the regular parameter grid by a deterministic irregular rectangle. The resulting family stays simply connected and rectangular in topology while breaking the strongest row/column symmetries of the lattice.
Usage
irregular.rectangle.param.coords(
h,
w = h,
x_scale = 1,
y_scale = 1,
row_irregularity = 0.2,
col_irregularity = 0.2,
row_phase = 0.35,
col_phase = 0.65,
interior_warp = 0.08,
shear = 0,
min_step_ratio = 0.3
)
irregular.rectangle.surface.embedding(
h,
w = h,
surface = c("flat", "saddle", "paraboloid", "ripple"),
amplitude = 0.75,
freq_u = 1,
freq_v = 1,
x_scale = 1,
y_scale = 1,
row_irregularity = 0.2,
col_irregularity = 0.2,
row_phase = 0.35,
col_phase = 0.65,
interior_warp = 0.08,
shear = 0,
min_step_ratio = 0.3
)
irregular.rectangle.surface.graph(
h,
w = h,
surface = c("flat", "saddle", "paraboloid", "ripple"),
amplitude = 0.75,
freq_u = 1,
freq_v = 1,
x_scale = 1,
y_scale = 1,
row_irregularity = 0.2,
col_irregularity = 0.2,
row_phase = 0.35,
col_phase = 0.65,
interior_warp = 0.08,
shear = 0,
min_step_ratio = 0.3,
connectivity = c("orthogonal", "diagonal"),
normalize = c("median", "mean", "none")
)Arguments
- h
Number of rows.
- w
Number of columns. Defaults to
h.- x_scale
Positive horizontal scaling of the parameter domain.
- y_scale
Positive vertical scaling of the parameter domain.
- row_irregularity
Irregularity level for the row spacing. Must lie in
[0, 1].- col_irregularity
Irregularity level for the column spacing. Must lie in
[0, 1].- row_phase
Finite phase shift for the deterministic row-spacing perturbation.
- col_phase
Finite phase shift for the deterministic column-spacing perturbation.
- interior_warp
Non-negative interior warp strength. Must lie in
[0, 1]. The warp vanishes on the boundary.- shear
Finite affine shear applied after the boundary-vanishing warp. Larger values can force a validation error if the mesh cells invert.
- min_step_ratio
Positive lower bound for the perturbed row and column interval lengths, expressed relative to the unperturbed interval scale. Must lie in
(0, 1].- surface
Surface family used for the lift. One of
"flat","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".- connectivity
Mesh neighborhood rule passed to
edges.mesh().- normalize
Normalization applied to the induced edge lengths. One of
"median","mean", or"none".
Value
irregular.rectangle.param.coords() returns an n x 2 numeric
matrix with columns u and v.
irregular.rectangle.surface.embedding() returns an n x 3
numeric matrix with columns x, y, and z.
irregular.rectangle.surface.graph() returns a list with components:
edges: the undirected rectangular-mesh edges,n: number of vertices,edge_weights: induced positive edge lengths,coords_surface: the 3D surface embedding,coords_param: the irregular 2D parameter coordinates,coords_regular_param: the underlying regular 2D parameter coordinates used to define the boundary-vanishing warp,row_breaks: per-row parameter coordinates in row order,col_breaks: per-column parameter coordinates in column order,weight_scale: the normalization constant applied to the raw edge lengths,family: always"irregular.rectangle",surface: the chosen surface name,connectivity: the chosen mesh connectivity rule,label: a human-readable family label.
Details
`irregular.rectangle.param.coords()` returns the irregular planar parameter coordinates. `irregular.rectangle.surface.embedding()` lifts those coordinates into \(\mathbb{R}^3\). `irregular.rectangle.surface.graph()` returns a reusable weighted-graph bundle with the induced Euclidean edge lengths.