Skip to content
Shapemetry

@huukhanhnguyen/geometry / namespaces/Surface

namespaces/Surface

area

const area: (surface_json, deflection?, maximum_grid_divisions?) => number = wasm.surface_area

NurbsSurface.surfaceArea — closed form on a recovered plane / sphere / cylinder / torus; Gauss–Legendre of |Su × Sv| otherwise. The deflection argument does not change a closed-form answer. A trimmed surface throws.

Parameters

surface_json

string

deflection?

number | null

maximum_grid_divisions?

number | null

Returns

number


closestParam

const closestParam: (surface_json, x, y, z, use_seed, seed_u, seed_v) => Float64Array = wasm.surface_closest_param

[u, v]. Pass use_seed = false for the cold 21x21 grid path.

Parameters

surface_json

string

x

number

y

number

z

number

use_seed

boolean

seed_u

number

seed_v

number

Returns

Float64Array


curvature

const curvature: (surface_json, u, v) => Float64Array = wasm.surface_curvature

[gaussian, mean, k1, k2]; all four are NaN where the TS returns NaN.

Parameters

surface_json

string

u

number

v

number

Returns

Float64Array


derivatives

const derivatives: (surface_json, u, v) => Float64Array = wasm.surface_derivatives

[point, dsDu, dsDv] flattened, 9 values.

Parameters

surface_json

string

u

number

v

number

Returns

Float64Array


derivatives2

const derivatives2: (surface_json, u, v) => Float64Array = wasm.surface_derivatives2

[point, su, sv, suu, suv, svv] flattened, 18 values.

Parameters

surface_json

string

u

number

v

number

Returns

Float64Array


derivativesAtVList

const derivativesAtVList: (surface_json, u, vs) => Float64Array = wasm.surface_derivatives_at_v_list

One [point, dsDu, dsDv] triple per v, flattened: 9 * vs.len() values.

Parameters

surface_json

string

u

number

vs

Float64Array

Returns

Float64Array


fromCorners

const fromCorners: (corners) => string = wasm.surface_from_corners

NurbsSurface.fromCorners — the bilinear patch through four corners, given as 12 numbers in p00, p10, p01, p11 order.

Parameters

corners

Float64Array

Returns

string


isocurve

const isocurve: (surface_json, t, direction) => string = wasm.surface_isocurve

direction is "u" or "v"; anything else takes the v branch, as the TS direction === 'u' test does.

Parameters

surface_json

string

t

number

direction

string

Returns

string


loft

const loft: (curves_json, degree_v) => string = wasm.surface_loft

NurbsSurface.loft — the surface interpolating every section curve, over the sections' own common degree and knot vector. The sections cross as a JSON array of NurbsCurveJSON, one surface comes back.

Parameters

curves_json

string

degree_v

number

Returns

string


normalAt

const normalAt: (surface_json, u, v) => Float64Array = wasm.surface_normal_at

su x sv, normalized — NurbsSurface.normalAt. Analytic partials, correct on every boundary where a one-sided finite difference degenerates; errs where the patch is degenerate and has no normal at all.

Parameters

surface_json

string

u

number

v

number

Returns

Float64Array


patch

const patch: (curves_json, grid_n, samples) => string = wasm.surface_patch

NurbsSurface.patch — a G0 thin-plate patch through the sampled boundary curves, trimmed to the region they enclose. curves_json is a NurbsCurveJSON[].

Parameters

curves_json

string

grid_n

number

samples

number

Returns

string


patchWithEdges

const patchWithEdges: (edges_json, grid_n, samples) => string = wasm.surface_patch_with_edges

NurbsSurface.patchWithEdges — the same patch with G1/G2 penalties taken from each edge's neighbouring surface. edges_json is [{ curve, surface?, continuity? }].

Parameters

edges_json

string

grid_n

number

samples

number

Returns

string


pipe

