okgeometry-api 0.2.14 → 0.2.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,s7goBAAs7goB,CAAC"}
1
+ {"version":3,"file":"wasm-base64.js","sourceRoot":"","sources":["../src/wasm-base64.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,MAAM,CAAC,MAAM,QAAQ,GAAG,8suoBAA8suoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "okgeometry-api",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "Geometry engine API for AEC applications — NURBS, meshes, booleans, intersections. Powered by Rust/WASM.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -228,6 +228,14 @@ export function mesh_create_prism(radius: number, height: number, sides: number)
228
228
  */
229
229
  export function mesh_create_sphere(radius: number, segments: number, rings: number): Float64Array;
230
230
 
231
+ /**
232
+ * Evaluate a point on a mesh surface at parametric coordinates (u, v).
233
+ * Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
234
+ * then casts a ray perpendicular to the best-fit projection plane.
235
+ * Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
236
+ */
237
+ export function mesh_evaluate(vertex_count: number, buffer: Float64Array, u: number, v: number): Float64Array;
238
+
231
239
  /**
232
240
  * Export a mesh to OBJ format
233
241
  * Takes mesh buffers as input (same format as mesh_to_buffers output)
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./okgeometrycore_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- arc_length, arc_point_at, chamfer_polycurve, circle_length, circle_point_at, create_arc, create_circle, create_line, create_polyline, curve_to_points, evaluate_nurbs_curve_at, extrude_circle, extrude_line, extrude_polyline, fillet_polycurve, line_length, line_point_at, line_tangent, loft_circles, loft_nurbs_surface, loft_polylines, make_nurbs_curves_compatible, mesh_apply_matrix, mesh_boolean_intersection, mesh_boolean_operation, mesh_boolean_subtraction, mesh_boolean_union, mesh_boundary_polylines, mesh_chamfer_all_edges, mesh_create_box, mesh_create_cone, mesh_create_cylinder, mesh_create_prism, mesh_create_sphere, mesh_export_obj, mesh_get_stats, mesh_import_obj, mesh_mesh_intersect, mesh_plane_intersect, mesh_rotate, mesh_scale, mesh_translate, nurbs_curve_curve_intersect, nurbs_curve_plane_intersect, nurbs_surface_evaluate, nurbs_surface_plane_intersect, nurbs_surface_surface_intersect, offset_polyline_curve, polycurve_to_nurbs, polyline_length, polyline_point_at, ray_closest_point, ray_closest_point_parameter, ray_distance_to_point, ray_point_at, sample_nurbs_curve, sweep_curves, sweep_polylines, tessellate_nurbs_surface, test_wasm, version
8
+ arc_length, arc_point_at, chamfer_polycurve, circle_length, circle_point_at, create_arc, create_circle, create_line, create_polyline, curve_to_points, evaluate_nurbs_curve_at, extrude_circle, extrude_line, extrude_polyline, fillet_polycurve, line_length, line_point_at, line_tangent, loft_circles, loft_nurbs_surface, loft_polylines, make_nurbs_curves_compatible, mesh_apply_matrix, mesh_boolean_intersection, mesh_boolean_operation, mesh_boolean_subtraction, mesh_boolean_union, mesh_boundary_polylines, mesh_chamfer_all_edges, mesh_create_box, mesh_create_cone, mesh_create_cylinder, mesh_create_prism, mesh_create_sphere, mesh_evaluate, mesh_export_obj, mesh_get_stats, mesh_import_obj, mesh_mesh_intersect, mesh_plane_intersect, mesh_rotate, mesh_scale, mesh_translate, nurbs_curve_curve_intersect, nurbs_curve_plane_intersect, nurbs_surface_evaluate, nurbs_surface_plane_intersect, nurbs_surface_surface_intersect, offset_polyline_curve, polycurve_to_nurbs, polyline_length, polyline_point_at, ray_closest_point, ray_closest_point_parameter, ray_distance_to_point, ray_point_at, sample_nurbs_curve, sweep_curves, sweep_polylines, tessellate_nurbs_surface, test_wasm, version
9
9
  } from "./okgeometrycore_bg.js";
@@ -629,6 +629,26 @@ export function mesh_create_sphere(radius, segments, rings) {
629
629
  return v1;
630
630
  }
631
631
 
632
+ /**
633
+ * Evaluate a point on a mesh surface at parametric coordinates (u, v).
634
+ * Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
635
+ * then casts a ray perpendicular to the best-fit projection plane.
636
+ * Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
637
+ * @param {number} vertex_count
638
+ * @param {Float64Array} buffer
639
+ * @param {number} u
640
+ * @param {number} v
641
+ * @returns {Float64Array}
642
+ */
643
+ export function mesh_evaluate(vertex_count, buffer, u, v) {
644
+ const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
645
+ const len0 = WASM_VECTOR_LEN;
646
+ const ret = wasm.mesh_evaluate(vertex_count, ptr0, len0, u, v);
647
+ var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
648
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
649
+ return v2;
650
+ }
651
+
632
652
  /**
633
653
  * Export a mesh to OBJ format
634
654
  * Takes mesh buffers as input (same format as mesh_to_buffers output)
Binary file
@@ -35,6 +35,7 @@ export const mesh_create_cone: (a: number, b: number, c: number) => [number, num
35
35
  export const mesh_create_cylinder: (a: number, b: number, c: number) => [number, number];
36
36
  export const mesh_create_prism: (a: number, b: number, c: number) => [number, number];
37
37
  export const mesh_create_sphere: (a: number, b: number, c: number) => [number, number];
38
+ export const mesh_evaluate: (a: number, b: number, c: number, d: number, e: number) => [number, number];
38
39
  export const mesh_export_obj: (a: number, b: number, c: number) => [number, number];
39
40
  export const mesh_get_stats: (a: number, b: number, c: number) => [number, number];
40
41
  export const mesh_import_obj: (a: number, b: number) => [number, number];