@tscircuit/3d-viewer 0.0.475 → 0.0.476

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -32
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12563,31 +12563,29 @@ var require_extrudeHelical = __commonJS({
12563
12563
  "node_modules/@jscad/modeling/src/operations/extrusions/extrudeHelical.js"(exports, module) {
12564
12564
  "use strict";
12565
12565
  var { TAU } = require_constants();
12566
- var slice = require_slice();
12567
12566
  var mat4 = require_mat4();
12568
- var extrudeFromSlices = require_extrudeFromSlices();
12569
12567
  var geom2 = require_geom2();
12568
+ var extrudeFromSlices = require_extrudeFromSlices();
12569
+ var slice = require_slice();
12570
12570
  var extrudeHelical = (options, geometry) => {
12571
12571
  const defaults = {
12572
12572
  angle: TAU,
12573
12573
  startAngle: 0,
12574
12574
  pitch: 10,
12575
+ height: 0,
12575
12576
  endOffset: 0,
12576
12577
  segmentsPerRotation: 32
12577
12578
  };
12578
- const { angle, endOffset, segmentsPerRotation, startAngle } = Object.assign({}, defaults, options);
12579
- let pitch;
12580
- if (!options.pitch && options.height) {
12581
- pitch = options.height / (angle / TAU);
12582
- } else {
12583
- pitch = options.pitch ? options.pitch : defaults.pitch;
12579
+ let { angle, startAngle, pitch, height: height10, endOffset, segmentsPerRotation } = Object.assign({}, defaults, options);
12580
+ if (height10 != 0) {
12581
+ pitch = height10 / (angle / TAU);
12584
12582
  }
12585
12583
  const minNumberOfSegments = 3;
12586
12584
  if (segmentsPerRotation < minNumberOfSegments) {
12587
12585
  throw new Error("The number of segments per rotation needs to be at least 3.");
12588
12586
  }
12589
12587
  const shapeSides = geom2.toSides(geometry);
12590
- if (shapeSides.length === 0) throw new Error("the given geometry cannot be empty");
12588
+ if (shapeSides.length === 0) throw new Error("The given geometry cannot be empty");
12591
12589
  const pointsWithPositiveX = shapeSides.filter((s) => s[0][0] >= 0);
12592
12590
  let baseSlice = slice.fromSides(shapeSides);
12593
12591
  if (pointsWithPositiveX.length === 0) {
@@ -12596,7 +12594,7 @@ var require_extrudeHelical = __commonJS({
12596
12594
  const calculatedSegments = Math.round(segmentsPerRotation / TAU * Math.abs(angle));
12597
12595
  const segments = calculatedSegments >= 2 ? calculatedSegments : 2;
12598
12596
  const step1 = mat4.create();
12599
- let matrix;
12597
+ const step2 = mat4.create();
12600
12598
  const sliceCallback = (progress, index2, base) => {
12601
12599
  const zRotation = startAngle + angle / segments * index2;
12602
12600
  const xOffset = endOffset / segments * index2;
@@ -12609,14 +12607,13 @@ var require_extrudeHelical = __commonJS({
12609
12607
  mat4.fromXRotation(mat4.create(), -TAU / 4 * Math.sign(angle))
12610
12608
  // rotate the slice correctly to not create inside-out polygon
12611
12609
  );
12612
- matrix = mat4.create();
12613
12610
  mat4.multiply(
12614
- matrix,
12611
+ step2,
12615
12612
  // finally rotate around Z axis
12616
12613
  mat4.fromZRotation(mat4.create(), zRotation),
12617
12614
  step1
12618
12615
  );
12619
- return slice.transform(matrix, base);
12616
+ return slice.transform(step2, base);
12620
12617
  };
12621
12618
  return extrudeFromSlices(
12622
12619
  {
@@ -24792,7 +24789,7 @@ import {
24792
24789
  BufferGeometry,
24793
24790
  Matrix4
24794
24791
  } from "three";
24795
- var Fragment2 = Symbol("Fragment");
24792
+ var Fragment2 = /* @__PURE__ */ Symbol("Fragment");
24796
24793
  function h(type, props, ...restChildren) {
24797
24794
  const provided = restChildren.length ? restChildren : props?.children !== void 0 ? [props.children] : [];
24798
24795
  const flatChildren = [];
@@ -24810,20 +24807,20 @@ function h(type, props, ...restChildren) {
24810
24807
  children: flatChildren
24811
24808
  };
24812
24809
  }
24813
- var Cuboid = Symbol("Cuboid");
24814
- var Cube = Symbol("Cube");
24815
- var Cylinder = Symbol("Cylinder");
24816
- var Sphere = Symbol("Sphere");
24817
- var RoundedCuboid = Symbol("RoundedCuboid");
24818
- var Translate = Symbol("Translate");
24819
- var Rotate = Symbol("Rotate");
24820
- var Union = Symbol("Union");
24821
- var Subtract = Symbol("Subtract");
24822
- var Hull = Symbol("Hull");
24823
- var Colorize = Symbol("Colorize");
24824
- var Polygon = Symbol("Polygon");
24825
- var ExtrudeLinear = Symbol("ExtrudeLinear");
24826
- var RoundedCylinder = Symbol("RoundedCylinder");
24810
+ var Cuboid = /* @__PURE__ */ Symbol("Cuboid");
24811
+ var Cube = /* @__PURE__ */ Symbol("Cube");
24812
+ var Cylinder = /* @__PURE__ */ Symbol("Cylinder");
24813
+ var Sphere = /* @__PURE__ */ Symbol("Sphere");
24814
+ var RoundedCuboid = /* @__PURE__ */ Symbol("RoundedCuboid");
24815
+ var Translate = /* @__PURE__ */ Symbol("Translate");
24816
+ var Rotate = /* @__PURE__ */ Symbol("Rotate");
24817
+ var Union = /* @__PURE__ */ Symbol("Union");
24818
+ var Subtract = /* @__PURE__ */ Symbol("Subtract");
24819
+ var Hull = /* @__PURE__ */ Symbol("Hull");
24820
+ var Colorize = /* @__PURE__ */ Symbol("Colorize");
24821
+ var Polygon = /* @__PURE__ */ Symbol("Polygon");
24822
+ var ExtrudeLinear = /* @__PURE__ */ Symbol("ExtrudeLinear");
24823
+ var RoundedCylinder = /* @__PURE__ */ Symbol("RoundedCylinder");
24827
24824
  var Fragment22 = Fragment2;
24828
24825
  var jsx5 = (type, props, _key) => h(type, props);
24829
24826
  var jsxs = (type, props, _key) => h(type, props);
@@ -29495,7 +29492,7 @@ import * as THREE15 from "three";
29495
29492
  // package.json
29496
29493
  var package_default = {
29497
29494
  name: "@tscircuit/3d-viewer",
29498
- version: "0.0.474",
29495
+ version: "0.0.475",
29499
29496
  main: "./dist/index.js",
29500
29497
  module: "./dist/index.js",
29501
29498
  type: "module",
@@ -37402,7 +37399,6 @@ function useUncontrolledState({
37402
37399
  function isFunction(value) {
37403
37400
  return typeof value === "function";
37404
37401
  }
37405
- var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
37406
37402
 
37407
37403
  // node_modules/@radix-ui/react-primitive/dist/index.mjs
37408
37404
  import * as React17 from "react";
@@ -37452,7 +37448,7 @@ function createSlotClone(ownerName) {
37452
37448
  SlotClone.displayName = `${ownerName}.SlotClone`;
37453
37449
  return SlotClone;
37454
37450
  }
37455
- var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
37451
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
37456
37452
  function isSlottable(child) {
37457
37453
  return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
37458
37454
  }
@@ -37521,7 +37517,7 @@ var Primitive = NODES.reduce((primitive, node) => {
37521
37517
  const { asChild, ...primitiveProps } = props;
37522
37518
  const Comp = asChild ? Slot2 : node;
37523
37519
  if (typeof window !== "undefined") {
37524
- window[Symbol.for("radix-ui")] = true;
37520
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
37525
37521
  }
37526
37522
  return /* @__PURE__ */ jsx21(Comp, { ...primitiveProps, ref: forwardedRef });
37527
37523
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.475",
3
+ "version": "0.0.476",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",