const pipe: (profiles_json, path_json, samples) => string = wasm.surface_pipe

NurbsSurface.pipe — the profile(s) transported along the path's rotation-minimizing frame and lofted. A JSON array in, a JSON array out (one surface today, matching the TypeScript's own return shape).

Parameters

profiles_json

string

path_json

string

samples

number

Returns

string


point

const point: (surface_json, u, v) => Float64Array = wasm.surface_point

Parameters

surface_json

string

u

number

v

number

Returns

Float64Array


points

const points: (surface_json, uvs) => Float64Array = wasm.surface_points

[surface_point] over a whole [u0, v0, u1, v1, ...] list — the surface is parsed ONCE. The per-point export re-parses the surface JSON on every call, and a consumer holding one surface object and sampling it many times (a uv divide walks 4 corners plus 9 stations per cell edge) pays that parse per station. Same evaluation, same errors, 3 * uvs.len() / 2 values out.

Parameters

surface_json

string

uvs

Float64Array

Returns

Float64Array


reverse

const reverse: (surface_json) => string = wasm.surface_reverse

Reverse the U parametrization — flips the surface's outward normal by mirroring the control-grid rows and remapping knotsU.

The trim loops ride along, reflected in x exactly as NurbsSurface.reverse writes it (NurbsSurface.ts:142): sumU - p.x over the RAW knot domain, while every producer and every other consumer treats x as NORMALIZED [0, 1] uv. That disagreement is the reference kernel's, it is reproduced here rather than fixed on one side, and it is latent because the two coincide on the [0, 1] knots every trimmed surface actually has — see the note in [super::types::TrimmedSurfaceData]. plate is still class state the wire does not carry.

Parameters

surface_json

string

Returns

string


revolve

const revolve: (curves_json, center, axis, angle) => string = wasm.surface_revolve

NurbsSurface.revolve — ONE revolved surface per profile curve, so the result is a JSON ARRAY of NurbsSurfaceJSON exactly as the TypeScript returns NurbsSurface[].

Parameters

curves_json

string

center

Float64Array

axis

Float64Array

angle

number

Returns

string


split

const split: (surface_json, t, direction) => string = wasm.surface_split

Both halves, as a JSON array of two NurbsSurfaceJSON.

Parameters

surface_json

string

t

number

direction

string

Returns

string


tessellate

const tessellate: (surface_json, deflection?, maximum_grid_divisions?) => Float64Array = wasm.surface_tessellate

NurbsSurface.tessellate — the sag-sized grid mesh, PACKED the way the mesh_* exports pack a triangle mesh:

[positionCount, indexCount, uvCount, normalCount, ...positions, ...indices, ...uvs, ...normals]

A trims key on the input takes the CDT path; without one the structured grid runs and a closed direction wraps its indices.

Parameters

surface_json

string

deflection?

number | null

maximum_grid_divisions?

number | null

Returns

Float64Array


torus

const torus: (center, axis, r_major, r_minor) => string = wasm.surface_torus

NurbsSurface.torus — makeToroidalSurface, which is a DIFFERENT construction from the brep torus carrier and stays its own function for that reason (see brep::geom::make_surface::make_toroidal_surface).

Parameters

center

Float64Array

axis

Float64Array

r_major

number

r_minor

number

Returns

string


transform

const transform: (surface_json, elements) => string = wasm.surface_transform

Parameters

surface_json

string

elements

Float64Array

Returns

string


uniformGrid

const uniformGrid: (degree_u, degree_v, rows, columns, control_points, weights) => string = wasm.surface_uniform_grid

NurbsSurface.uniformGrid — a control net on uniform (clamped) knots. The net crosses ROW-MAJOR and flat: rows * columns * 3 coordinates, then rows * columns weights.

Parameters

degree_u

number

degree_v

number

rows

number

columns

number

control_points

Float64Array

weights

Float64Array

Returns

string

Last updated: 📖 7 min readEdit on GitHub