okgeometry-api 1.17.0 → 1.18.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/Circle.ts CHANGED
@@ -63,9 +63,12 @@ export class Circle {
63
63
  }
64
64
 
65
65
  /**
66
- * Sample the circle into evenly-spaced points.
66
+ * Sample the circle into evenly-spaced points across the full closed
67
+ * parameter range INCLUSIVE of both ends: the last point coincides with
68
+ * the first (the seam). Consumers building a closed polygon from a circle
69
+ * must drop the final duplicate (see Mesh.buildPlanarCircle).
67
70
  * @param n - Number of points to generate
68
- * @returns Array of n points around the circle
71
+ * @returns Array of n points around the circle, first == last
69
72
  */
70
73
  sample(n: number): Point[] {
71
74
  ensureInit();
@@ -139,25 +142,25 @@ export class Circle {
139
142
  * @param caps - Whether to cap the ends (default true)
140
143
  * @returns Mesh representing the extruded cylinder
141
144
  */
142
- extrude(direction: Vec3, segments = 16, caps = true): Mesh {
143
- ensureInit();
144
- const buf = wasm.extrude_circle(
145
- this.center.x, this.center.y, this.center.z,
146
- this.normal.x, this.normal.y, this.normal.z,
145
+ extrude(direction: Vec3, segments = 16, caps = true): Mesh {
146
+ ensureInit();
147
+ const buf = wasm.extrude_circle(
148
+ this.center.x, this.center.y, this.center.z,
149
+ this.normal.x, this.normal.y, this.normal.z,
147
150
  this.radius,
148
151
  direction.x, direction.y, direction.z,
149
152
  segments, caps
150
- );
151
- return Mesh.fromBuffer(buf);
152
- }
153
-
154
- /**
155
- * Extrude this closed circle into a trusted solid suitable for booleans.
156
- * @param direction - Extrusion direction and magnitude
157
- * @param segments - Number of boundary samples used for tessellation (default 32)
158
- * @returns Closed mesh solid ready for boolean operations
159
- */
160
- extrudeAsSolid(direction: Vec3, segments = 32): Mesh {
161
- return Mesh.extrudeCurveAsSolid(this, direction, segments);
162
- }
163
- }
153
+ );
154
+ return Mesh.fromBuffer(buf);
155
+ }
156
+
157
+ /**
158
+ * Extrude this closed circle into a trusted solid suitable for booleans.
159
+ * @param direction - Extrusion direction and magnitude
160
+ * @param segments - Number of boundary samples used for tessellation (default 32)
161
+ * @returns Closed mesh solid ready for boolean operations
162
+ */
163
+ extrudeAsSolid(direction: Vec3, segments = 32): Mesh {
164
+ return Mesh.extrudeCurveAsSolid(this, direction, segments);
165
+ }
166
+ }