Learn R Programming

pwlapprox2d (version 0.1.0)

build_pwl_envelope: Construct Piecewise Linear Envelope

Description

Builds a piecewise linear envelope around the data using convex hulls and intersection logic similar to the original C++ code.

Usage

build_pwl_envelope(data, smallconst = 1e-06)

Value

A list with element 'PWL': a numeric matrix of segments (slope, intercept, lower x-bound, upper x-bound). Returns NULL if envelope construction fails due to invalid input.

Arguments

data

A numeric matrix with two columns: x and f(x) values. Must have at least two rows.

smallconst

Small constant for numerical tolerance (default 1e-6).