Same as Scene.free, for using scene = new Scene().
Adds a per-vertex curvature field: one value per vertex slot of on,
the signed mean curvature there, in 1/world-units (positive on domes,
negative in bowls, zero on flats). It follows edits and placements by
the mesh modes, like normals, and colours like any field.
Adds a signed distance field: one value per vertex slot of on, the
distance to to as placed (negative inside), Infinity beyond
maxDistance, NaN for dead or unused vertices. With several meshes in
to, the smallest over them, ties going to the earliest. It follows
edits and placements by the mesh modes, like normals. Removing a mesh of
to removes it from the field, or the field with its last target.
Adds a mesh from world positions. They are stored as p − origin in
f32 (see AddMeshOptions.origin); the placement starts as the
identity, so Scene.matrix4 maps the local coordinates back to
where they were given.
Adds a plane section of meshes. Results of "eager" meshes are computed
right away; others on Scene.updateSections or flush().
Adds a per-vertex wall-thickness field: one value per vertex slot of
on, the distance to the opposite surface along the vertex's smooth
normal, in world units. Open sheets and rims read NaN, hits beyond
maxDistance read Infinity. It follows edits and placements by the
mesh modes, like normals, and colours like any field.
A read-only report of the mesh's defects: boundary loops (whose ids
fillHoles takes), coincident vertices, degenerate and duplicate
triangles, non-manifold edges and vertices, components, orientation
conflicts and, on request, self-intersection.
INVALID_ARGUMENT for a negative or non-finite weldTolerance; STALE_BVH, see AnalyzeOptions.selfIntersection.
Opens a history step, or one more nesting level of the open one. Edits and placement changes until the matching Scene.endStep are undone together.
Combines source into target in the world: the union, subtraction
(target minus source) or intersection. Returns target, now
holding the result with its placement; source is unchanged.
Both meshes must be closed and manifold. The boolean undoes in one
step. Combining a mesh with itself is a no-op for "union" and
"intersect", and clears it for "subtract".
The box around the vertices the live triangles use, in the mesh's local
render coordinates (Scene.matrix4 maps them to the world). Dead
slots keep stale positions, so they are excluded. null without live
triangles.
Reverts and discards the open step, however deeply nested. Throws STEP_NOT_OPEN when none is open.
True if Scene.redo would redo something.
True if Scene.undo would undo something.
Closes an open step, then drops every undo and redo step.
The surface point nearest to a world point, over every mesh or one, or
null when none is within maxDistance.
The rule the mesh is coloured by (a frozen copy of the one given to
Scene.setColoring, the same object on every read), or null
without colouring (never set, turned off, or its field removed).
Takes the changes once and delivers the same array to every listener, then returns it. Call it once per animation frame. Every listener runs even if one throws; the first error is rethrown afterwards.
Removes the mesh's dead slots and renumbers the rest. Its next change
record has every buffer "all" and capacityChanged when the slot counts
shrank. The mesh's earlier edits leave the history (its placement changes
stay undoable).
Cuts mesh with a world plane: the + side
(signedDistance >= 0) stays on the mesh and the - side is added as
a new mesh with the same placement, so the world shape is kept.
Cutting a closed mesh with cap (the default) yields two closed
meshes, capped with flat, unfaired patches.
The cut undoes in one step; the added mesh stays, like the removed source of Scene.join.
Optionaloptions: CutOptionsStarts dragging a mesh: the moves until DragSession.end form one
undo step (nested in the open step, if there is one). One drag at a time.
Every DragSession.move recomputes the eager fields, so make at most
one move per animation frame, with the latest pointer pose, or pass
{ coalesce: true } to have the drag do that for you.
Edits a mesh's geometry with a list of ops, run in Rust as one transaction: one undo step (or part of the open step), and when any op fails nothing changes and nothing is recorded. Positions are world coordinates, mapped to local with the mesh's placement and origin. Ids may be EditRefs to ids added by earlier ops of the list; every ref is checked before anything is written. Normals, colours, fields, sections and the BVH follow by the mesh's mode.
Ends one nesting level of the open step. Throws STEP_NOT_OPEN when none is open.
Per vertex slot, the index in Scene.fieldTargets of the target
the field's value came from, or 0xffffffff for none (Infinity or
NaN). A copy, as of the field's last update.
Whether the field is current, and what its sign data found out about the target meshes, together (see FieldStatus.sign).
The field's target meshes, in index order (a removed target leaves the list).
What the sign data found out about each of the field's targets, in the order of Scene.fieldTargets.
No boundary or non-manifold edge.
The mode in use (never "auto").
A zero-copy view of the field's values as of its last update, one per vertex slot. Like render views, it is only valid until the next call that may allocate (a kept one may read other data or be empty): get it right before use.
Every mesh pair (or every pair of pairs) within margin, sorted by mesh id.
Brings every mesh that is not "manual" up to date.
Releases the scene and everything in it. Later calls throw INVALID_ARGUMENT; calling it again does nothing.
Whether two meshes intersect or touch as placed.
Isolates a selection: removes the triangles fully outside it (no
selected vertex), one undo step. Boundary triangles with at least one
selected vertex stay. An empty selection selects nothing to keep and
throws INVALID_ARGUMENT rather than clearing the mesh.
Joins source into target: copies the source's geometry into the
target (keeping its world shape), bridges options.loopA to the copied
options.loopB, and removes the source. The copy and the bridge undo as
one step; the removal is permanent. A drag of the source ends first,
recording its moves as one step, so they survive a failed join.
The column-major world matrix of the local render coordinates,
placement · translate(origin), ready for renderers (convert to f32
yourself). The rotation columns carry the scale; normals need the
inverse-transpose (three.js' normal matrix does this from the matrix).
Scalar measurements of a mesh in world coordinates: its surface area
(always) and, when watertight, its enclosed volume. An open or
non-manifold mesh still gets its area; only volume is null, with
volumeReason saying why. A read-only call: it leaves every view
valid.
The distance between two meshes' surfaces as placed, with a closest pair
of points, or null when it exceeds maxDistance (default Infinity)
or a mesh has no triangle.
When the mesh's derived data follows its edits; see UpdateMode.
Registers a listener for Scene.commitFrame. Returns a function that unregisters it.
A mesh's placement, with the rotation as a row-major matrix.
The nearest hit of a world ray over every mesh, or null. direction
need not be unit length; distance is in world units. Lazy meshes are
brought up to date first.
Redoes the latest undone step. Returns false when there is nothing to redo.
Rigidly aligns the mesh moving to the mesh fixed by point-to-plane ICP,
with the closest points found through fixed's BVH and trimmed by
options.overlap. A drag of either mesh ends first, recording its moves
as one step, once the arguments have been checked.
The initial guess is the current placements. ICP finds the nearest
fit, so put the meshes roughly in place first with setPlacement.
Applying. By default a good result becomes moving's placement as one
undo step (applied in the result): converged, with rmse within maxRmse
and enough points in range. Otherwise nothing moves, and notApplied says
why; placement still holds the estimate, for setPlacement if it will do.
apply: false only returns it.
Undetermined poses. A plane's slide and a sphere's or a cylinder's spin
are not fixed by the data, though facets or noise can let the iteration
settle with a tiny rmse. These report "underconstrained" and list the
motions in undetermined. So do coarse regular meshes with exact fits close
by: a 16-sided sphere fits every 22.5 degrees. The check is local, so a
cube's 90-degree symmetry does not count. It adds a bounded cost: up to 12
restarts of up to 12 steps on at most 10,000 points.
Scales. Only rotation and translation are solved. moving's scale is
applied to its points and kept. fixed's scale, uniform or not, is
followed exactly on a copy baked through it, so each such call costs a BVH
build. All distances are in world units.
UNKNOWN_MESH for a removed handle; INVALID_ARGUMENT for one
mesh twice, a mesh without triangles or an invalid option; STALE_BVH for
a stale Manual fixed. Bad options and one mesh twice change nothing,
and a drag keeps running. The other errors come after a drag has ended, and
change nothing else.
Removes a field, and a colouring by it. Its handle then gives UNKNOWN_FIELD.
Removes a mesh. Its handle then gives UNKNOWN_MESH. An active drag of
the mesh is ended first, closing its step; the mesh's history entries
(the drag's included) are then dropped with it.
Removes a section. Its handle then gives UNKNOWN_SECTION.
Runs one repair operation and returns its report, or a list of them in
order and returns their reports. A list is one transaction: one undo step,
and when any operation fails nothing changes and nothing is recorded.
{ kind: "auto" } runs the standard cleanup pipeline the same way and
returns a report per stage; see AutoRepairRequest.
Runs one repair operation and returns its report, or a list of them in
order and returns their reports. A list is one transaction: one undo step,
and when any operation fails nothing changes and nothing is recorded.
{ kind: "auto" } runs the standard cleanup pipeline the same way and
returns a report per stage; see AutoRepairRequest.
Runs one repair operation and returns its report, or a list of them in
order and returns their reports. A list is one transaction: one undo step,
and when any operation fails nothing changes and nothing is recorded.
{ kind: "auto" } runs the standard cleanup pipeline the same way and
returns a report per stage; see AutoRepairRequest.
A section's result for one of its meshes as of its last computation (empty before the first), copied, in world coordinates.
The closest pair between two meshes' contours in a section, measured in
the plane, or null when either has none or their results were cut with
different planes (call Scene.updateSections first).
A section's plane as last set by Scene.addSection or
Scene.setSectionPlane, the normal normalised. Results not yet
recomputed ("stale") may still be cut with an earlier plane.
Selects vertices of a mesh: a sphere brush, a lasso polygon, or the
connected component holding a seed vertex. The result is a snapshot
(ascending ids plus the mesh's content stamp); any edit, repair, compact,
undo or redo of the mesh invalidates it, and the selection methods then
throw STALE_SELECTION instead of silently remapping ids. Placement
changes keep selections valid. Only vertices a live triangle uses can
be selected (dead or never-used slots never are).
Grows a selection by steps rings of edge neighbours (staying on live
vertices). The result carries the current stamp, so a fresh selection
can be grown right after an edit. steps 0 returns an equal copy.
Inverts a selection: every live vertex outside it. The result carries the current stamp.
Whether sel is still usable: its mesh is alive and no topology edit
landed since it was taken. Never throws.
Shrinks a selection by steps rings, dropping the members with a live
neighbour outside the set. Interior selections (no boundary) survive
unchanged; shrinking past the core gives an empty (still valid)
selection.
Colours a mesh from one of its fields (views(mesh).colors()), or turns
colouring off with null, after which colors() returns null. Every
vertex is recoloured and reported as "all"; later field updates (edits,
drags) report only the vertices whose colour may change. A display
setting: never recorded in history.
Sets when the mesh's derived data follows its edits; see UpdateMode.
Sets a mesh's placement: world = rotation · (scale · local) + translation,
where local is relative to the mesh origin. A quaternion is normalised
and converted in double precision. The scale defaults to [1, 1, 1]
(rigid) and must be 3 finite positive numbers.
Changes the meshes a section cuts.
Everything that changed since the previous call, one record per mesh. There is a single consumer: apps that use Scene.onChanges call Scene.commitFrame instead.
Triangle slots, alive or dead: the triangle length of the index buffer.
Undoes the latest step; an active drag is ended first. Without an open
step around the drag, the drag is what gets undone; inside a caller's
open step, that whole step (drag included) is closed and undone. Returns
false when there is nothing to undo.
Brings the mesh's derived data up to date now, whatever its mode.
Computes every stale section result, whatever the mesh modes.
Vertex slots, alive or dead: the vertex length of the render buffers.
Zero-copy views of the mesh's render buffers. Each getter builds a fresh view; re-acquire views after every scene call that may allocate, since a kept one may read other data or be empty (see MeshViews).
A scene of editable meshes. Create it after
await init(); release it with Scene.free or ausingdeclaration (otherwise it is freed when garbage collected).Render views (Scene.views) point into WebAssembly memory and are only valid until the next scene call that may allocate or move buffers: a kept view may read other data or be empty. Re-acquire them after every scene call; see MeshViews.