okgeometry-api 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Mesh.ts CHANGED
@@ -3846,6 +3846,36 @@ export class Mesh {
3846
3846
  return Mesh.fromTrustedBuffer(r as Float64Array);
3847
3847
  }
3848
3848
 
3849
+ /**
3850
+ * All feature-edge chains of this mesh: every connected chain of edges
3851
+ * separating the same two smooth face groups — the exact grouping
3852
+ * `chamferEdges` expands picks to. Each chain is an ordered polyline
3853
+ * (`points` = flat xyz triples); `closed` chains (tessellated rims) omit
3854
+ * the duplicate seam point. Use this to show what a chamfer pick will
3855
+ * actually cut. Throws on an invalid mesh; a mesh with no feature edges
3856
+ * returns an empty array.
3857
+ */
3858
+ featureEdgeChains(): Array<{ closed: boolean; points: Float64Array }> {
3859
+ ensureInit();
3860
+ const r = wasm.mesh_feature_edge_chains(this._vertexCount, this._buffer);
3861
+ if (!r.length) {
3862
+ throw new Error(
3863
+ `Mesh.featureEdgeChains() failed: ${wasm.geometry_last_error() || "unknown error"}`,
3864
+ );
3865
+ }
3866
+ const chains: Array<{ closed: boolean; points: Float64Array }> = [];
3867
+ let offset = 0;
3868
+ const chainCount = r[offset++];
3869
+ for (let c = 0; c < chainCount; c++) {
3870
+ const closed = r[offset++] !== 0;
3871
+ const pointCount = r[offset++];
3872
+ const points = (r as Float64Array).slice(offset, offset + pointCount * 3);
3873
+ offset += pointCount * 3;
3874
+ chains.push({ closed, points });
3875
+ }
3876
+ return chains;
3877
+ }
3878
+
3849
3879
  /**
3850
3880
  * Geometry-preserving repair: weld coincident vertices, drop degenerate /
3851
3881
  * duplicate triangles, remove orphan vertices, make winding consistent +