From 0a0d2e8e4ac5db50cf9a6f05a33dba9bdd68c98a Mon Sep 17 00:00:00 2001 From: Kenny Date: Sat, 12 Aug 2023 18:15:30 -0700 Subject: [PATCH] fix(modeling): use modern typescript imports --- packages/modeling/global.d.ts | 15 ++++ .../modeling/src/colors/colorNameToRgb.d.ts | 2 +- .../modeling/src/colors/colorNameToRgb.js | 2 +- packages/modeling/src/colors/colorize.d.ts | 6 +- packages/modeling/src/colors/colorize.js | 2 +- packages/modeling/src/colors/cssColors.d.ts | 2 +- packages/modeling/src/colors/hexToRgb.d.ts | 2 +- packages/modeling/src/colors/hexToRgb.js | 2 +- packages/modeling/src/colors/hslToRgb.d.ts | 2 +- packages/modeling/src/colors/hsvToRgb.d.ts | 2 +- .../src/colors/hueToColorComponent.js | 2 +- packages/modeling/src/colors/index.d.ts | 23 +++---- packages/modeling/src/colors/rgbToHex.d.ts | 2 +- packages/modeling/src/colors/rgbToHsl.d.ts | 2 +- packages/modeling/src/colors/rgbToHsv.d.ts | 2 +- packages/modeling/src/connectors/extends.js | 2 +- .../src/connectors/fromPointAxisNormal.js | 6 +- packages/modeling/src/connectors/transform.js | 2 +- .../src/connectors/transformationBetween.js | 12 ++-- .../src/curves/bezier/arcLengthToT.d.ts | 2 +- .../src/curves/bezier/arcLengthToT.js | 8 +-- .../modeling/src/curves/bezier/create.d.ts | 2 +- .../modeling/src/curves/bezier/index.d.ts | 15 ++-- .../modeling/src/curves/bezier/length.d.ts | 2 +- packages/modeling/src/curves/bezier/length.js | 4 +- .../modeling/src/curves/bezier/lengths.d.ts | 2 +- .../modeling/src/curves/bezier/lengths.js | 6 +- .../modeling/src/curves/bezier/tangentAt.d.ts | 2 +- .../modeling/src/curves/bezier/tangentAt.js | 2 +- packages/modeling/src/curves/bezier/type.d.ts | 2 - .../modeling/src/curves/bezier/valueAt.d.ts | 2 +- .../modeling/src/curves/bezier/valueAt.js | 2 +- packages/modeling/src/curves/index.d.ts | 4 +- .../src/geometries/geom2/applyTransforms.js | 4 +- .../modeling/src/geometries/geom2/clone.d.ts | 2 +- .../modeling/src/geometries/geom2/clone.js | 4 +- .../modeling/src/geometries/geom2/create.d.ts | 4 +- .../modeling/src/geometries/geom2/create.js | 5 +- .../geometries/geom2/fromCompactBinary.d.ts | 2 +- .../src/geometries/geom2/fromCompactBinary.js | 2 +- .../src/geometries/geom2/fromSides.d.ts | 4 +- .../src/geometries/geom2/fromSides.js | 2 +- .../modeling/src/geometries/geom2/index.d.ts | 28 ++++---- .../modeling/src/geometries/geom2/isA.d.ts | 2 +- packages/modeling/src/geometries/geom2/isA.js | 2 +- .../src/geometries/geom2/reverse.d.ts | 2 +- .../modeling/src/geometries/geom2/reverse.js | 4 +- .../src/geometries/geom2/toCompactBinary.d.ts | 2 +- .../src/geometries/geom2/toCompactBinary.js | 2 +- .../src/geometries/geom2/toOutlines.d.ts | 4 +- .../src/geometries/geom2/toOutlines.js | 2 +- .../src/geometries/geom2/toPoints.d.ts | 4 +- .../modeling/src/geometries/geom2/toPoints.js | 2 +- .../src/geometries/geom2/toSides.d.ts | 4 +- .../modeling/src/geometries/geom2/toSides.js | 2 +- .../src/geometries/geom2/toString.d.ts | 2 +- .../modeling/src/geometries/geom2/toString.js | 4 +- .../src/geometries/geom2/transform.d.ts | 4 +- .../src/geometries/geom2/transform.js | 6 +- .../modeling/src/geometries/geom2/type.d.ts | 6 +- .../modeling/src/geometries/geom2/validate.js | 2 +- .../src/geometries/geom2/validate.test.js | 9 +-- .../src/geometries/geom3/applyTransforms.js | 4 +- .../modeling/src/geometries/geom3/clone.d.ts | 2 +- .../modeling/src/geometries/geom3/clone.js | 4 +- .../modeling/src/geometries/geom3/create.d.ts | 4 +- .../modeling/src/geometries/geom3/create.js | 5 +- .../geometries/geom3/fromCompactBinary.d.ts | 2 +- .../src/geometries/geom3/fromCompactBinary.js | 2 +- .../src/geometries/geom3/fromPoints.d.ts | 4 +- .../src/geometries/geom3/fromPoints.js | 4 +- .../modeling/src/geometries/geom3/index.d.ts | 26 +++---- .../modeling/src/geometries/geom3/invert.d.ts | 2 +- .../modeling/src/geometries/geom3/invert.js | 4 +- .../modeling/src/geometries/geom3/isA.d.ts | 2 +- packages/modeling/src/geometries/geom3/isA.js | 2 +- .../src/geometries/geom3/toCompactBinary.d.ts | 2 +- .../src/geometries/geom3/toCompactBinary.js | 2 +- .../src/geometries/geom3/toPoints.d.ts | 4 +- .../modeling/src/geometries/geom3/toPoints.js | 2 +- .../src/geometries/geom3/toPolygons.d.ts | 4 +- .../src/geometries/geom3/toPolygons.js | 2 +- .../src/geometries/geom3/toString.d.ts | 2 +- .../modeling/src/geometries/geom3/toString.js | 4 +- .../src/geometries/geom3/transform.d.ts | 4 +- .../src/geometries/geom3/transform.js | 6 +- .../modeling/src/geometries/geom3/type.d.ts | 6 +- .../modeling/src/geometries/geom3/validate.js | 2 +- packages/modeling/src/geometries/index.d.ts | 14 ++-- .../src/geometries/path2/appendArc.d.ts | 4 +- .../src/geometries/path2/appendArc.js | 18 ++--- .../src/geometries/path2/appendArc.test.js | 3 +- .../src/geometries/path2/appendBezier.d.ts | 4 +- .../src/geometries/path2/appendBezier.js | 8 +-- .../src/geometries/path2/appendPoints.d.ts | 4 +- .../src/geometries/path2/appendPoints.js | 4 +- .../modeling/src/geometries/path2/clone.d.ts | 2 +- .../modeling/src/geometries/path2/clone.js | 4 +- .../modeling/src/geometries/path2/close.d.ts | 2 +- .../modeling/src/geometries/path2/close.js | 4 +- .../modeling/src/geometries/path2/concat.d.ts | 2 +- .../modeling/src/geometries/path2/concat.js | 4 +- .../modeling/src/geometries/path2/create.d.ts | 4 +- .../modeling/src/geometries/path2/create.js | 7 +- .../modeling/src/geometries/path2/equals.d.ts | 2 +- .../modeling/src/geometries/path2/equals.js | 4 +- .../geometries/path2/fromCompactBinary.d.ts | 2 +- .../src/geometries/path2/fromCompactBinary.js | 2 +- .../src/geometries/path2/fromPoints.d.ts | 4 +- .../src/geometries/path2/fromPoints.js | 6 +- .../modeling/src/geometries/path2/index.d.ts | 36 +++++----- .../modeling/src/geometries/path2/isA.d.ts | 2 +- packages/modeling/src/geometries/path2/isA.js | 2 +- .../src/geometries/path2/reverse.d.ts | 2 +- .../modeling/src/geometries/path2/reverse.js | 4 +- .../src/geometries/path2/toCompactBinary.d.ts | 2 +- .../src/geometries/path2/toCompactBinary.js | 2 +- .../src/geometries/path2/toPoints.d.ts | 4 +- .../modeling/src/geometries/path2/toPoints.js | 2 +- .../src/geometries/path2/toString.d.ts | 2 +- .../modeling/src/geometries/path2/toString.js | 4 +- .../src/geometries/path2/transform.d.ts | 4 +- .../src/geometries/path2/transform.js | 6 +- .../modeling/src/geometries/path2/type.d.ts | 6 +- .../modeling/src/geometries/path2/validate.js | 2 +- .../src/geometries/poly2/arePointsInside.d.ts | 4 +- .../src/geometries/poly2/arePointsInside.js | 2 +- .../modeling/src/geometries/poly2/clone.d.ts | 2 +- .../modeling/src/geometries/poly2/clone.js | 4 +- .../modeling/src/geometries/poly2/create.d.ts | 4 +- .../modeling/src/geometries/poly2/create.js | 3 +- .../modeling/src/geometries/poly2/index.d.ts | 28 ++++---- .../modeling/src/geometries/poly2/isA.d.ts | 2 +- packages/modeling/src/geometries/poly2/isA.js | 2 +- .../src/geometries/poly2/isConvex.d.ts | 2 +- .../modeling/src/geometries/poly2/isConvex.js | 2 +- .../src/geometries/poly2/isSimple.d.ts | 2 +- .../modeling/src/geometries/poly2/isSimple.js | 2 +- .../src/geometries/poly2/measureArea.d.ts | 2 +- .../src/geometries/poly2/measureArea.js | 4 +- .../geometries/poly2/measureBoundingBox.d.ts | 4 +- .../geometries/poly2/measureBoundingBox.js | 2 +- .../src/geometries/poly2/reverse.d.ts | 2 +- .../modeling/src/geometries/poly2/reverse.js | 4 +- .../src/geometries/poly2/toPoints.d.ts | 4 +- .../modeling/src/geometries/poly2/toPoints.js | 2 +- .../src/geometries/poly2/toString.d.ts | 2 +- .../modeling/src/geometries/poly2/toString.js | 2 +- .../src/geometries/poly2/transform.d.ts | 4 +- .../src/geometries/poly2/transform.js | 6 +- .../modeling/src/geometries/poly2/type.d.ts | 2 +- .../modeling/src/geometries/poly2/validate.js | 2 +- .../modeling/src/geometries/poly3/clone.d.ts | 2 +- .../modeling/src/geometries/poly3/clone.js | 6 +- .../modeling/src/geometries/poly3/create.d.ts | 4 +- .../modeling/src/geometries/poly3/create.js | 3 +- .../poly3/fromVerticesAndPlane.d.ts | 6 +- .../geometries/poly3/fromVerticesAndPlane.js | 4 +- .../modeling/src/geometries/poly3/index.d.ts | 32 ++++----- .../modeling/src/geometries/poly3/invert.d.ts | 2 +- .../modeling/src/geometries/poly3/invert.js | 4 +- .../modeling/src/geometries/poly3/isA.d.ts | 2 +- packages/modeling/src/geometries/poly3/isA.js | 2 +- .../src/geometries/poly3/isConvex.d.ts | 2 +- .../modeling/src/geometries/poly3/isConvex.js | 2 +- .../src/geometries/poly3/measureArea.d.ts | 2 +- .../src/geometries/poly3/measureArea.js | 4 +- .../geometries/poly3/measureBoundingBox.d.ts | 4 +- .../geometries/poly3/measureBoundingBox.js | 2 +- .../poly3/measureBoundingSphere.d.ts | 4 +- .../geometries/poly3/measureBoundingSphere.js | 4 +- .../geometries/poly3/measureSignedVolume.d.ts | 2 +- .../geometries/poly3/measureSignedVolume.js | 4 +- .../modeling/src/geometries/poly3/plane.d.ts | 4 +- .../src/geometries/poly3/toString.d.ts | 2 +- .../modeling/src/geometries/poly3/toString.js | 2 +- .../src/geometries/poly3/toVertices.d.ts | 4 +- .../src/geometries/poly3/toVertices.js | 2 +- .../src/geometries/poly3/transform.d.ts | 4 +- .../src/geometries/poly3/transform.js | 6 +- .../modeling/src/geometries/poly3/type.d.ts | 7 +- .../modeling/src/geometries/poly3/validate.js | 2 +- .../src/geometries/slice/calculatePlane.d.ts | 4 +- .../src/geometries/slice/calculatePlane.js | 10 +-- .../modeling/src/geometries/slice/clone.d.ts | 2 +- .../modeling/src/geometries/slice/clone.js | 4 +- .../modeling/src/geometries/slice/create.d.ts | 4 +- .../modeling/src/geometries/slice/create.js | 3 +- .../geometries/slice/earcut/assignHoles.js | 2 +- .../modeling/src/geometries/slice/equals.d.ts | 2 +- .../modeling/src/geometries/slice/equals.js | 4 +- .../src/geometries/slice/fromGeom2.d.ts | 4 +- .../src/geometries/slice/fromGeom2.js | 4 +- .../src/geometries/slice/fromVertices.d.ts | 4 +- .../src/geometries/slice/fromVertices.js | 2 +- .../modeling/src/geometries/slice/index.d.ts | 28 ++++---- .../modeling/src/geometries/slice/isA.d.ts | 2 +- packages/modeling/src/geometries/slice/isA.js | 2 +- .../src/geometries/slice/reverse.d.ts | 2 +- .../modeling/src/geometries/slice/reverse.js | 4 +- .../src/geometries/slice/toEdges.d.ts | 2 +- .../modeling/src/geometries/slice/toEdges.js | 2 +- .../src/geometries/slice/toPolygons.d.ts | 4 +- .../src/geometries/slice/toPolygons.js | 2 +- .../src/geometries/slice/toString.d.ts | 2 +- .../modeling/src/geometries/slice/toString.js | 2 +- .../src/geometries/slice/toVertices.d.ts | 4 +- .../src/geometries/slice/toVertices.js | 2 +- .../src/geometries/slice/transform.d.ts | 4 +- .../src/geometries/slice/transform.js | 6 +- .../modeling/src/geometries/slice/type.d.ts | 2 +- packages/modeling/src/geometries/types.d.ts | 24 +++---- packages/modeling/src/index.d.ts | 2 - packages/modeling/src/maths/index.d.ts | 20 +++--- packages/modeling/src/maths/line2/clone.d.ts | 2 +- packages/modeling/src/maths/line2/clone.js | 4 +- .../src/maths/line2/closestPoint.d.ts | 4 +- .../modeling/src/maths/line2/closestPoint.js | 6 +- packages/modeling/src/maths/line2/copy.d.ts | 2 +- packages/modeling/src/maths/line2/copy.js | 6 +- packages/modeling/src/maths/line2/create.d.ts | 2 +- packages/modeling/src/maths/line2/create.js | 3 +- .../modeling/src/maths/line2/direction.d.ts | 4 +- .../modeling/src/maths/line2/direction.js | 4 +- .../src/maths/line2/distanceToPoint.d.ts | 4 +- .../src/maths/line2/distanceToPoint.js | 6 +- packages/modeling/src/maths/line2/equals.d.ts | 2 +- packages/modeling/src/maths/line2/equals.js | 6 +- .../modeling/src/maths/line2/fromPoints.d.ts | 4 +- .../modeling/src/maths/line2/fromPoints.js | 8 +-- .../modeling/src/maths/line2/fromValues.d.ts | 2 +- .../modeling/src/maths/line2/fromValues.js | 8 +-- packages/modeling/src/maths/line2/index.d.ts | 33 +++++---- .../maths/line2/intersectPointOfLines.d.ts | 4 +- .../src/maths/line2/intersectPointOfLines.js | 6 +- packages/modeling/src/maths/line2/origin.d.ts | 4 +- packages/modeling/src/maths/line2/origin.js | 4 +- .../modeling/src/maths/line2/reverse.d.ts | 2 +- packages/modeling/src/maths/line2/reverse.js | 6 +- .../modeling/src/maths/line2/toString.d.ts | 2 +- packages/modeling/src/maths/line2/toString.js | 4 +- .../modeling/src/maths/line2/transform.d.ts | 4 +- .../modeling/src/maths/line2/transform.js | 8 +-- packages/modeling/src/maths/line2/xAtY.d.ts | 2 +- packages/modeling/src/maths/line2/xAtY.js | 6 +- packages/modeling/src/maths/line3/clone.d.ts | 2 +- packages/modeling/src/maths/line3/clone.js | 4 +- .../src/maths/line3/closestPoint.d.ts | 4 +- .../modeling/src/maths/line3/closestPoint.js | 6 +- packages/modeling/src/maths/line3/copy.d.ts | 2 +- packages/modeling/src/maths/line3/copy.js | 6 +- packages/modeling/src/maths/line3/create.d.ts | 2 +- packages/modeling/src/maths/line3/create.js | 3 +- .../modeling/src/maths/line3/direction.d.ts | 4 +- .../modeling/src/maths/line3/direction.js | 4 +- .../src/maths/line3/distanceToPoint.d.ts | 4 +- .../src/maths/line3/distanceToPoint.js | 6 +- packages/modeling/src/maths/line3/equals.d.ts | 2 +- packages/modeling/src/maths/line3/equals.js | 4 +- .../modeling/src/maths/line3/fromPlanes.d.ts | 4 +- .../modeling/src/maths/line3/fromPlanes.js | 8 +-- .../maths/line3/fromPointAndDirection.d.ts | 4 +- .../src/maths/line3/fromPointAndDirection.js | 8 +-- .../modeling/src/maths/line3/fromPoints.d.ts | 4 +- .../modeling/src/maths/line3/fromPoints.js | 8 +-- packages/modeling/src/maths/line3/index.d.ts | 33 +++++---- .../line3/intersectPointOfLineAndPlane.d.ts | 6 +- .../line3/intersectPointOfLineAndPlane.js | 6 +- packages/modeling/src/maths/line3/origin.d.ts | 4 +- packages/modeling/src/maths/line3/origin.js | 4 +- .../modeling/src/maths/line3/reverse.d.ts | 2 +- packages/modeling/src/maths/line3/reverse.js | 6 +- .../modeling/src/maths/line3/toString.d.ts | 2 +- packages/modeling/src/maths/line3/toString.js | 4 +- .../modeling/src/maths/line3/transform.d.ts | 4 +- .../modeling/src/maths/line3/transform.js | 8 +-- packages/modeling/src/maths/line3/type.d.ts | 2 +- packages/modeling/src/maths/mat4/add.d.ts | 2 +- packages/modeling/src/maths/mat4/add.js | 8 +-- packages/modeling/src/maths/mat4/clone.d.ts | 2 +- packages/modeling/src/maths/mat4/clone.js | 4 +- packages/modeling/src/maths/mat4/copy.d.ts | 2 +- packages/modeling/src/maths/mat4/copy.js | 6 +- packages/modeling/src/maths/mat4/create.d.ts | 2 +- packages/modeling/src/maths/mat4/create.js | 3 +- packages/modeling/src/maths/mat4/equals.d.ts | 2 +- packages/modeling/src/maths/mat4/equals.js | 4 +- .../modeling/src/maths/mat4/fromRotation.d.ts | 4 +- .../modeling/src/maths/mat4/fromRotation.js | 8 +-- .../modeling/src/maths/mat4/fromScaling.d.ts | 4 +- .../modeling/src/maths/mat4/fromScaling.js | 6 +- .../src/maths/mat4/fromTaitBryanRotation.d.ts | 2 +- .../src/maths/mat4/fromTaitBryanRotation.js | 10 +-- .../src/maths/mat4/fromTranslation.d.ts | 4 +- .../src/maths/mat4/fromTranslation.js | 6 +- .../modeling/src/maths/mat4/fromValues.d.ts | 2 +- .../modeling/src/maths/mat4/fromValues.js | 34 ++++----- .../src/maths/mat4/fromVectorRotation.d.ts | 4 +- .../src/maths/mat4/fromVectorRotation.js | 8 +-- .../src/maths/mat4/fromXRotation.d.ts | 2 +- .../modeling/src/maths/mat4/fromXRotation.js | 6 +- .../src/maths/mat4/fromYRotation.d.ts | 2 +- .../modeling/src/maths/mat4/fromYRotation.js | 6 +- .../src/maths/mat4/fromZRotation.d.ts | 2 +- .../modeling/src/maths/mat4/fromZRotation.js | 6 +- .../modeling/src/maths/mat4/identity.d.ts | 2 +- packages/modeling/src/maths/mat4/identity.js | 4 +- packages/modeling/src/maths/mat4/index.d.ts | 57 +++++++-------- packages/modeling/src/maths/mat4/index.js | 4 +- packages/modeling/src/maths/mat4/invert.js | 6 +- .../modeling/src/maths/mat4/isIdentity.js | 2 +- .../modeling/src/maths/mat4/isMirroring.d.ts | 2 +- .../modeling/src/maths/mat4/isMirroring.js | 2 +- .../src/maths/mat4/isOnlyTransformScale.js | 2 +- .../src/maths/mat4/leftMultiplyVec2.d.ts | 4 +- .../src/maths/mat4/leftMultiplyVec2.js | 6 +- .../src/maths/mat4/leftMultiplyVec3.d.ts | 4 +- .../src/maths/mat4/leftMultiplyVec3.js | 6 +- packages/modeling/src/maths/mat4/mirror.d.ts | 4 +- packages/modeling/src/maths/mat4/mirror.js | 8 +-- .../src/maths/mat4/mirrorByPlane.d.ts | 4 +- .../modeling/src/maths/mat4/mirrorByPlane.js | 6 +- .../modeling/src/maths/mat4/multiply.d.ts | 2 +- packages/modeling/src/maths/mat4/multiply.js | 8 +-- .../src/maths/mat4/rightMultiplyVec2.d.ts | 4 +- .../src/maths/mat4/rightMultiplyVec2.js | 6 +- .../src/maths/mat4/rightMultiplyVec3.d.ts | 4 +- .../src/maths/mat4/rightMultiplyVec3.js | 6 +- packages/modeling/src/maths/mat4/rotate.d.ts | 4 +- packages/modeling/src/maths/mat4/rotate.js | 10 +-- .../modeling/src/maths/mat4/rotate.test.js | 4 +- packages/modeling/src/maths/mat4/rotateX.d.ts | 2 +- packages/modeling/src/maths/mat4/rotateX.js | 8 +-- packages/modeling/src/maths/mat4/rotateY.d.ts | 2 +- packages/modeling/src/maths/mat4/rotateY.js | 8 +-- packages/modeling/src/maths/mat4/rotateZ.d.ts | 2 +- packages/modeling/src/maths/mat4/rotateZ.js | 8 +-- packages/modeling/src/maths/mat4/scale.d.ts | 4 +- packages/modeling/src/maths/mat4/scale.js | 8 +-- .../modeling/src/maths/mat4/subtract.d.ts | 2 +- packages/modeling/src/maths/mat4/subtract.js | 8 +-- .../modeling/src/maths/mat4/toString.d.ts | 2 +- packages/modeling/src/maths/mat4/toString.js | 4 +- .../modeling/src/maths/mat4/translate.d.ts | 4 +- packages/modeling/src/maths/mat4/translate.js | 8 +-- .../modeling/src/maths/mat4/translate.test.js | 21 +++--- packages/modeling/src/maths/plane/clone.d.ts | 2 +- packages/modeling/src/maths/plane/copy.d.ts | 2 +- packages/modeling/src/maths/plane/create.d.ts | 2 +- packages/modeling/src/maths/plane/equals.d.ts | 2 +- packages/modeling/src/maths/plane/flip.d.ts | 2 +- packages/modeling/src/maths/plane/flip.js | 6 +- .../src/maths/plane/fromNormalAndPoint.d.ts | 4 +- .../src/maths/plane/fromNormalAndPoint.js | 9 ++- .../modeling/src/maths/plane/fromPoints.d.ts | 4 +- .../modeling/src/maths/plane/fromPoints.js | 4 +- .../src/maths/plane/fromPointsRandom.d.ts | 4 +- .../src/maths/plane/fromPointsRandom.js | 10 +-- .../modeling/src/maths/plane/fromValues.d.ts | 2 +- packages/modeling/src/maths/plane/index.d.ts | 29 ++++---- .../src/maths/plane/projectionOfPoint.d.ts | 4 +- .../src/maths/plane/projectionOfPoint.js | 6 +- .../maths/plane/signedDistanceToPoint.d.ts | 4 +- .../src/maths/plane/signedDistanceToPoint.js | 6 +- .../modeling/src/maths/plane/toString.d.ts | 2 +- .../modeling/src/maths/plane/transform.d.ts | 4 +- .../modeling/src/maths/plane/transform.js | 8 +-- packages/modeling/src/maths/types.d.ts | 23 ++++--- .../src/maths/utils/OrthonormalFormula.d.ts | 6 +- .../src/maths/utils/OrthonormalFormula.js | 14 ++-- .../maths/utils/OrthonormalFormula.test.js | 13 ++-- .../src/maths/utils/aboutEqualNormals.d.ts | 2 +- .../src/maths/utils/aboutEqualNormals.js | 4 +- packages/modeling/src/maths/utils/area.d.ts | 2 +- packages/modeling/src/maths/utils/area.js | 2 +- packages/modeling/src/maths/utils/index.d.ts | 16 ++--- .../utils/interpolateBetween2DPointsForY.d.ts | 2 +- .../utils/interpolateBetween2DPointsForY.js | 6 +- .../modeling/src/maths/utils/intersect.d.ts | 4 +- .../modeling/src/maths/utils/intersect.js | 12 ++-- .../src/maths/utils/intersect.test.js | 15 ++-- .../src/maths/utils/solve2Linear.d.ts | 2 +- .../modeling/src/maths/utils/trigonometry.js | 8 +-- packages/modeling/src/maths/vec2/abs.d.ts | 2 +- packages/modeling/src/maths/vec2/abs.js | 6 +- packages/modeling/src/maths/vec2/add.d.ts | 2 +- packages/modeling/src/maths/vec2/add.js | 8 +-- packages/modeling/src/maths/vec2/angle.d.ts | 2 +- .../modeling/src/maths/vec2/angleDegrees.d.ts | 2 +- .../modeling/src/maths/vec2/angleDegrees.js | 4 +- .../modeling/src/maths/vec2/angleRadians.d.ts | 2 +- .../modeling/src/maths/vec2/angleRadians.js | 4 +- packages/modeling/src/maths/vec2/clone.d.ts | 2 +- packages/modeling/src/maths/vec2/clone.js | 4 +- packages/modeling/src/maths/vec2/copy.d.ts | 2 +- packages/modeling/src/maths/vec2/copy.js | 6 +- packages/modeling/src/maths/vec2/create.d.ts | 2 +- packages/modeling/src/maths/vec2/create.js | 3 +- packages/modeling/src/maths/vec2/cross.d.ts | 4 +- packages/modeling/src/maths/vec2/cross.js | 8 +-- .../modeling/src/maths/vec2/cross.test.js | 19 ++--- .../modeling/src/maths/vec2/distance.d.ts | 2 +- packages/modeling/src/maths/vec2/distance.js | 6 +- packages/modeling/src/maths/vec2/divide.d.ts | 2 +- packages/modeling/src/maths/vec2/divide.js | 8 +-- packages/modeling/src/maths/vec2/dot.d.ts | 2 +- packages/modeling/src/maths/vec2/dot.js | 6 +- packages/modeling/src/maths/vec2/equals.d.ts | 2 +- packages/modeling/src/maths/vec2/equals.js | 4 +- .../src/maths/vec2/fromAngleDegrees.d.ts | 2 +- .../src/maths/vec2/fromAngleDegrees.js | 6 +- .../src/maths/vec2/fromAngleRadians.d.ts | 2 +- .../src/maths/vec2/fromAngleRadians.js | 6 +- .../modeling/src/maths/vec2/fromScalar.d.ts | 2 +- .../modeling/src/maths/vec2/fromScalar.js | 6 +- .../modeling/src/maths/vec2/fromValues.d.ts | 2 +- .../modeling/src/maths/vec2/fromValues.js | 6 +- packages/modeling/src/maths/vec2/index.d.ts | 69 +++++++++---------- packages/modeling/src/maths/vec2/length.d.ts | 2 +- packages/modeling/src/maths/vec2/length.js | 4 +- packages/modeling/src/maths/vec2/lerp.d.ts | 2 +- packages/modeling/src/maths/vec2/lerp.js | 10 +-- packages/modeling/src/maths/vec2/max.d.ts | 2 +- packages/modeling/src/maths/vec2/max.js | 8 +-- packages/modeling/src/maths/vec2/min.d.ts | 2 +- packages/modeling/src/maths/vec2/min.js | 8 +-- .../modeling/src/maths/vec2/multiply.d.ts | 2 +- packages/modeling/src/maths/vec2/multiply.js | 8 +-- packages/modeling/src/maths/vec2/negate.d.ts | 2 +- packages/modeling/src/maths/vec2/negate.js | 6 +- packages/modeling/src/maths/vec2/normal.d.ts | 2 +- packages/modeling/src/maths/vec2/normal.js | 6 +- .../modeling/src/maths/vec2/normalize.d.ts | 2 +- packages/modeling/src/maths/vec2/normalize.js | 6 +- packages/modeling/src/maths/vec2/rotate.d.ts | 2 +- packages/modeling/src/maths/vec2/rotate.js | 10 +-- packages/modeling/src/maths/vec2/scale.d.ts | 2 +- packages/modeling/src/maths/vec2/scale.js | 8 +-- packages/modeling/src/maths/vec2/snap.d.ts | 2 +- packages/modeling/src/maths/vec2/snap.js | 8 +-- .../src/maths/vec2/squaredDistance.d.ts | 2 +- .../src/maths/vec2/squaredDistance.js | 6 +- .../src/maths/vec2/squaredLength.d.ts | 2 +- .../modeling/src/maths/vec2/squaredLength.js | 4 +- .../modeling/src/maths/vec2/subtract.d.ts | 2 +- packages/modeling/src/maths/vec2/subtract.js | 8 +-- .../modeling/src/maths/vec2/toString.d.ts | 2 +- packages/modeling/src/maths/vec2/toString.js | 4 +- .../modeling/src/maths/vec2/transform.d.ts | 4 +- packages/modeling/src/maths/vec2/transform.js | 8 +-- packages/modeling/src/maths/vec3/abs.d.ts | 2 +- packages/modeling/src/maths/vec3/abs.js | 6 +- packages/modeling/src/maths/vec3/add.d.ts | 2 +- packages/modeling/src/maths/vec3/add.js | 8 +-- packages/modeling/src/maths/vec3/angle.d.ts | 2 +- packages/modeling/src/maths/vec3/angle.js | 6 +- packages/modeling/src/maths/vec3/clone.d.ts | 2 +- packages/modeling/src/maths/vec3/clone.js | 4 +- packages/modeling/src/maths/vec3/copy.d.ts | 2 +- packages/modeling/src/maths/vec3/copy.js | 6 +- packages/modeling/src/maths/vec3/create.d.ts | 2 +- packages/modeling/src/maths/vec3/create.js | 3 +- packages/modeling/src/maths/vec3/cross.d.ts | 2 +- packages/modeling/src/maths/vec3/cross.js | 8 +-- .../modeling/src/maths/vec3/distance.d.ts | 2 +- packages/modeling/src/maths/vec3/distance.js | 6 +- packages/modeling/src/maths/vec3/divide.d.ts | 2 +- packages/modeling/src/maths/vec3/divide.js | 8 +-- packages/modeling/src/maths/vec3/dot.d.ts | 2 +- packages/modeling/src/maths/vec3/dot.js | 6 +- packages/modeling/src/maths/vec3/equals.d.ts | 2 +- packages/modeling/src/maths/vec3/equals.js | 4 +- .../modeling/src/maths/vec3/fromScalar.d.ts | 2 +- .../modeling/src/maths/vec3/fromScalar.js | 6 +- .../modeling/src/maths/vec3/fromValues.d.ts | 2 +- .../modeling/src/maths/vec3/fromValues.js | 8 +-- .../modeling/src/maths/vec3/fromVec2.d.ts | 4 +- packages/modeling/src/maths/vec3/fromVec2.js | 6 +- packages/modeling/src/maths/vec3/index.d.ts | 67 +++++++++--------- packages/modeling/src/maths/vec3/length.d.ts | 2 +- packages/modeling/src/maths/vec3/length.js | 4 +- packages/modeling/src/maths/vec3/lerp.d.ts | 2 +- packages/modeling/src/maths/vec3/lerp.js | 10 +-- packages/modeling/src/maths/vec3/max.d.ts | 2 +- packages/modeling/src/maths/vec3/max.js | 8 +-- packages/modeling/src/maths/vec3/min.d.ts | 2 +- packages/modeling/src/maths/vec3/min.js | 8 +-- .../modeling/src/maths/vec3/multiply.d.ts | 2 +- packages/modeling/src/maths/vec3/multiply.js | 8 +-- packages/modeling/src/maths/vec3/negate.d.ts | 2 +- packages/modeling/src/maths/vec3/negate.js | 6 +- .../modeling/src/maths/vec3/normalize.d.ts | 2 +- packages/modeling/src/maths/vec3/normalize.js | 6 +- .../modeling/src/maths/vec3/orthogonal.d.ts | 2 +- .../modeling/src/maths/vec3/orthogonal.js | 6 +- packages/modeling/src/maths/vec3/rotateX.d.ts | 2 +- packages/modeling/src/maths/vec3/rotateX.js | 10 +-- packages/modeling/src/maths/vec3/rotateY.d.ts | 2 +- packages/modeling/src/maths/vec3/rotateY.js | 10 +-- packages/modeling/src/maths/vec3/rotateZ.d.ts | 2 +- packages/modeling/src/maths/vec3/rotateZ.js | 10 +-- packages/modeling/src/maths/vec3/scale.d.ts | 2 +- packages/modeling/src/maths/vec3/scale.js | 8 +-- packages/modeling/src/maths/vec3/snap.d.ts | 2 +- packages/modeling/src/maths/vec3/snap.js | 8 +-- .../src/maths/vec3/squaredDistance.d.ts | 2 +- .../src/maths/vec3/squaredDistance.js | 6 +- .../src/maths/vec3/squaredLength.d.ts | 2 +- .../modeling/src/maths/vec3/squaredLength.js | 4 +- .../modeling/src/maths/vec3/subtract.d.ts | 2 +- packages/modeling/src/maths/vec3/subtract.js | 8 +-- .../modeling/src/maths/vec3/toString.d.ts | 2 +- packages/modeling/src/maths/vec3/toString.js | 4 +- .../modeling/src/maths/vec3/transform.d.ts | 4 +- packages/modeling/src/maths/vec3/transform.js | 8 +-- .../modeling/src/maths/vec3/transform.test.js | 20 +++--- packages/modeling/src/maths/vec4/clone.d.ts | 2 +- packages/modeling/src/maths/vec4/clone.js | 4 +- packages/modeling/src/maths/vec4/copy.d.ts | 2 +- packages/modeling/src/maths/vec4/copy.js | 6 +- packages/modeling/src/maths/vec4/create.d.ts | 2 +- packages/modeling/src/maths/vec4/create.js | 3 +- packages/modeling/src/maths/vec4/dot.d.ts | 2 +- packages/modeling/src/maths/vec4/dot.js | 6 +- packages/modeling/src/maths/vec4/equals.d.ts | 2 +- packages/modeling/src/maths/vec4/equals.js | 4 +- .../modeling/src/maths/vec4/fromScalar.d.ts | 2 +- .../modeling/src/maths/vec4/fromScalar.js | 4 +- .../modeling/src/maths/vec4/fromValues.d.ts | 2 +- .../modeling/src/maths/vec4/fromValues.js | 10 +-- packages/modeling/src/maths/vec4/index.d.ts | 21 +++--- .../modeling/src/maths/vec4/toString.d.ts | 2 +- packages/modeling/src/maths/vec4/toString.js | 4 +- .../modeling/src/maths/vec4/transform.d.ts | 4 +- packages/modeling/src/maths/vec4/transform.js | 9 +-- packages/modeling/src/measurements/index.d.ts | 27 ++++---- .../measurements/measureAggregateArea.d.ts | 4 +- .../src/measurements/measureAggregateArea.js | 2 +- .../measureAggregateBoundingBox.d.ts | 6 +- .../measurements/measureAggregateEpsilon.d.ts | 4 +- .../measurements/measureAggregateEpsilon.js | 2 +- .../measurements/measureAggregateVolume.d.ts | 4 +- .../measurements/measureAggregateVolume.js | 2 +- .../src/measurements/measureArea.d.ts | 4 +- .../modeling/src/measurements/measureArea.js | 14 ++-- .../src/measurements/measureBoundingBox.d.ts | 6 +- .../measurements/measureBoundingSphere.d.ts | 6 +- .../src/measurements/measureCenter.d.ts | 4 +- .../src/measurements/measureCenterOfMass.d.ts | 4 +- .../src/measurements/measureDimensions.d.ts | 4 +- .../src/measurements/measureEpsilon.d.ts | 4 +- .../src/measurements/measureEpsilon.js | 6 +- .../src/measurements/measureVolume.d.ts | 4 +- .../src/measurements/measureVolume.js | 8 +-- packages/modeling/src/measurements/types.d.ts | 2 +- .../src/operations/booleans/index.d.ts | 8 +-- .../src/operations/booleans/intersect.d.ts | 5 +- .../src/operations/booleans/intersect.js | 2 +- .../src/operations/booleans/intersectGeom2.js | 2 +- .../src/operations/booleans/intersectGeom3.js | 2 +- .../operations/booleans/intersectGeom3Sub.js | 6 +- .../booleans/martinez/compareEvents.js | 2 +- .../booleans/martinez/compareSegments.js | 2 +- .../booleans/martinez/connectEdges.js | 12 ++-- .../booleans/martinez/possibleIntersection.js | 2 +- .../booleans/martinez/segmentIntersection.js | 8 +-- .../booleans/martinez/signedArea.js | 2 +- .../booleans/martinez/sweepEvent.js | 6 +- .../src/operations/booleans/mayOverlap.js | 4 +- .../src/operations/booleans/subtract.d.ts | 5 +- .../src/operations/booleans/subtract.js | 2 +- .../src/operations/booleans/subtractGeom2.js | 2 +- .../src/operations/booleans/subtractGeom3.js | 2 +- .../operations/booleans/subtractGeom3Sub.js | 6 +- .../src/operations/booleans/union.d.ts | 5 +- .../modeling/src/operations/booleans/union.js | 2 +- .../src/operations/booleans/unionGeom2.js | 2 +- .../src/operations/booleans/unionGeom3.js | 2 +- .../src/operations/booleans/unionGeom3Sub.js | 6 +- .../extrusions/extrudeFromSlices.d.ts | 5 +- .../extrusions/extrudeFromSlices.js | 16 ++--- .../operations/extrusions/extrudeHelical.d.ts | 2 +- .../operations/extrusions/extrudeHelical.js | 18 ++--- .../operations/extrusions/extrudeLinear.d.ts | 4 +- .../operations/extrusions/extrudeLinear.js | 8 +-- .../extrusions/extrudeLinearGeom2.js | 12 ++-- .../extrusions/extrudeLinearPath2.js | 10 +-- .../extrusions/extrudeRectangular.d.ts | 6 +- .../extrusions/extrudeRectangular.js | 6 +- .../extrusions/extrudeRectangularGeom2.js | 10 +-- .../extrusions/extrudeRectangularPath2.js | 10 +-- .../operations/extrusions/extrudeRotate.d.ts | 2 +- .../operations/extrusions/extrudeRotate.js | 14 ++-- .../src/operations/extrusions/index.d.ts | 14 ++-- .../src/operations/extrusions/project.d.ts | 6 +- .../src/operations/extrusions/project.js | 4 +- .../modeling/src/operations/hulls/hull.d.ts | 4 +- .../modeling/src/operations/hulls/hull.js | 2 +- .../src/operations/hulls/hullChain.d.ts | 4 +- .../src/operations/hulls/hullChain.js | 2 +- .../src/operations/hulls/hullGeom2.js | 2 +- .../src/operations/hulls/hullGeom3.js | 2 +- .../src/operations/hulls/hullPath2.js | 2 +- .../modeling/src/operations/hulls/index.d.ts | 6 +- .../src/operations/modifiers/generalize.d.ts | 4 +- .../src/operations/modifiers/generalize.js | 8 +-- .../src/operations/modifiers/index.d.ts | 6 +- .../src/operations/modifiers/mergePolygons.js | 4 +- .../modifiers/reTesselateCoplanarPolygons.js | 4 +- .../operations/modifiers/retessellate.d.ts | 2 +- .../src/operations/modifiers/snap.d.ts | 4 +- .../src/operations/offsets/index.d.ts | 6 +- .../src/operations/offsets/offset.d.ts | 4 +- .../modeling/src/operations/offsets/offset.js | 6 +- .../operations/offsets/offsetFromPoints.d.ts | 2 +- .../operations/offsets/offsetFromPoints.js | 8 +-- .../src/operations/offsets/offsetGeom2.js | 10 +-- .../src/operations/offsets/offsetGeom3.js | 12 ++-- .../src/operations/offsets/offsetPath2.js | 12 ++-- .../src/operations/transforms/align.d.ts | 4 +- .../src/operations/transforms/align.js | 4 +- .../src/operations/transforms/center.d.ts | 6 +- .../src/operations/transforms/center.js | 2 +- .../src/operations/transforms/index.d.ts | 16 ++--- .../src/operations/transforms/mirror.d.ts | 6 +- .../src/operations/transforms/mirror.js | 2 +- .../src/operations/transforms/rotate.d.ts | 12 ++-- .../src/operations/transforms/rotate.js | 6 +- .../src/operations/transforms/scale.d.ts | 12 ++-- .../src/operations/transforms/scale.js | 6 +- .../src/operations/transforms/transform.d.ts | 6 +- .../src/operations/transforms/transform.js | 2 +- .../src/operations/transforms/translate.d.ts | 8 +-- .../src/operations/transforms/translate.js | 6 +- packages/modeling/src/primitives/arc.d.ts | 4 +- packages/modeling/src/primitives/arc.js | 14 ++-- packages/modeling/src/primitives/circle.d.ts | 4 +- packages/modeling/src/primitives/circle.js | 12 ++-- packages/modeling/src/primitives/cube.d.ts | 4 +- packages/modeling/src/primitives/cube.js | 6 +- packages/modeling/src/primitives/cuboid.d.ts | 4 +- packages/modeling/src/primitives/cuboid.js | 4 +- .../modeling/src/primitives/cylinder.d.ts | 4 +- packages/modeling/src/primitives/cylinder.js | 10 +-- .../src/primitives/cylinderElliptic.d.ts | 4 +- .../src/primitives/cylinderElliptic.js | 12 ++-- packages/modeling/src/primitives/ellipse.d.ts | 4 +- packages/modeling/src/primitives/ellipse.js | 10 +-- .../modeling/src/primitives/ellipsoid.d.ts | 4 +- packages/modeling/src/primitives/ellipsoid.js | 6 +- .../src/primitives/geodesicSphere.d.ts | 2 +- .../modeling/src/primitives/geodesicSphere.js | 8 +-- packages/modeling/src/primitives/index.d.ts | 44 ++++++------ packages/modeling/src/primitives/line.d.ts | 4 +- packages/modeling/src/primitives/line.js | 2 +- packages/modeling/src/primitives/polygon.d.ts | 4 +- packages/modeling/src/primitives/polygon.js | 4 +- .../modeling/src/primitives/polyhedron.d.ts | 6 +- .../modeling/src/primitives/polyhedron.js | 6 +- .../modeling/src/primitives/rectangle.d.ts | 4 +- packages/modeling/src/primitives/rectangle.js | 4 +- .../src/primitives/roundedCuboid.d.ts | 4 +- .../modeling/src/primitives/roundedCuboid.js | 8 +-- .../src/primitives/roundedCylinder.d.ts | 4 +- .../src/primitives/roundedCylinder.js | 12 ++-- .../src/primitives/roundedRectangle.d.ts | 4 +- .../src/primitives/roundedRectangle.js | 8 +-- packages/modeling/src/primitives/sphere.d.ts | 4 +- packages/modeling/src/primitives/sphere.js | 8 +-- packages/modeling/src/primitives/square.d.ts | 4 +- packages/modeling/src/primitives/square.js | 6 +- packages/modeling/src/primitives/star.d.ts | 4 +- packages/modeling/src/primitives/star.js | 14 ++-- packages/modeling/src/primitives/torus.d.ts | 2 +- packages/modeling/src/primitives/torus.js | 18 ++--- .../modeling/src/primitives/triangle.d.ts | 2 +- packages/modeling/src/primitives/triangle.js | 6 +- packages/modeling/src/text/index.d.ts | 6 +- packages/modeling/src/text/vectorChar.d.ts | 2 +- packages/modeling/src/text/vectorChar.js | 6 +- packages/modeling/src/text/vectorText.d.ts | 2 +- packages/modeling/src/text/vectorText.js | 20 +++--- .../src/utils/areAllShapesTheSameType.d.ts | 2 +- packages/modeling/src/utils/degToRad.js | 4 +- packages/modeling/src/utils/flatten.d.ts | 2 +- packages/modeling/src/utils/index.d.ts | 18 +++-- .../modeling/src/utils/padArrayToLength.js | 2 +- packages/modeling/src/utils/radToDeg.js | 4 +- .../modeling/src/utils/radiusToSegments.js | 8 +-- .../modeling/src/utils/recursiveArray.d.ts | 4 +- .../modeling/test/helpers/comparePolygons.js | 4 +- .../test/helpers/comparePolygonsAsPoints.js | 4 +- .../modeling/test/helpers/compareVectors.js | 4 +- packages/modeling/tsconfig.json | 17 +++++ .../utils/array-utils/src/fnNumberSort.js | 6 +- packages/utils/array-utils/src/nth.js | 2 +- packages/utils/array-utils/src/padToLength.js | 2 +- 697 files changed, 1881 insertions(+), 1889 deletions(-) create mode 100644 packages/modeling/global.d.ts create mode 100644 packages/modeling/tsconfig.json diff --git a/packages/modeling/global.d.ts b/packages/modeling/global.d.ts new file mode 100644 index 000000000..e1fb44055 --- /dev/null +++ b/packages/modeling/global.d.ts @@ -0,0 +1,15 @@ +// global types +declare type Geom2 = import('./src/geometries/geom2/type.d.ts').Geom2 +declare type Geom3 = import('./src/geometries/geom3/type.d.ts').Geom3 +declare type Path2 = import('./src/geometries/path2/type.d.ts').Path2 +declare type Poly2 = import('./src/geometries/poly2/type.d.ts').Poly2 +declare type Poly3 = import('./src/geometries/poly3/type.d.ts').Poly3 +declare type Slice = import('./src/geometries/slice/type.d.ts').Slice + +declare type Line2 = import('./src/maths/line2/type.d.ts').Line2 +declare type Line3 = import('./src/maths/line3/type.d.ts').Line3 +declare type Mat4 = import('./src/maths/mat4/type.d.ts').Mat4 +declare type Plane = import('./src/maths/plane/type.d.ts').Plane +declare type Vec2 = import('./src/maths/vec2/type.d.ts').Vec2 +declare type Vec3 = import('./src/maths/vec3/type.d.ts').Vec3 +declare type Vec4 = import('./src/maths/vec4/type.d.ts').Vec4 diff --git a/packages/modeling/src/colors/colorNameToRgb.d.ts b/packages/modeling/src/colors/colorNameToRgb.d.ts index b534ccc6b..b57d33e98 100644 --- a/packages/modeling/src/colors/colorNameToRgb.d.ts +++ b/packages/modeling/src/colors/colorNameToRgb.d.ts @@ -1,3 +1,3 @@ -import { RGB } from './types' +import type { RGB } from './types.d.ts' export function colorNameToRgb(s: string): RGB diff --git a/packages/modeling/src/colors/colorNameToRgb.js b/packages/modeling/src/colors/colorNameToRgb.js index 4c28bed33..faffa78ae 100644 --- a/packages/modeling/src/colors/colorNameToRgb.js +++ b/packages/modeling/src/colors/colorNameToRgb.js @@ -3,7 +3,7 @@ import { cssColors } from './cssColors.js' /** * Converts a CSS color name to RGB color. * - * @param {String} s - the CSS color name + * @param {string} s - the CSS color name * @return {Array} the RGB color, or undefined if not found * @alias module:modeling/colors.colorNameToRgb * @example diff --git a/packages/modeling/src/colors/colorize.d.ts b/packages/modeling/src/colors/colorize.d.ts index d7e78f3a9..c0cc6b39d 100644 --- a/packages/modeling/src/colors/colorize.d.ts +++ b/packages/modeling/src/colors/colorize.d.ts @@ -1,7 +1,7 @@ -import { Colored, Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Colored, Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' -import { RGB, RGBA } from './types' +import type { RGB, RGBA } from './types.d.ts' // Single Geom3 returns Colored Geom3 export function colorize(color: RGB | RGBA, object: T): T & Colored diff --git a/packages/modeling/src/colors/colorize.js b/packages/modeling/src/colors/colorize.js index 3a38b943a..a65af616f 100644 --- a/packages/modeling/src/colors/colorize.js +++ b/packages/modeling/src/colors/colorize.js @@ -32,7 +32,7 @@ const colorPoly3 = (color, object) => { /** * Assign the given color to the given objects. * @param {Array} color - RGBA color values, where each value is between 0 and 1.0 - * @param {Object|Array} objects - the objects of which to apply the given color + * @param {object|Array} objects - the objects of which to apply the given color * @return {Object|Array} new object, or list of new objects with an additional attribute 'color' * @alias module:modeling/colors.colorize * diff --git a/packages/modeling/src/colors/cssColors.d.ts b/packages/modeling/src/colors/cssColors.d.ts index 6176d9cb2..33dd21cf9 100644 --- a/packages/modeling/src/colors/cssColors.d.ts +++ b/packages/modeling/src/colors/cssColors.d.ts @@ -1,4 +1,4 @@ -import { RGB } from './types' +import type { RGB } from './types.d.ts' export const black: RGB export const silver: RGB diff --git a/packages/modeling/src/colors/hexToRgb.d.ts b/packages/modeling/src/colors/hexToRgb.d.ts index 440ea025a..5a98cfad4 100644 --- a/packages/modeling/src/colors/hexToRgb.d.ts +++ b/packages/modeling/src/colors/hexToRgb.d.ts @@ -1,3 +1,3 @@ -import { RGB, RGBA } from './types' +import type { RGB, RGBA } from './types.d.ts' export function hexToRgb(hex: string): RGB | RGBA diff --git a/packages/modeling/src/colors/hexToRgb.js b/packages/modeling/src/colors/hexToRgb.js index 119389724..069e7c5f0 100644 --- a/packages/modeling/src/colors/hexToRgb.js +++ b/packages/modeling/src/colors/hexToRgb.js @@ -2,7 +2,7 @@ * Converts CSS color notations (string of hex values) to RGB values. * * @see https://www.w3.org/TR/css-color-3/ - * @param {String} notation - color notation + * @param {string} notation - color notation * @return {Array} RGB color values * @alias module:modeling/colors.hexToRgb * diff --git a/packages/modeling/src/colors/hslToRgb.d.ts b/packages/modeling/src/colors/hslToRgb.d.ts index dda130f32..33a72bd9b 100644 --- a/packages/modeling/src/colors/hslToRgb.d.ts +++ b/packages/modeling/src/colors/hslToRgb.d.ts @@ -1,4 +1,4 @@ -import { HSL, HSLA, RGB, RGBA } from './types' +import type { HSL, HSLA, RGB, RGBA } from './types.d.ts' export function hslToRgb(hsl: HSL): RGB export function hslToRgb(hsl: HSLA): RGBA diff --git a/packages/modeling/src/colors/hsvToRgb.d.ts b/packages/modeling/src/colors/hsvToRgb.d.ts index 484451e39..c10e71c4c 100644 --- a/packages/modeling/src/colors/hsvToRgb.d.ts +++ b/packages/modeling/src/colors/hsvToRgb.d.ts @@ -1,4 +1,4 @@ -import { HSV, HSVA, RGB, RGBA } from './types' +import type { HSV, HSVA, RGB, RGBA } from './types.d.ts' export function hsvToRgb(hsv: HSV): RGB export function hsvToRgb(hsv: HSVA): RGBA diff --git a/packages/modeling/src/colors/hueToColorComponent.js b/packages/modeling/src/colors/hueToColorComponent.js index 0c2cadc77..24369e171 100644 --- a/packages/modeling/src/colors/hueToColorComponent.js +++ b/packages/modeling/src/colors/hueToColorComponent.js @@ -3,7 +3,7 @@ * @param {Number} p * @param {Number} q * @param {Number} t - * @return {Number} color component + * @return {number} color component * @alias module:modeling/colors.hueToColorComponent */ export const hueToColorComponent = (p, q, t) => { diff --git a/packages/modeling/src/colors/index.d.ts b/packages/modeling/src/colors/index.d.ts index 503ff851b..caaa259b5 100644 --- a/packages/modeling/src/colors/index.d.ts +++ b/packages/modeling/src/colors/index.d.ts @@ -1,13 +1,12 @@ -export { colorize } from './colorize' -export { colorNameToRgb } from './colorNameToRgb' -export * as cssColors from './cssColors' -export { hexToRgb } from './hexToRgb' -export { hslToRgb } from './hslToRgb' -export { hsvToRgb } from './hsvToRgb' -export { hueToColorComponent } from './hueToColorComponent' -export { rgbToHex } from './rgbToHex' -export { rgbToHsl } from './rgbToHsl' -export { rgbToHsv } from './rgbToHsv' +export { colorize } from './colorize.js' +export { colorNameToRgb } from './colorNameToRgb.js' +export * as cssColors from './cssColors.js' +export { hexToRgb } from './hexToRgb.js' +export { hslToRgb } from './hslToRgb.js' +export { hsvToRgb } from './hsvToRgb.js' +export { hueToColorComponent } from './hueToColorComponent.js' +export { rgbToHex } from './rgbToHex.js' +export { rgbToHsl } from './rgbToHsl.js' +export { rgbToHsv } from './rgbToHsv.js' -export * from './types' -export as namespace colors +export type * from './types.d.ts' diff --git a/packages/modeling/src/colors/rgbToHex.d.ts b/packages/modeling/src/colors/rgbToHex.d.ts index 94f106dd0..891a1ec08 100644 --- a/packages/modeling/src/colors/rgbToHex.d.ts +++ b/packages/modeling/src/colors/rgbToHex.d.ts @@ -1,4 +1,4 @@ -import { RGB, RGBA } from './types' +import type { RGB, RGBA } from './types.d.ts' export function rgbToHex(rgb: RGB | RGBA): string export function rgbToHex(...rgb: RGB | RGBA): string diff --git a/packages/modeling/src/colors/rgbToHsl.d.ts b/packages/modeling/src/colors/rgbToHsl.d.ts index 3987d0737..2b11e25c2 100644 --- a/packages/modeling/src/colors/rgbToHsl.d.ts +++ b/packages/modeling/src/colors/rgbToHsl.d.ts @@ -1,4 +1,4 @@ -import { HSL, HSLA, RGB, RGBA } from './types' +import type { HSL, HSLA, RGB, RGBA } from './types.d.ts' export function rgbToHsl(rgb: RGB): HSL export function rgbToHsl(rgb: RGBA): HSLA diff --git a/packages/modeling/src/colors/rgbToHsv.d.ts b/packages/modeling/src/colors/rgbToHsv.d.ts index a30f26562..374dcd438 100644 --- a/packages/modeling/src/colors/rgbToHsv.d.ts +++ b/packages/modeling/src/colors/rgbToHsv.d.ts @@ -1,4 +1,4 @@ -import { HSV, HSVA, RGB, RGBA } from './types' +import type { HSV, HSVA, RGB, RGBA } from './types.d.ts' export function rgbToHsv(rgb: RGB): HSV export function rgbToHsv(rgb: RGBA): HSVA diff --git a/packages/modeling/src/connectors/extends.js b/packages/modeling/src/connectors/extends.js index 2213cee91..fb7880c23 100644 --- a/packages/modeling/src/connectors/extends.js +++ b/packages/modeling/src/connectors/extends.js @@ -4,7 +4,7 @@ import { fromPointAxisNormal } from './fromPointAxisNormal.js' /* * Creates a new connector, with the connection point moved in the direction of the axis - * @param {Number} distance the distance to extend the connector to + * @param {number} distance the distance to extend the connector to * @param {connector} connector the connector to extend * @returns {connector} a normalized connector */ diff --git a/packages/modeling/src/connectors/fromPointAxisNormal.js b/packages/modeling/src/connectors/fromPointAxisNormal.js index d9a2bfc78..f87873159 100644 --- a/packages/modeling/src/connectors/fromPointAxisNormal.js +++ b/packages/modeling/src/connectors/fromPointAxisNormal.js @@ -4,9 +4,9 @@ import { create } from './create.js' /** * Create a connector from the given point, axis and normal. - * @param {vec3} point - the point of the connector, relative to the parent geometry - * @param {vec3} axis - the axis (directional vector) of the connector - * @param {vec3} normal - the normal (directional vector) of the connector, perpendicular to the axis + * @param {Vec3} point - the point of the connector, relative to the parent geometry + * @param {Vec3} axis - the axis (directional vector) of the connector + * @param {Vec3} normal - the normal (directional vector) of the connector, perpendicular to the axis * @returns {connector} a new connector * @alias module:modeling/connectors.fromPointsAxisNormal */ diff --git a/packages/modeling/src/connectors/transform.js b/packages/modeling/src/connectors/transform.js index 994664bd5..001fd92a9 100644 --- a/packages/modeling/src/connectors/transform.js +++ b/packages/modeling/src/connectors/transform.js @@ -4,7 +4,7 @@ import { fromPointAxisNormal } from './fromPointAxisNormal.js' /** * Transform the give connector using the given matrix. - * @param {mat4} matrix - a transform matrix + * @param {Mat4} matrix - a transform matrix * @param {connector} connector - the connector to transform * @returns {connector} a new connector * @alias module:modeling/connectors.transform diff --git a/packages/modeling/src/connectors/transformationBetween.js b/packages/modeling/src/connectors/transformationBetween.js index 938fe4c89..b5e22e4b2 100644 --- a/packages/modeling/src/connectors/transformationBetween.js +++ b/packages/modeling/src/connectors/transformationBetween.js @@ -9,13 +9,13 @@ import { transform } from './transform.js' /** * Get the transformation matrix that connects the given connectors. - * @param {Object} options - * @param {Boolean} [options.mirror=false] - the 'axis' vectors should point in the same direction + * @param {object} options + * @param {boolean} [options.mirror=false] - the 'axis' vectors should point in the same direction * true: the 'axis' vectors should point in opposite direction - * @param {Number} [options.normalRotation=0] - the angle (RADIANS) of rotation between the 'normal' vectors - * @param {connector} from - connector from which to connect - * @param {connector} to - connector to connect to - * @returns {mat4} - the matrix that transforms (connects) one connector to another + * @param {number} [options.normalRotation=0] - the angle (RADIANS) of rotation between the 'normal' vectors + * @param {Connector} from - connector from which to connect + * @param {Connector} to - connector to connect to + * @returns {Mat4} - the matrix that transforms (connects) one connector to another * @alias module:modeling/connectors.transformationBetween */ export const transformationBetween = (options, from, to) => { diff --git a/packages/modeling/src/curves/bezier/arcLengthToT.d.ts b/packages/modeling/src/curves/bezier/arcLengthToT.d.ts index 15655c7e6..ea9568b8f 100644 --- a/packages/modeling/src/curves/bezier/arcLengthToT.d.ts +++ b/packages/modeling/src/curves/bezier/arcLengthToT.d.ts @@ -1,4 +1,4 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export interface ArcLengthToTOptions { distance?: Number diff --git a/packages/modeling/src/curves/bezier/arcLengthToT.js b/packages/modeling/src/curves/bezier/arcLengthToT.js index 7f8ab54a9..bb42f5cdd 100644 --- a/packages/modeling/src/curves/bezier/arcLengthToT.js +++ b/packages/modeling/src/curves/bezier/arcLengthToT.js @@ -15,10 +15,10 @@ import { lengths } from './lengths.js' * } * return points; * - * @param {Object} [options] options for construction - * @param {Number} [options.distance=0] the distance along the bezier curve for which we want to find the corresponding t value. - * @param {Number} [options.segments=100] the number of segments to use when approximating the curve length. - * @param {Object} bezier a bezier curve. + * @param {object} [options] options for construction + * @param {number} [options.distance=0] the distance along the bezier curve for which we want to find the corresponding t value. + * @param {number} [options.segments=100] the number of segments to use when approximating the curve length. + * @param {object} bezier a bezier curve. * @returns a number in the [0, 1] interval or NaN if the arcLength is negative or greater than the total length of the curve. * @alias module:modeling/curves/bezier.arcLengthToT */ diff --git a/packages/modeling/src/curves/bezier/create.d.ts b/packages/modeling/src/curves/bezier/create.d.ts index 010881a5b..5e166aa0a 100644 --- a/packages/modeling/src/curves/bezier/create.d.ts +++ b/packages/modeling/src/curves/bezier/create.d.ts @@ -1,3 +1,3 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export function create(points: Array | Array>): Bezier diff --git a/packages/modeling/src/curves/bezier/index.d.ts b/packages/modeling/src/curves/bezier/index.d.ts index 52f4f8bb7..8e5a6ef8a 100644 --- a/packages/modeling/src/curves/bezier/index.d.ts +++ b/packages/modeling/src/curves/bezier/index.d.ts @@ -1,9 +1,8 @@ -export { create } from './create' -export { tangentAt } from './tangentAt' -export { valueAt } from './valueAt' -export { lengths } from './lengths' -export { length } from './length' -export { arcLengthToT } from './arcLengthToT' +export { create } from './create.js' +export { tangentAt } from './tangentAt.js' +export { valueAt } from './valueAt.js' +export { lengths } from './lengths.js' +export { length } from './length.js' +export { arcLengthToT } from './arcLengthToT.js' -export { Bezier } from './type' -export as namespace bezier +export type { Bezier } from './type.d.ts' diff --git a/packages/modeling/src/curves/bezier/length.d.ts b/packages/modeling/src/curves/bezier/length.d.ts index 47bbc473b..7ab84dda3 100644 --- a/packages/modeling/src/curves/bezier/length.d.ts +++ b/packages/modeling/src/curves/bezier/length.d.ts @@ -1,3 +1,3 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export function length(segments: number, bezier: Bezier): number \ No newline at end of file diff --git a/packages/modeling/src/curves/bezier/length.js b/packages/modeling/src/curves/bezier/length.js index 10bbbbe67..544c9024a 100644 --- a/packages/modeling/src/curves/bezier/length.js +++ b/packages/modeling/src/curves/bezier/length.js @@ -8,8 +8,8 @@ import { lengths } from './lengths.js' * const b = bezier.create([[0, 0], [0, 10]]); * console.log(length(100, b)) // output 10 * - * @param {Number} segments the number of segments to use when approximating the curve length. - * @param {Object} bezier a bezier curve. + * @param {number} segments the number of segments to use when approximating the curve length. + * @param {object} bezier a bezier curve. * @returns an approximation of the curve's length. * @alias module:modeling/curves/bezier.length */ diff --git a/packages/modeling/src/curves/bezier/lengths.d.ts b/packages/modeling/src/curves/bezier/lengths.d.ts index 1ff4ad844..dd8bd183d 100644 --- a/packages/modeling/src/curves/bezier/lengths.d.ts +++ b/packages/modeling/src/curves/bezier/lengths.d.ts @@ -1,3 +1,3 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export function lengths(segments: number, bezier: Bezier): Array \ No newline at end of file diff --git a/packages/modeling/src/curves/bezier/lengths.js b/packages/modeling/src/curves/bezier/lengths.js index fd84e726c..ef9ae31fd 100644 --- a/packages/modeling/src/curves/bezier/lengths.js +++ b/packages/modeling/src/curves/bezier/lengths.js @@ -8,8 +8,8 @@ import { valueAt } from './valueAt.js' * const b = bezier.create([[0, 0], [0, 10]]); * const totalLength = lengths(100, b).pop(); // the last element of the array is the curve's approximate length * - * @param {Number} segments the number of segments to use when approximating the curve length. - * @param {Object} bezier a bezier curve. + * @param {number} segments the number of segments to use when approximating the curve length. + * @param {object} bezier a bezier curve. * @returns an array containing the cumulative length of the segments. */ export const lengths = (segments, bezier) => { @@ -34,7 +34,7 @@ export const lengths = (segments, bezier) => { * * @param {Array} a - first operand. * @param {Array} b - second operand. - * @returns {Number} - distance. + * @returns {number} - distance. */ const distanceBetween = (a, b) => { if (Number.isFinite(a) && Number.isFinite(b)) { diff --git a/packages/modeling/src/curves/bezier/tangentAt.d.ts b/packages/modeling/src/curves/bezier/tangentAt.d.ts index 23e655ab3..be8f4def8 100644 --- a/packages/modeling/src/curves/bezier/tangentAt.d.ts +++ b/packages/modeling/src/curves/bezier/tangentAt.d.ts @@ -1,3 +1,3 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export function tangentAt(t: number, bezier: Bezier): Array | number diff --git a/packages/modeling/src/curves/bezier/tangentAt.js b/packages/modeling/src/curves/bezier/tangentAt.js index e650b44d1..982308d51 100644 --- a/packages/modeling/src/curves/bezier/tangentAt.js +++ b/packages/modeling/src/curves/bezier/tangentAt.js @@ -8,7 +8,7 @@ * let tangent = bezier.tangentAt(t, b) * * @param {number} t : the position of which to calculate the bezier's tangent value; 0 < t < 1 - * @param {Object} bezier : an array with at least 2 elements of either all numbers, or all arrays of numbers that are the same size. + * @param {object} bezier : an array with at least 2 elements of either all numbers, or all arrays of numbers that are the same size. * @return {array | number} the tangent at the requested position. * @alias module:modeling/curves/bezier.tangentAt */ diff --git a/packages/modeling/src/curves/bezier/type.d.ts b/packages/modeling/src/curves/bezier/type.d.ts index e2ce751e5..a3c17ed7f 100644 --- a/packages/modeling/src/curves/bezier/type.d.ts +++ b/packages/modeling/src/curves/bezier/type.d.ts @@ -1,5 +1,3 @@ -export default Bezier - export interface Bezier { points: Array | Array> pointType: string diff --git a/packages/modeling/src/curves/bezier/valueAt.d.ts b/packages/modeling/src/curves/bezier/valueAt.d.ts index 143cf3772..79e910f70 100644 --- a/packages/modeling/src/curves/bezier/valueAt.d.ts +++ b/packages/modeling/src/curves/bezier/valueAt.d.ts @@ -1,3 +1,3 @@ -import Bezier from './type' +import type { Bezier } from './type.d.ts' export function valueAt(t: number, bezier: Bezier): Array | number diff --git a/packages/modeling/src/curves/bezier/valueAt.js b/packages/modeling/src/curves/bezier/valueAt.js index f35f280a3..8e524ceb8 100644 --- a/packages/modeling/src/curves/bezier/valueAt.js +++ b/packages/modeling/src/curves/bezier/valueAt.js @@ -9,7 +9,7 @@ * let position = bezier.valueAt(t,b) // where 0 < t < 1 * * @param {number} t : the position of which to calculate the value; 0 < t < 1 - * @param {Object} bezier : a Bézier curve created with bezier.create(). + * @param {object} bezier : a Bézier curve created with bezier.create(). * @returns {array | number} the value at the requested position. * @alias module:modeling/curves/bezier.valueAt */ diff --git a/packages/modeling/src/curves/index.d.ts b/packages/modeling/src/curves/index.d.ts index 241ee958f..a872f8880 100644 --- a/packages/modeling/src/curves/index.d.ts +++ b/packages/modeling/src/curves/index.d.ts @@ -1,3 +1 @@ -export * as bezier from './bezier' - -export as namespace curves +export * as bezier from './bezier/index.js' diff --git a/packages/modeling/src/geometries/geom2/applyTransforms.js b/packages/modeling/src/geometries/geom2/applyTransforms.js index 8dcb49a4e..99300d96c 100644 --- a/packages/modeling/src/geometries/geom2/applyTransforms.js +++ b/packages/modeling/src/geometries/geom2/applyTransforms.js @@ -4,8 +4,8 @@ import * as vec2 from '../../maths/vec2/index.js' /* * Apply the transforms of the given geometry. * NOTE: This function must be called BEFORE exposing any data. See toOutlines(). - * @param {geom2} geometry - the geometry to transform - * @returns {geom2} the given geometry + * @param {Geom2} geometry - the geometry to transform + * @returns {Geom2} the given geometry * * @example * geometry = applyTransforms(geometry) diff --git a/packages/modeling/src/geometries/geom2/clone.d.ts b/packages/modeling/src/geometries/geom2/clone.d.ts index e4bc0279a..f0e39f9cb 100644 --- a/packages/modeling/src/geometries/geom2/clone.d.ts +++ b/packages/modeling/src/geometries/geom2/clone.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function clone(geometry: Geom2): Geom2 diff --git a/packages/modeling/src/geometries/geom2/clone.js b/packages/modeling/src/geometries/geom2/clone.js index a57c191e2..81b41093c 100644 --- a/packages/modeling/src/geometries/geom2/clone.js +++ b/packages/modeling/src/geometries/geom2/clone.js @@ -1,7 +1,7 @@ /** * Performs a shallow clone of the given geometry. - * @param {geom2} geometry - the geometry to clone - * @returns {geom2} new geometry + * @param {Geom2} geometry - the geometry to clone + * @returns {Geom2} new geometry * @alias module:modeling/geometries/geom2.clone */ export const clone = (geometry) => Object.assign({}, geometry) diff --git a/packages/modeling/src/geometries/geom2/create.d.ts b/packages/modeling/src/geometries/geom2/create.d.ts index 5e225a462..e98db97ff 100644 --- a/packages/modeling/src/geometries/geom2/create.d.ts +++ b/packages/modeling/src/geometries/geom2/create.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Geom2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function create(outlines?: Array>): Geom2 diff --git a/packages/modeling/src/geometries/geom2/create.js b/packages/modeling/src/geometries/geom2/create.js index bf97159a4..d3e599065 100644 --- a/packages/modeling/src/geometries/geom2/create.js +++ b/packages/modeling/src/geometries/geom2/create.js @@ -2,9 +2,8 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Represents a 2D geometry consisting of outlines, where each outline is an ordered list of points. - * @typedef {Object} geom2 * @property {Array} outlines - list of polygon outlines - * @property {mat4} transforms - transforms to apply to the geometry, see transform() + * @property {Mat4} transforms - transforms to apply to the geometry, see transform() * @example * // data structure * { @@ -16,7 +15,7 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Create a new 2D geometry composed of polygon outlines. * @param {Array} [outlines] - list of outlines where each outline is an array of points - * @returns {geom2} a new geometry + * @returns {Geom2} a new geometry * @alias module:modeling/geometries/geom2.create * @example * let myShape = create([ [[-1,-1], [1,-1], [1,1], [-1,1]] ]) diff --git a/packages/modeling/src/geometries/geom2/fromCompactBinary.d.ts b/packages/modeling/src/geometries/geom2/fromCompactBinary.d.ts index c8ad46cc6..aeae664c4 100644 --- a/packages/modeling/src/geometries/geom2/fromCompactBinary.d.ts +++ b/packages/modeling/src/geometries/geom2/fromCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function fromCompactBinary(data: Array | Float32Array | Float64Array): Geom2 diff --git a/packages/modeling/src/geometries/geom2/fromCompactBinary.js b/packages/modeling/src/geometries/geom2/fromCompactBinary.js index df4045ac4..b8779ecf4 100644 --- a/packages/modeling/src/geometries/geom2/fromCompactBinary.js +++ b/packages/modeling/src/geometries/geom2/fromCompactBinary.js @@ -6,7 +6,7 @@ import { create } from './create.js' /** * Create a new 2D geometry from the given compact binary data. * @param {Array} data - compact binary data - * @returns {geom2} a new geometry + * @returns {Geom2} a new geometry * @alias module:modeling/geometries/geom2.fromCompactBinary */ export const fromCompactBinary = (data) => { diff --git a/packages/modeling/src/geometries/geom2/fromSides.d.ts b/packages/modeling/src/geometries/geom2/fromSides.d.ts index 63b07591b..8508615a1 100644 --- a/packages/modeling/src/geometries/geom2/fromSides.d.ts +++ b/packages/modeling/src/geometries/geom2/fromSides.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Geom2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function fromSides(sides: Array<[Vec2, Vec2]>): Geom2 diff --git a/packages/modeling/src/geometries/geom2/fromSides.js b/packages/modeling/src/geometries/geom2/fromSides.js index 2227268eb..dbaec36ba 100644 --- a/packages/modeling/src/geometries/geom2/fromSides.js +++ b/packages/modeling/src/geometries/geom2/fromSides.js @@ -42,7 +42,7 @@ const toPointMap = (sides) => { /** * Create a new 2D geometry from a list of sides. * @param {Array} sides - list of sides to create outlines from - * @returns {geom2} a new geometry + * @returns {Geom2} a new geometry * * @example * let geometry = fromSides([[[0, 0], [1, 0]], [[1, 0], [1, 1]], [[1, 1], [0, 0]]]) diff --git a/packages/modeling/src/geometries/geom2/index.d.ts b/packages/modeling/src/geometries/geom2/index.d.ts index 381ec4b9a..588701fd6 100644 --- a/packages/modeling/src/geometries/geom2/index.d.ts +++ b/packages/modeling/src/geometries/geom2/index.d.ts @@ -1,15 +1,15 @@ -export { clone } from './clone' -export { create } from './create' -export { fromSides } from './fromSides' -export { fromCompactBinary } from './fromCompactBinary' -export { isA } from './isA' -export { reverse } from './reverse' -export { toOutlines } from './toOutlines' -export { toPoints } from './toPoints' -export { toSides } from './toSides' -export { toString } from './toString' -export { toCompactBinary } from './toCompactBinary' -export { transform } from './transform' -export { validate } from './validate' +export { clone } from './clone.js' +export { create } from './create.js' +export { fromSides } from './fromSides.js' +export { fromCompactBinary } from './fromCompactBinary.js' +export { isA } from './isA.js' +export { reverse } from './reverse.js' +export { toOutlines } from './toOutlines.js' +export { toPoints } from './toPoints.js' +export { toSides } from './toSides.js' +export { toString } from './toString.js' +export { toCompactBinary } from './toCompactBinary.js' +export { transform } from './transform.js' +export { validate } from './validate.js' -export { Geom2 } from './type' +export type { Geom2 } from './type.d.ts' diff --git a/packages/modeling/src/geometries/geom2/isA.d.ts b/packages/modeling/src/geometries/geom2/isA.d.ts index c8301034f..d2c9d0af3 100644 --- a/packages/modeling/src/geometries/geom2/isA.d.ts +++ b/packages/modeling/src/geometries/geom2/isA.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function isA(object: any): object is Geom2 diff --git a/packages/modeling/src/geometries/geom2/isA.js b/packages/modeling/src/geometries/geom2/isA.js index d60d03b47..2cb2d04da 100644 --- a/packages/modeling/src/geometries/geom2/isA.js +++ b/packages/modeling/src/geometries/geom2/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a 2D geometry. - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @returns {Boolean} true, if the object matches a geom2 based object * @alias module:modeling/geometries/geom2.isA */ diff --git a/packages/modeling/src/geometries/geom2/reverse.d.ts b/packages/modeling/src/geometries/geom2/reverse.d.ts index 0aeca4630..18a50b3d6 100644 --- a/packages/modeling/src/geometries/geom2/reverse.d.ts +++ b/packages/modeling/src/geometries/geom2/reverse.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function reverse(geometry: Geom2): Geom2 diff --git a/packages/modeling/src/geometries/geom2/reverse.js b/packages/modeling/src/geometries/geom2/reverse.js index 8d9a9b8b0..6b73633c5 100644 --- a/packages/modeling/src/geometries/geom2/reverse.js +++ b/packages/modeling/src/geometries/geom2/reverse.js @@ -4,8 +4,8 @@ import { toOutlines } from './toOutlines.js' /** * Reverses the given geometry so that the outline points are flipped in the opposite order. * This swaps the left (interior) and right (exterior) edges. - * @param {geom2} geometry - the geometry to reverse - * @returns {geom2} the new reversed geometry + * @param {Geom2} geometry - the geometry to reverse + * @returns {Geom2} the new reversed geometry * @alias module:modeling/geometries/geom2.reverse * * @example diff --git a/packages/modeling/src/geometries/geom2/toCompactBinary.d.ts b/packages/modeling/src/geometries/geom2/toCompactBinary.d.ts index 54e1bc870..86080efc7 100644 --- a/packages/modeling/src/geometries/geom2/toCompactBinary.d.ts +++ b/packages/modeling/src/geometries/geom2/toCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function toCompactBinary(geom: Geom2): Float32Array diff --git a/packages/modeling/src/geometries/geom2/toCompactBinary.js b/packages/modeling/src/geometries/geom2/toCompactBinary.js index 72d20c526..98e482018 100644 --- a/packages/modeling/src/geometries/geom2/toCompactBinary.js +++ b/packages/modeling/src/geometries/geom2/toCompactBinary.js @@ -1,6 +1,6 @@ /** * Produces a compact binary representation from the given geometry. - * @param {geom2} geometry - the geometry + * @param {Geom2} geometry - the geometry * @returns {TypedArray} compact binary representation * @alias module:modeling/geometries/geom2.toCompactBinary */ diff --git a/packages/modeling/src/geometries/geom2/toOutlines.d.ts b/packages/modeling/src/geometries/geom2/toOutlines.d.ts index 3661ae6b2..acf5d25ac 100644 --- a/packages/modeling/src/geometries/geom2/toOutlines.d.ts +++ b/packages/modeling/src/geometries/geom2/toOutlines.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Geom2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function toOutlines(geometry: Geom2): Array> diff --git a/packages/modeling/src/geometries/geom2/toOutlines.js b/packages/modeling/src/geometries/geom2/toOutlines.js index 32765e85a..68cd0ddd1 100644 --- a/packages/modeling/src/geometries/geom2/toOutlines.js +++ b/packages/modeling/src/geometries/geom2/toOutlines.js @@ -2,7 +2,7 @@ import { applyTransforms } from './applyTransforms.js' /** * Create the outline(s) of the given geometry. - * @param {geom2} geometry - geometry to create outlines from + * @param {Geom2} geometry - geometry to create outlines from * @returns {Array} an array of outlines, where each outline is an array of ordered points * @alias module:modeling/geometries/geom2.toOutlines * diff --git a/packages/modeling/src/geometries/geom2/toPoints.d.ts b/packages/modeling/src/geometries/geom2/toPoints.d.ts index fc02a5325..22a3a7a37 100644 --- a/packages/modeling/src/geometries/geom2/toPoints.d.ts +++ b/packages/modeling/src/geometries/geom2/toPoints.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Geom2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function toPoints(geometry: Geom2): Array diff --git a/packages/modeling/src/geometries/geom2/toPoints.js b/packages/modeling/src/geometries/geom2/toPoints.js index 3ab0f3b56..1d80867ac 100644 --- a/packages/modeling/src/geometries/geom2/toPoints.js +++ b/packages/modeling/src/geometries/geom2/toPoints.js @@ -4,7 +4,7 @@ import { toOutlines } from './toOutlines.js' * Produces an array of points from the given geometry. * The returned array should not be modified as the points are shared with the geometry. * NOTE: The points returned do NOT define an order. Use toOutlines() for ordered points. - * @param {geom2} geometry - the geometry + * @param {Geom2} geometry - the geometry * @returns {Array} an array of points * @alias module:modeling/geometries/geom2.toPoints * diff --git a/packages/modeling/src/geometries/geom2/toSides.d.ts b/packages/modeling/src/geometries/geom2/toSides.d.ts index 32352858a..ff0e2af51 100644 --- a/packages/modeling/src/geometries/geom2/toSides.d.ts +++ b/packages/modeling/src/geometries/geom2/toSides.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Geom2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function toSides(geometry: Geom2): Array<[Vec2, Vec2]> diff --git a/packages/modeling/src/geometries/geom2/toSides.js b/packages/modeling/src/geometries/geom2/toSides.js index 0ae42b3af..dc091d937 100644 --- a/packages/modeling/src/geometries/geom2/toSides.js +++ b/packages/modeling/src/geometries/geom2/toSides.js @@ -4,7 +4,7 @@ import { toOutlines } from './toOutlines.js' * Produces an array of sides from the given geometry. * The returned array should not be modified as the data is shared with the geometry. * NOTE: The sides returned do NOT define an order. Use toOutlines() for ordered points. - * @param {geom2} geometry - the geometry + * @param {Geom2} geometry - the geometry * @returns {Array} an array of sides * @alias module:modeling/geometries/geom2.toSides * diff --git a/packages/modeling/src/geometries/geom2/toString.d.ts b/packages/modeling/src/geometries/geom2/toString.d.ts index c19d1ed35..9dda7cf90 100644 --- a/packages/modeling/src/geometries/geom2/toString.d.ts +++ b/packages/modeling/src/geometries/geom2/toString.d.ts @@ -1,3 +1,3 @@ -import { Geom2 } from './type' +import type { Geom2 } from './type.d.ts' export function toString(geometry: Geom2): string diff --git a/packages/modeling/src/geometries/geom2/toString.js b/packages/modeling/src/geometries/geom2/toString.js index 7c65e1455..98fc4bcd2 100644 --- a/packages/modeling/src/geometries/geom2/toString.js +++ b/packages/modeling/src/geometries/geom2/toString.js @@ -4,8 +4,8 @@ import { toOutlines } from './toOutlines.js' /** * Create a string representing the contents of the given geometry. - * @param {geom2} geometry - the geometry - * @returns {String} a representative string + * @param {Geom2} geometry - the geometry + * @returns {string} a representative string * @alias module:modeling/geometries/geom2.toString * * @example diff --git a/packages/modeling/src/geometries/geom2/transform.d.ts b/packages/modeling/src/geometries/geom2/transform.d.ts index 83f389036..829620b79 100644 --- a/packages/modeling/src/geometries/geom2/transform.d.ts +++ b/packages/modeling/src/geometries/geom2/transform.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from './type' -import { Mat4 } from '../../maths/mat4/type' +import type { Geom2 } from './type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' export function transform(matrix: Mat4, geometry: Geom2): Geom2 diff --git a/packages/modeling/src/geometries/geom2/transform.js b/packages/modeling/src/geometries/geom2/transform.js index 32f9a30b7..b97aef754 100644 --- a/packages/modeling/src/geometries/geom2/transform.js +++ b/packages/modeling/src/geometries/geom2/transform.js @@ -4,9 +4,9 @@ import * as mat4 from '../../maths/mat4/index.js' * Transform the given geometry using the given matrix. * This is a lazy transform of the outlines, as this function only adjusts the transforms. * The transforms are applied when accessing the outlines via toOutlines(). - * @param {mat4} matrix - the matrix to transform with - * @param {geom2} geometry - the geometry to transform - * @returns {geom2} a new geometry + * @param {Mat4} matrix - the matrix to transform with + * @param {Geom2} geometry - the geometry to transform + * @returns {Geom2} a new geometry * @alias module:modeling/geometries/geom2.transform * * @example diff --git a/packages/modeling/src/geometries/geom2/type.d.ts b/packages/modeling/src/geometries/geom2/type.d.ts index 50fd93aa5..757ffb292 100644 --- a/packages/modeling/src/geometries/geom2/type.d.ts +++ b/packages/modeling/src/geometries/geom2/type.d.ts @@ -1,6 +1,6 @@ -import { Vec2 } from '../../maths/vec2/type' -import { Mat4 } from '../../maths/mat4/type' -import { Color } from '../types' +import type { Vec2 } from '../../maths/vec2/type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' +import type { Color } from '../types.d.ts' export interface Geom2 { outlines: Array> diff --git a/packages/modeling/src/geometries/geom2/validate.js b/packages/modeling/src/geometries/geom2/validate.js index 69fee8493..a1960d29a 100644 --- a/packages/modeling/src/geometries/geom2/validate.js +++ b/packages/modeling/src/geometries/geom2/validate.js @@ -11,7 +11,7 @@ import { toOutlines } from './toOutlines.js' * * **If the geometry is not valid, an exception will be thrown with details of the geometry error.** * - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @throws {Error} error if the geometry is not valid * @alias module:modeling/geometries/geom2.validate */ diff --git a/packages/modeling/src/geometries/geom2/validate.test.js b/packages/modeling/src/geometries/geom2/validate.test.js index 31b8a0984..6846752d0 100644 --- a/packages/modeling/src/geometries/geom2/validate.test.js +++ b/packages/modeling/src/geometries/geom2/validate.test.js @@ -1,15 +1,16 @@ import test from 'ava' +import * as vec2 from '../../maths/vec2/index.js' import { create, validate } from './index.js' // points of a square // D-C // | | // A-B -const a = [0, 0] -const b = [1, 0] -const c = [1, 1] -const d = [0, 1] +const a = vec2.fromValues(0, 0) +const b = vec2.fromValues(1, 0) +const c = vec2.fromValues(1, 1) +const d = vec2.fromValues(0, 1) test('validate: allow valid geometry', (t) => { const geometry = create([[a, b, c, d]]) diff --git a/packages/modeling/src/geometries/geom3/applyTransforms.js b/packages/modeling/src/geometries/geom3/applyTransforms.js index a814b1882..bd52432bd 100644 --- a/packages/modeling/src/geometries/geom3/applyTransforms.js +++ b/packages/modeling/src/geometries/geom3/applyTransforms.js @@ -5,8 +5,8 @@ import * as poly3 from '../poly3/index.js' /* * Apply the transforms of the given geometry. * NOTE: This function must be called BEFORE exposing any data. See toPolygons. - * @param {geom3} geometry - the geometry to transform - * @returns {geom3} the given geometry + * @param {Geom3} geometry - the geometry to transform + * @returns {Geom3} the given geometry * @example * geometry = applyTransforms(geometry) */ diff --git a/packages/modeling/src/geometries/geom3/clone.d.ts b/packages/modeling/src/geometries/geom3/clone.d.ts index 46f141cff..1409c8a82 100644 --- a/packages/modeling/src/geometries/geom3/clone.d.ts +++ b/packages/modeling/src/geometries/geom3/clone.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function clone(geometry: Geom3): Geom3 diff --git a/packages/modeling/src/geometries/geom3/clone.js b/packages/modeling/src/geometries/geom3/clone.js index 84ece29f0..960d6bf60 100644 --- a/packages/modeling/src/geometries/geom3/clone.js +++ b/packages/modeling/src/geometries/geom3/clone.js @@ -1,7 +1,7 @@ /** * Performs a shallow clone of the given geometry. - * @param {geom3} geometry - the geometry to clone - * @returns {geom3} a new geometry + * @param {Geom3} geometry - the geometry to clone + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.clone */ export const clone = (geometry) => Object.assign({}, geometry) diff --git a/packages/modeling/src/geometries/geom3/create.d.ts b/packages/modeling/src/geometries/geom3/create.d.ts index 373703a25..b8ccdf90e 100644 --- a/packages/modeling/src/geometries/geom3/create.d.ts +++ b/packages/modeling/src/geometries/geom3/create.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from './type' -import { Poly3 } from '../poly3/type' +import type { Geom3 } from './type.d.ts' +import type { Poly3 } from '../poly3/type.d.ts' export function create(polygons?: Array): Geom3 diff --git a/packages/modeling/src/geometries/geom3/create.js b/packages/modeling/src/geometries/geom3/create.js index 17d54df6b..4417ccb71 100644 --- a/packages/modeling/src/geometries/geom3/create.js +++ b/packages/modeling/src/geometries/geom3/create.js @@ -2,9 +2,8 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Represents a 3D geometry consisting of a list of polygons. - * @typedef {Object} geom3 * @property {Array} polygons - list of polygons, each polygon containing three or more vertices - * @property {mat4} transforms - transforms to apply to the polygons, see transform() + * @property {Mat4} transforms - transforms to apply to the polygons, see transform() * @example * { * "polygons": [ @@ -22,7 +21,7 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Create a new 3D geometry composed of the given polygons. * @param {Array} [polygons] - list of polygons, or undefined - * @returns {geom3} a new geometry + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.create */ export const create = (polygons) => { diff --git a/packages/modeling/src/geometries/geom3/fromCompactBinary.d.ts b/packages/modeling/src/geometries/geom3/fromCompactBinary.d.ts index ce3ad7be5..8925c6fc9 100644 --- a/packages/modeling/src/geometries/geom3/fromCompactBinary.d.ts +++ b/packages/modeling/src/geometries/geom3/fromCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function fromCompactBinary(data: Array | Float32Array | Float64Array): Geom3 diff --git a/packages/modeling/src/geometries/geom3/fromCompactBinary.js b/packages/modeling/src/geometries/geom3/fromCompactBinary.js index 57f589607..955606c13 100644 --- a/packages/modeling/src/geometries/geom3/fromCompactBinary.js +++ b/packages/modeling/src/geometries/geom3/fromCompactBinary.js @@ -8,7 +8,7 @@ import { create } from './create.js' /** * Construct a new 3D geometry from the given compact binary data. * @param {TypedArray} data - compact binary data - * @returns {geom3} a new geometry + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.fromCompactBinary */ export const fromCompactBinary = (data) => { diff --git a/packages/modeling/src/geometries/geom3/fromPoints.d.ts b/packages/modeling/src/geometries/geom3/fromPoints.d.ts index f318e0f3a..03c986b14 100644 --- a/packages/modeling/src/geometries/geom3/fromPoints.d.ts +++ b/packages/modeling/src/geometries/geom3/fromPoints.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from './type' -import { Vec3 } from '../../maths/vec3/type' +import type { Geom3 } from './type.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export function fromPoints(points: Array>): Geom3 diff --git a/packages/modeling/src/geometries/geom3/fromPoints.js b/packages/modeling/src/geometries/geom3/fromPoints.js index 0e8cd2e72..524af7bd9 100644 --- a/packages/modeling/src/geometries/geom3/fromPoints.js +++ b/packages/modeling/src/geometries/geom3/fromPoints.js @@ -7,8 +7,8 @@ import { create } from './create.js' * The list of vertices should contain sub-arrays, each defining a single polygon of vertices. * In addition, the vertices should follow the right-hand rule for rotation in order to * define an external facing polygon. - * @param {Array} listOfVertices - list of lists, where each list is a set of vertices to construct a polygon - * @returns {geom3} a new geometry + * @param {Array} listOfLists - list of lists, where each list is a set of vertices to construct a polygon + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.fromPoints */ export const fromPoints = (listOfLists) => { diff --git a/packages/modeling/src/geometries/geom3/index.d.ts b/packages/modeling/src/geometries/geom3/index.d.ts index e94363234..1939e8644 100644 --- a/packages/modeling/src/geometries/geom3/index.d.ts +++ b/packages/modeling/src/geometries/geom3/index.d.ts @@ -1,14 +1,14 @@ -export { clone } from './clone' -export { create } from './create' -export { fromPoints } from './fromPoints' -export { fromCompactBinary } from './fromCompactBinary' -export { invert } from './invert' -export { isA } from './isA' -export { toPoints } from './toPoints' -export { toPolygons } from './toPolygons' -export { toString } from './toString' -export { toCompactBinary } from './toCompactBinary' -export { transform } from './transform' -export { validate } from './validate' +export { clone } from './clone.js' +export { create } from './create.js' +export { fromPoints } from './fromPoints.js' +export { fromCompactBinary } from './fromCompactBinary.js' +export { invert } from './invert.js' +export { isA } from './isA.js' +export { toPoints } from './toPoints.js' +export { toPolygons } from './toPolygons.js' +export { toString } from './toString.js' +export { toCompactBinary } from './toCompactBinary.js' +export { transform } from './transform.js' +export { validate } from './validate.js' -export { Geom3 } from './type' +export type { Geom3 } from './type.d.ts' diff --git a/packages/modeling/src/geometries/geom3/invert.d.ts b/packages/modeling/src/geometries/geom3/invert.d.ts index 3634f4eea..9fa5e8750 100644 --- a/packages/modeling/src/geometries/geom3/invert.d.ts +++ b/packages/modeling/src/geometries/geom3/invert.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function invert(geometry: Geom3): Geom3 diff --git a/packages/modeling/src/geometries/geom3/invert.js b/packages/modeling/src/geometries/geom3/invert.js index 8198803f2..94ca72ff8 100644 --- a/packages/modeling/src/geometries/geom3/invert.js +++ b/packages/modeling/src/geometries/geom3/invert.js @@ -5,8 +5,8 @@ import { toPolygons } from './toPolygons.js' /** * Invert the given geometry, transposing solid and empty space. - * @param {geom3} geometry - the geometry to invert - * @return {geom3} a new geometry + * @param {Geom3} geometry - the geometry to invert + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.invert */ export const invert = (geometry) => { diff --git a/packages/modeling/src/geometries/geom3/isA.d.ts b/packages/modeling/src/geometries/geom3/isA.d.ts index 48c3f67d8..f2c6fadc5 100644 --- a/packages/modeling/src/geometries/geom3/isA.d.ts +++ b/packages/modeling/src/geometries/geom3/isA.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function isA(object: any): object is Geom3 diff --git a/packages/modeling/src/geometries/geom3/isA.js b/packages/modeling/src/geometries/geom3/isA.js index 513f7f506..c0fdd063c 100644 --- a/packages/modeling/src/geometries/geom3/isA.js +++ b/packages/modeling/src/geometries/geom3/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a 3D geometry. - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @returns {Boolean} true if the object matches a geom3 * @alias module:modeling/geometries/geom3.isA */ diff --git a/packages/modeling/src/geometries/geom3/toCompactBinary.d.ts b/packages/modeling/src/geometries/geom3/toCompactBinary.d.ts index 48fea35fc..1314307a1 100644 --- a/packages/modeling/src/geometries/geom3/toCompactBinary.d.ts +++ b/packages/modeling/src/geometries/geom3/toCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function toCompactBinary(geom: Geom3): Float32Array diff --git a/packages/modeling/src/geometries/geom3/toCompactBinary.js b/packages/modeling/src/geometries/geom3/toCompactBinary.js index c6653fd02..ead70bfe7 100644 --- a/packages/modeling/src/geometries/geom3/toCompactBinary.js +++ b/packages/modeling/src/geometries/geom3/toCompactBinary.js @@ -2,7 +2,7 @@ import * as poly3 from '../poly3/index.js' /** * Return the given geometry in compact binary representation. - * @param {geom3} geometry - the geometry + * @param {Geom3} geometry - the geometry * @return {TypedArray} compact binary representation * @alias module:modeling/geometries/geom3.toCompactBinary */ diff --git a/packages/modeling/src/geometries/geom3/toPoints.d.ts b/packages/modeling/src/geometries/geom3/toPoints.d.ts index 5edeabc40..28fe7f5a2 100644 --- a/packages/modeling/src/geometries/geom3/toPoints.d.ts +++ b/packages/modeling/src/geometries/geom3/toPoints.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from './type' -import { Vec3 } from '../../maths/vec3/type' +import type { Geom3 } from './type.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export function toPoints(geometry: Geom3): Array> diff --git a/packages/modeling/src/geometries/geom3/toPoints.js b/packages/modeling/src/geometries/geom3/toPoints.js index ee39785e3..e842443a6 100644 --- a/packages/modeling/src/geometries/geom3/toPoints.js +++ b/packages/modeling/src/geometries/geom3/toPoints.js @@ -5,7 +5,7 @@ import { toPolygons } from './toPolygons.js' /** * Return the given geometry as a list of points, after applying transforms. * The returned array should not be modified as the points are shared with the geometry. - * @param {geom3} geometry - the geometry + * @param {Geom3} geometry - the geometry * @return {Array} list of points, where each sub-array represents a polygon * @alias module:modeling/geometries/geom3.toPoints */ diff --git a/packages/modeling/src/geometries/geom3/toPolygons.d.ts b/packages/modeling/src/geometries/geom3/toPolygons.d.ts index e5a72b995..e162aa9c7 100644 --- a/packages/modeling/src/geometries/geom3/toPolygons.d.ts +++ b/packages/modeling/src/geometries/geom3/toPolygons.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from './type' -import { Poly3 } from '../poly3/type' +import type { Geom3 } from './type.d.ts' +import type { Poly3 } from '../poly3/type.d.ts' export function toPolygons(geometry: Geom3): Array diff --git a/packages/modeling/src/geometries/geom3/toPolygons.js b/packages/modeling/src/geometries/geom3/toPolygons.js index 6eb4d615b..f1e795c22 100644 --- a/packages/modeling/src/geometries/geom3/toPolygons.js +++ b/packages/modeling/src/geometries/geom3/toPolygons.js @@ -3,7 +3,7 @@ import { applyTransforms } from './applyTransforms.js' /** * Produces an array of polygons from the given geometry, after applying transforms. * The returned array should not be modified as the polygons are shared with the geometry. - * @param {geom3} geometry - the geometry + * @param {Geom3} geometry - the geometry * @returns {Array} an array of polygons * @alias module:modeling/geometries/geom3.toPolygons * diff --git a/packages/modeling/src/geometries/geom3/toString.d.ts b/packages/modeling/src/geometries/geom3/toString.d.ts index d3002b07a..4573f02f6 100644 --- a/packages/modeling/src/geometries/geom3/toString.d.ts +++ b/packages/modeling/src/geometries/geom3/toString.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from './type' +import type { Geom3 } from './type.d.ts' export function toString(geometry: Geom3): string diff --git a/packages/modeling/src/geometries/geom3/toString.js b/packages/modeling/src/geometries/geom3/toString.js index b3448310e..11e321e9e 100644 --- a/packages/modeling/src/geometries/geom3/toString.js +++ b/packages/modeling/src/geometries/geom3/toString.js @@ -4,8 +4,8 @@ import { toPolygons } from './toPolygons.js' /** * Create a string representing the contents of the given geometry. - * @param {geom3} geometry - the geometry - * @returns {String} a representative string + * @param {Geom3} geometry - the geometry + * @returns {string} a representative string * @alias module:modeling/geometries/geom3.toString * * @example diff --git a/packages/modeling/src/geometries/geom3/transform.d.ts b/packages/modeling/src/geometries/geom3/transform.d.ts index 15acbe003..748cd350d 100644 --- a/packages/modeling/src/geometries/geom3/transform.d.ts +++ b/packages/modeling/src/geometries/geom3/transform.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from './type' -import { Mat4 } from '../../maths/mat4/type' +import type { Geom3 } from './type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' export function transform(matrix: Mat4, geometry: Geom3): Geom3 diff --git a/packages/modeling/src/geometries/geom3/transform.js b/packages/modeling/src/geometries/geom3/transform.js index c24b56b55..8a975735f 100644 --- a/packages/modeling/src/geometries/geom3/transform.js +++ b/packages/modeling/src/geometries/geom3/transform.js @@ -4,9 +4,9 @@ import * as mat4 from '../../maths/mat4/index.js' * Transform the given geometry using the given matrix. * This is a lazy transform of the polygons, as this function only adjusts the transforms. * See applyTransforms() for the actual application of the transforms to the polygons. - * @param {mat4} matrix - the matrix to transform with - * @param {geom3} geometry - the geometry to transform - * @returns {geom3} a new geometry + * @param {Mat4} matrix - the matrix to transform with + * @param {Geom3} geometry - the geometry to transform + * @returns {Geom3} a new geometry * @alias module:modeling/geometries/geom3.transform * * @example diff --git a/packages/modeling/src/geometries/geom3/type.d.ts b/packages/modeling/src/geometries/geom3/type.d.ts index 13185c670..028b822ea 100644 --- a/packages/modeling/src/geometries/geom3/type.d.ts +++ b/packages/modeling/src/geometries/geom3/type.d.ts @@ -1,6 +1,6 @@ -import { Poly3 } from '../poly3/type' -import { Mat4 } from '../../maths/mat4/type' -import { Color } from '../types' +import type { Poly3 } from '../poly3/type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' +import type { Color } from '../types.d.ts' export interface Geom3 { polygons: Array diff --git a/packages/modeling/src/geometries/geom3/validate.js b/packages/modeling/src/geometries/geom3/validate.js index 5c4cc7b63..6e751d37f 100644 --- a/packages/modeling/src/geometries/geom3/validate.js +++ b/packages/modeling/src/geometries/geom3/validate.js @@ -8,7 +8,7 @@ import { isA } from './isA.js' * * **If the geometry is not valid, an exception will be thrown with details of the geometry error.** * - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @throws {Error} error if the geometry is not valid * @alias module:modeling/geometries/geom3.validate */ diff --git a/packages/modeling/src/geometries/index.d.ts b/packages/modeling/src/geometries/index.d.ts index 3d56250b8..425da6609 100644 --- a/packages/modeling/src/geometries/index.d.ts +++ b/packages/modeling/src/geometries/index.d.ts @@ -1,8 +1,6 @@ -export * as geom2 from './geom2' -export * as geom3 from './geom3' -export * as path2 from './path2' -export * as poly2 from './poly2' -export * as poly3 from './poly3' -export * as slice from './slice' - -export as namespace geometries +export * as geom2 from './geom2/index.js' +export * as geom3 from './geom3/index.js' +export * as path2 from './path2/index.js' +export * as poly2 from './poly2/index.js' +export * as poly3 from './poly3/index.js' +export * as slice from './slice/index.js' diff --git a/packages/modeling/src/geometries/path2/appendArc.d.ts b/packages/modeling/src/geometries/path2/appendArc.d.ts index 76de9b8b4..ce9a4f030 100644 --- a/packages/modeling/src/geometries/path2/appendArc.d.ts +++ b/packages/modeling/src/geometries/path2/appendArc.d.ts @@ -1,5 +1,5 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export interface AppendArcOptions { endpoint: Vec2 diff --git a/packages/modeling/src/geometries/path2/appendArc.js b/packages/modeling/src/geometries/path2/appendArc.js index f3b3f360b..08fe9a2b5 100644 --- a/packages/modeling/src/geometries/path2/appendArc.js +++ b/packages/modeling/src/geometries/path2/appendArc.js @@ -8,15 +8,15 @@ import { toPoints } from './toPoints.js' * Append a series of points to the given geometry that represent an arc. * This implementation follows the SVG specifications. * @see http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands - * @param {Object} options - options for construction - * @param {vec2} options.endpoint - end point of arc (REQUIRED) - * @param {vec2} [options.radius=[0,0]] - radius of arc (X and Y) - * @param {Number} [options.xaxisRotation=0] - rotation (RADIANS) of the X axis of the arc with respect to the X axis of the coordinate system - * @param {Boolean} [options.clockwise=false] - draw an arc clockwise with respect to the center point - * @param {Boolean} [options.large=false] - draw an arc longer than TAU / 2 radians - * @param {Number} [options.segments=16] - number of segments per full rotation - * @param {path2} geometry - the path of which to append the arc - * @returns {path2} a new path with the appended points + * @param {object} options - options for construction + * @param {Vec2} options.endpoint - end point of arc (REQUIRED) + * @param {Vec2} [options.radius=[0,0]] - radius of arc (X and Y) + * @param {number} [options.xaxisRotation=0] - rotation (RADIANS) of the X axis of the arc with respect to the X axis of the coordinate system + * @param {boolean} [options.clockwise=false] - draw an arc clockwise with respect to the center point + * @param {boolean} [options.large=false] - draw an arc longer than TAU / 2 radians + * @param {number} [options.segments=16] - number of segments per full rotation + * @param {Path2} geometry - the path of which to append the arc + * @returns {Path2} a new path with the appended points * @alias module:modeling/geometries/path2.appendArc * * @example diff --git a/packages/modeling/src/geometries/path2/appendArc.test.js b/packages/modeling/src/geometries/path2/appendArc.test.js index 1c5171e83..82a3b4a52 100644 --- a/packages/modeling/src/geometries/path2/appendArc.test.js +++ b/packages/modeling/src/geometries/path2/appendArc.test.js @@ -1,6 +1,7 @@ import test from 'ava' import { TAU } from '../../maths/constants.js' +import * as vec2 from '../../maths/vec2/index.js' import { appendArc, fromPoints, toPoints } from './index.js' @@ -73,7 +74,7 @@ test('appendArc: appending to a path produces a new path', (t) => { test('appendArc: appending to a path produces exact endpoint', (t) => { let p1 = fromPoints({}, [[18, 1.8], [1, 3]]) - const endpoint = [1, -3] + const endpoint = vec2.fromValues(1, -3) p1 = appendArc({ endpoint, diff --git a/packages/modeling/src/geometries/path2/appendBezier.d.ts b/packages/modeling/src/geometries/path2/appendBezier.d.ts index a26e78254..1fdb741ff 100644 --- a/packages/modeling/src/geometries/path2/appendBezier.d.ts +++ b/packages/modeling/src/geometries/path2/appendBezier.d.ts @@ -1,5 +1,5 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export interface AppendBezierOptions { controlPoints: Array diff --git a/packages/modeling/src/geometries/path2/appendBezier.js b/packages/modeling/src/geometries/path2/appendBezier.js index c66cf38c2..20e7086fc 100644 --- a/packages/modeling/src/geometries/path2/appendBezier.js +++ b/packages/modeling/src/geometries/path2/appendBezier.js @@ -12,11 +12,11 @@ import { toPoints } from './toPoints.js' * The first control point may be null to ensure a smooth transition occurs. In this case, * the second to last point of the given geometry is mirrored into the control points of the Bézier curve. * In other words, the trailing gradient of the geometry matches the new gradient of the curve. - * @param {Object} options - options for construction + * @param {object} options - options for construction * @param {Array} options.controlPoints - list of control points (2D) for the Bézier curve - * @param {Number} [options.segment=16] - number of segments per 360 rotation - * @param {path2} geometry - the path of which to append points - * @returns {path2} a new path with the appended points + * @param {number} [options.segment=16] - number of segments per 360 rotation + * @param {Path2} geometry - the path of which to append points + * @returns {Path2} a new path with the appended points * @alias module:modeling/geometries/path2.appendBezier * * @example diff --git a/packages/modeling/src/geometries/path2/appendPoints.d.ts b/packages/modeling/src/geometries/path2/appendPoints.d.ts index 179dc6555..d026f1282 100644 --- a/packages/modeling/src/geometries/path2/appendPoints.d.ts +++ b/packages/modeling/src/geometries/path2/appendPoints.d.ts @@ -1,4 +1,4 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function appendPoints(points: Array, geometry: Path2): Path2 diff --git a/packages/modeling/src/geometries/path2/appendPoints.js b/packages/modeling/src/geometries/path2/appendPoints.js index 7344b2c15..5a2e8c635 100644 --- a/packages/modeling/src/geometries/path2/appendPoints.js +++ b/packages/modeling/src/geometries/path2/appendPoints.js @@ -4,8 +4,8 @@ import { create } from './create.js' /** * Append the given list of points to the end of the given geometry. * @param {Array} points - the points (2D) to append to the given path - * @param {path2} geometry - the given path - * @returns {path2} a new path with the appended points + * @param {Path2} geometry - the given path + * @returns {Path2} a new path with the appended points * @alias module:modeling/geometries/path2.appendPoints * @example * let newPath = appendPoints([[3, 4], [4, 5]], oldPath) diff --git a/packages/modeling/src/geometries/path2/clone.d.ts b/packages/modeling/src/geometries/path2/clone.d.ts index 9c8c43ca9..5c834b220 100644 --- a/packages/modeling/src/geometries/path2/clone.d.ts +++ b/packages/modeling/src/geometries/path2/clone.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function clone(geometry: Path2): Path2 diff --git a/packages/modeling/src/geometries/path2/clone.js b/packages/modeling/src/geometries/path2/clone.js index 4602a20b8..7d83e70a3 100644 --- a/packages/modeling/src/geometries/path2/clone.js +++ b/packages/modeling/src/geometries/path2/clone.js @@ -1,7 +1,7 @@ /** * Performs a shallow clone of the give geometry. - * @param {path2} geometry - the geometry to clone - * @returns {path2} a new path + * @param {Path2} geometry - the geometry to clone + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.clone */ export const clone = (geometry) => Object.assign({}, geometry) diff --git a/packages/modeling/src/geometries/path2/close.d.ts b/packages/modeling/src/geometries/path2/close.d.ts index c9e8c3614..b6dff6e8e 100644 --- a/packages/modeling/src/geometries/path2/close.d.ts +++ b/packages/modeling/src/geometries/path2/close.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function close(geometry: Path2): Path2 diff --git a/packages/modeling/src/geometries/path2/close.js b/packages/modeling/src/geometries/path2/close.js index 3d5e4010e..c886fe3c4 100644 --- a/packages/modeling/src/geometries/path2/close.js +++ b/packages/modeling/src/geometries/path2/close.js @@ -6,8 +6,8 @@ import { clone } from './clone.js' /** * Close the given geometry. - * @param {path2} geometry - the path to close - * @returns {path2} a new path + * @param {Path2} geometry - the path to close + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.close */ export const close = (geometry) => { diff --git a/packages/modeling/src/geometries/path2/concat.d.ts b/packages/modeling/src/geometries/path2/concat.d.ts index 3217abf73..bd9ed0612 100644 --- a/packages/modeling/src/geometries/path2/concat.d.ts +++ b/packages/modeling/src/geometries/path2/concat.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function concat(...paths: Array): Path2 diff --git a/packages/modeling/src/geometries/path2/concat.js b/packages/modeling/src/geometries/path2/concat.js index 915677af4..aeb2286b0 100644 --- a/packages/modeling/src/geometries/path2/concat.js +++ b/packages/modeling/src/geometries/path2/concat.js @@ -10,8 +10,8 @@ import { toPoints } from './toPoints.js' * A concatenation of zero paths is an empty, open path. * A concatenation of one closed path to a series of open paths produces a closed path. * A concatenation of a path to a closed path is an error. - * @param {...path2} paths - the paths to concatenate - * @returns {path2} a new path + * @param {...Path2} paths - the paths to concatenate + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.concat * * @example diff --git a/packages/modeling/src/geometries/path2/create.d.ts b/packages/modeling/src/geometries/path2/create.d.ts index c7f2c2179..908e9e0a3 100644 --- a/packages/modeling/src/geometries/path2/create.d.ts +++ b/packages/modeling/src/geometries/path2/create.d.ts @@ -1,4 +1,4 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function create(points?: Array): Path2 diff --git a/packages/modeling/src/geometries/path2/create.js b/packages/modeling/src/geometries/path2/create.js index 88568d7b8..d720cf503 100644 --- a/packages/modeling/src/geometries/path2/create.js +++ b/packages/modeling/src/geometries/path2/create.js @@ -2,10 +2,9 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Represents a 2D geometry consisting of a list of ordered points. - * @typedef {Object} path2 * @property {Array} points - list of ordered points - * @property {Boolean} isClosed - true if the path is closed where start and end points are the same - * @property {mat4} transforms - transforms to apply to the points, see transform() + * @property {boolean} isClosed - true if the path is closed where start and end points are the same + * @property {Mat4} transforms - transforms to apply to the points, see transform() * @example * { * "points": [[0,0], [4,0], [4,3]], @@ -16,7 +15,7 @@ import * as mat4 from '../../maths/mat4/index.js' /** * Create an empty, open path. - * @returns {path2} a new path + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.create * * @example diff --git a/packages/modeling/src/geometries/path2/equals.d.ts b/packages/modeling/src/geometries/path2/equals.d.ts index 221fede6b..a5fda0501 100644 --- a/packages/modeling/src/geometries/path2/equals.d.ts +++ b/packages/modeling/src/geometries/path2/equals.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function equals(a: Path2, b: Path2): boolean diff --git a/packages/modeling/src/geometries/path2/equals.js b/packages/modeling/src/geometries/path2/equals.js index de021a418..0530d1c30 100644 --- a/packages/modeling/src/geometries/path2/equals.js +++ b/packages/modeling/src/geometries/path2/equals.js @@ -5,8 +5,8 @@ import { toPoints } from './toPoints.js' /** * Determine if the given paths are equal. * For closed paths, this includes equality under point order rotation. - * @param {path2} a - the first path to compare - * @param {path2} b - the second path to compare + * @param {Path2} a - the first path to compare + * @param {Path2} b - the second path to compare * @returns {Boolean} * @alias module:modeling/geometries/path2.equals */ diff --git a/packages/modeling/src/geometries/path2/fromCompactBinary.d.ts b/packages/modeling/src/geometries/path2/fromCompactBinary.d.ts index 7d48c30da..c9a33cadc 100644 --- a/packages/modeling/src/geometries/path2/fromCompactBinary.d.ts +++ b/packages/modeling/src/geometries/path2/fromCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function fromCompactBinary(data: Array | Float32Array | Float64Array): Path2 diff --git a/packages/modeling/src/geometries/path2/fromCompactBinary.js b/packages/modeling/src/geometries/path2/fromCompactBinary.js index 93679a07c..5d9bf90f0 100644 --- a/packages/modeling/src/geometries/path2/fromCompactBinary.js +++ b/packages/modeling/src/geometries/path2/fromCompactBinary.js @@ -6,7 +6,7 @@ import { create } from './create.js' /** * Create a new path from the given compact binary data. * @param {TypedArray} data - compact binary data - * @returns {path2} a new path + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.fromCompactBinary */ export const fromCompactBinary = (data) => { diff --git a/packages/modeling/src/geometries/path2/fromPoints.d.ts b/packages/modeling/src/geometries/path2/fromPoints.d.ts index d299947ec..6d80c3005 100644 --- a/packages/modeling/src/geometries/path2/fromPoints.d.ts +++ b/packages/modeling/src/geometries/path2/fromPoints.d.ts @@ -1,5 +1,5 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export interface FromPointsOptions { closed?: boolean diff --git a/packages/modeling/src/geometries/path2/fromPoints.js b/packages/modeling/src/geometries/path2/fromPoints.js index 3a0ab6c3e..90771ec62 100644 --- a/packages/modeling/src/geometries/path2/fromPoints.js +++ b/packages/modeling/src/geometries/path2/fromPoints.js @@ -9,10 +9,10 @@ import { create } from './create.js' * Create a new path from the given points. * The points must be provided an array of points, * where each point is an array of two numbers. - * @param {Object} options - options for construction - * @param {Boolean} [options.closed=false] - if the path should be open or closed + * @param {object} options - options for construction + * @param {boolean} [options.closed=false] - if the path should be open or closed * @param {Array} points - array of points (2D) from which to create the path - * @returns {path2} a new path + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.fromPoints * * @example: diff --git a/packages/modeling/src/geometries/path2/index.d.ts b/packages/modeling/src/geometries/path2/index.d.ts index 56aa1901c..c74179731 100644 --- a/packages/modeling/src/geometries/path2/index.d.ts +++ b/packages/modeling/src/geometries/path2/index.d.ts @@ -1,19 +1,19 @@ -export { appendArc, AppendArcOptions } from './appendArc' -export { appendBezier, AppendBezierOptions } from './appendBezier' -export { appendPoints } from './appendPoints' -export { clone } from './clone' -export { close } from './close' -export { concat } from './concat' -export { create } from './create' -export { equals } from './equals' -export { fromPoints, FromPointsOptions } from './fromPoints' -export { fromCompactBinary } from './fromCompactBinary' -export { isA } from './isA' -export { reverse } from './reverse' -export { toPoints } from './toPoints' -export { toString } from './toString' -export { toCompactBinary } from './toCompactBinary' -export { transform } from './transform' -export { validate } from './validate' +export { appendArc, AppendArcOptions } from './appendArc.js' +export { appendBezier, AppendBezierOptions } from './appendBezier.js' +export { appendPoints } from './appendPoints.js' +export { clone } from './clone.js' +export { close } from './close.js' +export { concat } from './concat.js' +export { create } from './create.js' +export { equals } from './equals.js' +export { fromPoints, FromPointsOptions } from './fromPoints.js' +export { fromCompactBinary } from './fromCompactBinary.js' +export { isA } from './isA.js' +export { reverse } from './reverse.js' +export { toPoints } from './toPoints.js' +export { toString } from './toString.js' +export { toCompactBinary } from './toCompactBinary.js' +export { transform } from './transform.js' +export { validate } from './validate.js' -export { Path2 } from './type' +export type { Path2 } from './type.d.ts' diff --git a/packages/modeling/src/geometries/path2/isA.d.ts b/packages/modeling/src/geometries/path2/isA.d.ts index 7c681a3de..2d37b8439 100644 --- a/packages/modeling/src/geometries/path2/isA.d.ts +++ b/packages/modeling/src/geometries/path2/isA.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function isA(object: any): object is Path2 diff --git a/packages/modeling/src/geometries/path2/isA.js b/packages/modeling/src/geometries/path2/isA.js index 56faf4632..9ac5f2cb1 100644 --- a/packages/modeling/src/geometries/path2/isA.js +++ b/packages/modeling/src/geometries/path2/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a path2 geometry. - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @returns {Boolean} true if the object matches a path2 * @alias module:modeling/geometries/path2.isA */ diff --git a/packages/modeling/src/geometries/path2/reverse.d.ts b/packages/modeling/src/geometries/path2/reverse.d.ts index f9c50cdda..5c9a7b1b8 100644 --- a/packages/modeling/src/geometries/path2/reverse.d.ts +++ b/packages/modeling/src/geometries/path2/reverse.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function reverse(path: Path2): Path2 diff --git a/packages/modeling/src/geometries/path2/reverse.js b/packages/modeling/src/geometries/path2/reverse.js index 4ab5fd42f..965b8c211 100644 --- a/packages/modeling/src/geometries/path2/reverse.js +++ b/packages/modeling/src/geometries/path2/reverse.js @@ -3,8 +3,8 @@ import { clone } from './clone.js' /** * Reverses the path so that the points are in the opposite order. * This swaps the left (interior) and right (exterior) edges. - * @param {path2} geometry - the path to reverse - * @returns {path2} a new path + * @param {Path2} geometry - the path to reverse + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.reverse * * @example diff --git a/packages/modeling/src/geometries/path2/toCompactBinary.d.ts b/packages/modeling/src/geometries/path2/toCompactBinary.d.ts index 5a74b50d9..48bd16d62 100644 --- a/packages/modeling/src/geometries/path2/toCompactBinary.d.ts +++ b/packages/modeling/src/geometries/path2/toCompactBinary.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function toCompactBinary(geometry: Path2): Float32Array diff --git a/packages/modeling/src/geometries/path2/toCompactBinary.js b/packages/modeling/src/geometries/path2/toCompactBinary.js index e6e75e9d4..d321c62ba 100644 --- a/packages/modeling/src/geometries/path2/toCompactBinary.js +++ b/packages/modeling/src/geometries/path2/toCompactBinary.js @@ -1,6 +1,6 @@ /** * Produce a compact binary representation from the given path. - * @param {path2} geometry - the path geometry + * @param {Path2} geometry - the path geometry * @returns {TypedArray} compact binary representation * @alias module:modeling/geometries/path2.toCompactBinary */ diff --git a/packages/modeling/src/geometries/path2/toPoints.d.ts b/packages/modeling/src/geometries/path2/toPoints.d.ts index fb43f9701..ae60e42c2 100644 --- a/packages/modeling/src/geometries/path2/toPoints.d.ts +++ b/packages/modeling/src/geometries/path2/toPoints.d.ts @@ -1,4 +1,4 @@ -import { Path2 } from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Path2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function toPoints(geometry: Path2): Array diff --git a/packages/modeling/src/geometries/path2/toPoints.js b/packages/modeling/src/geometries/path2/toPoints.js index 63d88b61b..e5106c4c5 100644 --- a/packages/modeling/src/geometries/path2/toPoints.js +++ b/packages/modeling/src/geometries/path2/toPoints.js @@ -3,7 +3,7 @@ import { applyTransforms } from './applyTransforms.js' /** * Produces an array of points from the given geometry. * The returned array should not be modified as the data is shared with the geometry. - * @param {path2} geometry - the geometry + * @param {Path2} geometry - the geometry * @returns {Array} an array of points * @alias module:modeling/geometries/path2.toPoints * diff --git a/packages/modeling/src/geometries/path2/toString.d.ts b/packages/modeling/src/geometries/path2/toString.d.ts index 116a24e3a..f79cccbcd 100644 --- a/packages/modeling/src/geometries/path2/toString.d.ts +++ b/packages/modeling/src/geometries/path2/toString.d.ts @@ -1,3 +1,3 @@ -import { Path2 } from './type' +import type { Path2 } from './type.d.ts' export function toString(geometry: Path2): string diff --git a/packages/modeling/src/geometries/path2/toString.js b/packages/modeling/src/geometries/path2/toString.js index d2c256f27..382e51c0a 100644 --- a/packages/modeling/src/geometries/path2/toString.js +++ b/packages/modeling/src/geometries/path2/toString.js @@ -4,8 +4,8 @@ import { toPoints } from './toPoints.js' /** * Create a string representing the contents of the given path. - * @param {path2} geometry - the path - * @returns {String} a representative string + * @param {Path2} geometry - the path + * @returns {string} a representative string * @alias module:modeling/geometries/path2.toString * * @example diff --git a/packages/modeling/src/geometries/path2/transform.d.ts b/packages/modeling/src/geometries/path2/transform.d.ts index 866cbe965..67bb80731 100644 --- a/packages/modeling/src/geometries/path2/transform.d.ts +++ b/packages/modeling/src/geometries/path2/transform.d.ts @@ -1,4 +1,4 @@ -import { Path2 } from './type' -import { Mat4 } from '../../maths/mat4/type' +import type { Path2 } from './type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' export function transform(matrix: Mat4, geometry: Path2): Path2 diff --git a/packages/modeling/src/geometries/path2/transform.js b/packages/modeling/src/geometries/path2/transform.js index e74b0a1d9..81c8ef696 100644 --- a/packages/modeling/src/geometries/path2/transform.js +++ b/packages/modeling/src/geometries/path2/transform.js @@ -4,9 +4,9 @@ import * as mat4 from '../../maths/mat4/index.js' * Transform the given geometry using the given matrix. * This is a lazy transform of the points, as this function only adjusts the transforms. * The transforms are applied when accessing the points via toPoints(). - * @param {mat4} matrix - the matrix to transform with - * @param {path2} geometry - the geometry to transform - * @returns {path2} a new path + * @param {Mat4} matrix - the matrix to transform with + * @param {Path2} geometry - the geometry to transform + * @returns {Path2} a new path * @alias module:modeling/geometries/path2.transform * * @example diff --git a/packages/modeling/src/geometries/path2/type.d.ts b/packages/modeling/src/geometries/path2/type.d.ts index 5c886f65b..b1361760c 100644 --- a/packages/modeling/src/geometries/path2/type.d.ts +++ b/packages/modeling/src/geometries/path2/type.d.ts @@ -1,6 +1,6 @@ -import { Vec2 } from '../../maths/vec2/type' -import { Mat4 } from '../../maths/mat4/type' -import { Color } from '../types' +import type { Vec2 } from '../../maths/vec2/type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' +import type { Color } from '../types.d.ts' export interface Path2 { points: Array diff --git a/packages/modeling/src/geometries/path2/validate.js b/packages/modeling/src/geometries/path2/validate.js index 198ad665c..624638145 100644 --- a/packages/modeling/src/geometries/path2/validate.js +++ b/packages/modeling/src/geometries/path2/validate.js @@ -8,7 +8,7 @@ import { isA } from './isA.js' * * **If the geometry is not valid, an exception will be thrown with details of the geometry error.** * - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @throws {Error} error if the geometry is not valid * @alias module:modeling/geometries/path2.validate */ diff --git a/packages/modeling/src/geometries/poly2/arePointsInside.d.ts b/packages/modeling/src/geometries/poly2/arePointsInside.d.ts index 971ac91a4..1f8ba5bf0 100644 --- a/packages/modeling/src/geometries/poly2/arePointsInside.d.ts +++ b/packages/modeling/src/geometries/poly2/arePointsInside.d.ts @@ -1,4 +1,4 @@ -import Poly2 from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Poly2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function arePointsInside(points: Array, polygon: Poly2): number diff --git a/packages/modeling/src/geometries/poly2/arePointsInside.js b/packages/modeling/src/geometries/poly2/arePointsInside.js index 06ded05cb..61bfde421 100644 --- a/packages/modeling/src/geometries/poly2/arePointsInside.js +++ b/packages/modeling/src/geometries/poly2/arePointsInside.js @@ -5,7 +5,7 @@ import { reverse } from './reverse.js' * Determine if the given points are inside the given polygon. * * @param {Array} points - a list of points, where each point is an array with X and Y values - * @param {poly2} polygon - a 2D polygon + * @param {Poly2} polygon - a 2D polygon * @return {number} 1 if all points are inside, 0 if some or none are inside * @alias module:modeling/geometries/poly2.arePointsInside */ diff --git a/packages/modeling/src/geometries/poly2/clone.d.ts b/packages/modeling/src/geometries/poly2/clone.d.ts index 897fb4130..300da844e 100644 --- a/packages/modeling/src/geometries/poly2/clone.d.ts +++ b/packages/modeling/src/geometries/poly2/clone.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function clone(polygon: Poly2): Poly2 diff --git a/packages/modeling/src/geometries/poly2/clone.js b/packages/modeling/src/geometries/poly2/clone.js index 02369e260..bf56240e2 100644 --- a/packages/modeling/src/geometries/poly2/clone.js +++ b/packages/modeling/src/geometries/poly2/clone.js @@ -1,8 +1,8 @@ /** * Create a shallow clone of the given polygon. * - * @param {poly2} polygon - polygon to clone - * @returns {poly2} a new polygon + * @param {Poly2} polygon - polygon to clone + * @returns {Poly2} a new polygon * @alias module:modeling/geometries/poly2.clone */ export const clone = (polygon) => Object.assign({}, polygon) diff --git a/packages/modeling/src/geometries/poly2/create.d.ts b/packages/modeling/src/geometries/poly2/create.d.ts index 2405d261d..0565912de 100644 --- a/packages/modeling/src/geometries/poly2/create.d.ts +++ b/packages/modeling/src/geometries/poly2/create.d.ts @@ -1,4 +1,4 @@ -import Poly2 from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Poly2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function create(points?: Array): Poly2 diff --git a/packages/modeling/src/geometries/poly2/create.js b/packages/modeling/src/geometries/poly2/create.js index 3ca30d24d..cad2b38b3 100644 --- a/packages/modeling/src/geometries/poly2/create.js +++ b/packages/modeling/src/geometries/poly2/create.js @@ -2,7 +2,6 @@ * Represents a 2D polygon consisting of a list of ordered points * which is closed between start and end points. * @see https://en.wikipedia.org/wiki/Polygon - * @typedef {Object} poly2 * @property {Array} points - list of ordered points (2D) */ @@ -10,7 +9,7 @@ * Creates a new polygon with initial values. * * @param {Array} [points] - list of points (2D) - * @returns {poly2} a new polygon + * @returns {Poly2} a new polygon * @alias module:modeling/geometries/poly2.create * * @example diff --git a/packages/modeling/src/geometries/poly2/index.d.ts b/packages/modeling/src/geometries/poly2/index.d.ts index a2038bf4d..fcdfe89f3 100644 --- a/packages/modeling/src/geometries/poly2/index.d.ts +++ b/packages/modeling/src/geometries/poly2/index.d.ts @@ -1,15 +1,15 @@ -export { arePointsInside } from './arePointsInside' -export { clone } from './clone' -export { create } from './create' -export { isA } from './isA' -export { isConvex } from './isConvex' -export { isSimple } from './isSimple' -export { measureArea } from './measureArea' -export { measureBoundingBox } from './measureBoundingBox' -export { reverse } from './reverse' -export { toPoints } from './toPoints' -export { toString } from './toString' -export { transform } from './transform' -export { validate } from './validate' +export { arePointsInside } from './arePointsInside.js' +export { clone } from './clone.js' +export { create } from './create.js' +export { isA } from './isA.js' +export { isConvex } from './isConvex.js' +export { isSimple } from './isSimple.js' +export { measureArea } from './measureArea.js' +export { measureBoundingBox } from './measureBoundingBox.js' +export { reverse } from './reverse.js' +export { toPoints } from './toPoints.js' +export { toString } from './toString.js' +export { transform } from './transform.js' +export { validate } from './validate.js' -export { Poly2 } from './type' +export type { Poly2 } from './type.d.ts' diff --git a/packages/modeling/src/geometries/poly2/isA.d.ts b/packages/modeling/src/geometries/poly2/isA.d.ts index f906745bb..4e8a04f81 100644 --- a/packages/modeling/src/geometries/poly2/isA.d.ts +++ b/packages/modeling/src/geometries/poly2/isA.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function isA(object: any): object is Poly2 diff --git a/packages/modeling/src/geometries/poly2/isA.js b/packages/modeling/src/geometries/poly2/isA.js index 00cba6dec..b3c283721 100644 --- a/packages/modeling/src/geometries/poly2/isA.js +++ b/packages/modeling/src/geometries/poly2/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a 2D polygon. - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @returns {Boolean} true if the object matches a poly2 * @alias module:modeling/geometries/poly2.isA */ diff --git a/packages/modeling/src/geometries/poly2/isConvex.d.ts b/packages/modeling/src/geometries/poly2/isConvex.d.ts index 76a5d76a5..bcc72396c 100644 --- a/packages/modeling/src/geometries/poly2/isConvex.d.ts +++ b/packages/modeling/src/geometries/poly2/isConvex.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function isConvex(polygon: Poly2): boolean diff --git a/packages/modeling/src/geometries/poly2/isConvex.js b/packages/modeling/src/geometries/poly2/isConvex.js index c9882da31..d6a17fc66 100644 --- a/packages/modeling/src/geometries/poly2/isConvex.js +++ b/packages/modeling/src/geometries/poly2/isConvex.js @@ -1,6 +1,6 @@ /** * Check whether the given polygon is convex. - * @param {poly2} polygon - the polygon to interrogate + * @param {Poly2} polygon - the polygon to interrogate * @returns {Boolean} true if convex * @alias module:modeling/geometries/poly2.isConvex */ diff --git a/packages/modeling/src/geometries/poly2/isSimple.d.ts b/packages/modeling/src/geometries/poly2/isSimple.d.ts index c32d4f438..9f3c083b5 100644 --- a/packages/modeling/src/geometries/poly2/isSimple.d.ts +++ b/packages/modeling/src/geometries/poly2/isSimple.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function isSimple(polygon: Poly2): boolean diff --git a/packages/modeling/src/geometries/poly2/isSimple.js b/packages/modeling/src/geometries/poly2/isSimple.js index 02162a488..a91816baf 100644 --- a/packages/modeling/src/geometries/poly2/isSimple.js +++ b/packages/modeling/src/geometries/poly2/isSimple.js @@ -3,7 +3,7 @@ import { intersect } from '../../maths/utils/intersect.js' /** * Check whether the given polygon is simple, i.e. does not intersect itself. * @see https://en.wikipedia.org/wiki/Simple_polygon - * @param {poly2} polygon - the polygon to interrogate + * @param {Poly2} polygon - the polygon to interrogate * @returns {Boolean} true if simple * @alias module:modeling/geometries/poly2.isSimple */ diff --git a/packages/modeling/src/geometries/poly2/measureArea.d.ts b/packages/modeling/src/geometries/poly2/measureArea.d.ts index 1ecd8eb75..cf7afda41 100644 --- a/packages/modeling/src/geometries/poly2/measureArea.d.ts +++ b/packages/modeling/src/geometries/poly2/measureArea.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function measureArea(polygon: Poly2): number diff --git a/packages/modeling/src/geometries/poly2/measureArea.js b/packages/modeling/src/geometries/poly2/measureArea.js index 9d0447ab3..908f1bc5b 100644 --- a/packages/modeling/src/geometries/poly2/measureArea.js +++ b/packages/modeling/src/geometries/poly2/measureArea.js @@ -3,8 +3,8 @@ import { area } from '../../maths/utils/area.js' /** * Measure the area under the given polygon. * - * @param {poly2} polygon - the polygon to measure - * @return {Number} the area of the polygon + * @param {Poly2} polygon - the polygon to measure + * @return {number} the area of the polygon * @alias module:modeling/geometries/poly2.measureArea */ export const measureArea = (polygon) => area(polygon.points) diff --git a/packages/modeling/src/geometries/poly2/measureBoundingBox.d.ts b/packages/modeling/src/geometries/poly2/measureBoundingBox.d.ts index 0ed24fb22..d8751f16f 100644 --- a/packages/modeling/src/geometries/poly2/measureBoundingBox.d.ts +++ b/packages/modeling/src/geometries/poly2/measureBoundingBox.d.ts @@ -1,4 +1,4 @@ -import Poly2 from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Poly2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function measureBoundingBox(polygon: Poly2): [Vec2, Vec2] diff --git a/packages/modeling/src/geometries/poly2/measureBoundingBox.js b/packages/modeling/src/geometries/poly2/measureBoundingBox.js index 2e6a4bb09..34ecce039 100644 --- a/packages/modeling/src/geometries/poly2/measureBoundingBox.js +++ b/packages/modeling/src/geometries/poly2/measureBoundingBox.js @@ -1,7 +1,7 @@ import * as vec2 from '../../maths/vec2/index.js' /** - * @param {poly2} polygon - the polygon to measure + * @param {Poly2} polygon - the polygon to measure * @returns {Array} an array of two vectors (2D); minimum and maximum coordinates * @alias module:modeling/geometries/poly2.measureBoundingBox */ diff --git a/packages/modeling/src/geometries/poly2/reverse.d.ts b/packages/modeling/src/geometries/poly2/reverse.d.ts index 401bbacb0..72fb76048 100644 --- a/packages/modeling/src/geometries/poly2/reverse.d.ts +++ b/packages/modeling/src/geometries/poly2/reverse.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function reverse(polygon: Poly2): Poly2 diff --git a/packages/modeling/src/geometries/poly2/reverse.js b/packages/modeling/src/geometries/poly2/reverse.js index 78b228980..5550c39c8 100644 --- a/packages/modeling/src/geometries/poly2/reverse.js +++ b/packages/modeling/src/geometries/poly2/reverse.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Reverse the direction of points in the given polygon, rotating the opposite direction. * - * @param {poly2} polygon - the polygon to reverse - * @returns {poly2} a new polygon + * @param {Poly2} polygon - the polygon to reverse + * @returns {Poly2} a new polygon * @alias module:modeling/geometries/poly2.reverse */ export const reverse = (polygon) => { diff --git a/packages/modeling/src/geometries/poly2/toPoints.d.ts b/packages/modeling/src/geometries/poly2/toPoints.d.ts index e4c6b85f7..4c8f24cf1 100644 --- a/packages/modeling/src/geometries/poly2/toPoints.d.ts +++ b/packages/modeling/src/geometries/poly2/toPoints.d.ts @@ -1,4 +1,4 @@ -import Poly2 from './type' -import { Vec2 } from '../../maths/vec2/type' +import type { Poly2 } from './type.d.ts' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export function toPoints(polygon: Poly2): Array diff --git a/packages/modeling/src/geometries/poly2/toPoints.js b/packages/modeling/src/geometries/poly2/toPoints.js index e5a9d7baa..a942725f5 100644 --- a/packages/modeling/src/geometries/poly2/toPoints.js +++ b/packages/modeling/src/geometries/poly2/toPoints.js @@ -1,7 +1,7 @@ /** * Return the given polygon as a list of points. * NOTE: The returned array should not be modified as the points are shared with the geometry. - * @param {poly2} polygon - the polygon + * @param {Poly2} polygon - the polygon * @return {Array} list of points (2D) * @alias module:modeling/geometries/poly2.toPoints */ diff --git a/packages/modeling/src/geometries/poly2/toString.d.ts b/packages/modeling/src/geometries/poly2/toString.d.ts index 0138f6822..85d645c83 100644 --- a/packages/modeling/src/geometries/poly2/toString.d.ts +++ b/packages/modeling/src/geometries/poly2/toString.d.ts @@ -1,3 +1,3 @@ -import Poly2 from './type' +import type { Poly2 } from './type.d.ts' export function toString(polygon: Poly2): string diff --git a/packages/modeling/src/geometries/poly2/toString.js b/packages/modeling/src/geometries/poly2/toString.js index d73ca8f5f..0436e9313 100644 --- a/packages/modeling/src/geometries/poly2/toString.js +++ b/packages/modeling/src/geometries/poly2/toString.js @@ -2,7 +2,7 @@ import * as vec2 from '../../maths/vec2/index.js' /** * Convert the given polygon to a readable string. - * @param {poly2} polygon - the polygon to convert + * @param {Poly2} polygon - the polygon to convert * @return {String} the string representation * @alias module:modeling/geometries/poly2.toString */ diff --git a/packages/modeling/src/geometries/poly2/transform.d.ts b/packages/modeling/src/geometries/poly2/transform.d.ts index fd7787c9d..f623d894e 100644 --- a/packages/modeling/src/geometries/poly2/transform.d.ts +++ b/packages/modeling/src/geometries/poly2/transform.d.ts @@ -1,4 +1,4 @@ -import Poly2 from './type' -import { Mat4 } from '../../maths/mat4/type' +import type { Poly2 } from './type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' export function transform(matrix: Mat4, polygon: Poly2): Poly2 diff --git a/packages/modeling/src/geometries/poly2/transform.js b/packages/modeling/src/geometries/poly2/transform.js index 9cdc64e41..6ccc5c460 100644 --- a/packages/modeling/src/geometries/poly2/transform.js +++ b/packages/modeling/src/geometries/poly2/transform.js @@ -5,9 +5,9 @@ import { create } from './create.js' /** * Transform the given polygon using the given matrix. - * @param {mat4} matrix - the matrix to transform with - * @param {poly2} polygon - the polygon to transform - * @returns {poly2} a new polygon + * @param {Mat4} matrix - the matrix to transform with + * @param {Poly2} polygon - the polygon to transform + * @returns {Poly2} a new polygon * @alias module:modeling/geometries/poly2.transform */ export const transform = (matrix, polygon) => { diff --git a/packages/modeling/src/geometries/poly2/type.d.ts b/packages/modeling/src/geometries/poly2/type.d.ts index 60a501870..5493f25e7 100644 --- a/packages/modeling/src/geometries/poly2/type.d.ts +++ b/packages/modeling/src/geometries/poly2/type.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from '../../maths/vec2/type' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export declare interface Poly2 { points: Array diff --git a/packages/modeling/src/geometries/poly2/validate.js b/packages/modeling/src/geometries/poly2/validate.js index a2f1e3835..bff2a0879 100644 --- a/packages/modeling/src/geometries/poly2/validate.js +++ b/packages/modeling/src/geometries/poly2/validate.js @@ -9,7 +9,7 @@ import { measureArea } from './measureArea.js' * * **If the geometry is not valid, an exception will be thrown with details of the geometry error.** * - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @throws {Error} error if the geometry is not valid * @alias module:modeling/geometries/poly2.validate */ diff --git a/packages/modeling/src/geometries/poly3/clone.d.ts b/packages/modeling/src/geometries/poly3/clone.d.ts index f30bca7af..74bf69f00 100644 --- a/packages/modeling/src/geometries/poly3/clone.d.ts +++ b/packages/modeling/src/geometries/poly3/clone.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function clone(polygon: Poly3): Poly3 export function clone(out: Poly3, polygon: Poly3): Poly3 diff --git a/packages/modeling/src/geometries/poly3/clone.js b/packages/modeling/src/geometries/poly3/clone.js index baddebe56..29d7a7e1d 100644 --- a/packages/modeling/src/geometries/poly3/clone.js +++ b/packages/modeling/src/geometries/poly3/clone.js @@ -5,9 +5,9 @@ import { create } from './create.js' /** * Create a deep clone of the given polygon * - * @param {poly3} [out] - receiving polygon - * @param {poly3} polygon - polygon to clone - * @returns {poly3} a new polygon + * @param {Poly3} [out] - receiving polygon + * @param {Poly3} polygon - polygon to clone + * @returns {Poly3} a new polygon * @alias module:modeling/geometries/poly3.clone */ export const clone = (...params) => { diff --git a/packages/modeling/src/geometries/poly3/create.d.ts b/packages/modeling/src/geometries/poly3/create.d.ts index 022888e73..8475482f0 100644 --- a/packages/modeling/src/geometries/poly3/create.d.ts +++ b/packages/modeling/src/geometries/poly3/create.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Vec3 } from '../../maths/vec3/type' +import type { Poly3 } from './type.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export function create(vertices?: Array): Poly3 diff --git a/packages/modeling/src/geometries/poly3/create.js b/packages/modeling/src/geometries/poly3/create.js index 89a2be53c..42b892c89 100644 --- a/packages/modeling/src/geometries/poly3/create.js +++ b/packages/modeling/src/geometries/poly3/create.js @@ -2,7 +2,6 @@ * Represents a convex 3D polygon. The vertices used to initialize a polygon must * be coplanar and form a convex shape. The vertices do not have to be `vec3` * instances but they must behave similarly. - * @typedef {Object} poly3 * @property {Array} vertices - list of ordered vertices (3D) * @example * {"vertices": [[0,0,0], [4,0,0], [4,3,12]]} @@ -12,7 +11,7 @@ * Creates a new 3D polygon with initial values. * * @param {Array} [vertices] - a list of vertices (3D) - * @returns {poly3} a new polygon + * @returns {Poly3} a new polygon * @alias module:modeling/geometries/poly3.create * @example * const polygon = create([[1, 0], [0, 1], [0, 0]]) diff --git a/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.d.ts b/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.d.ts index 07974cc7b..39ef04eda 100644 --- a/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.d.ts +++ b/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.d.ts @@ -1,5 +1,5 @@ -import { Poly3 } from './type' -import { Vec3 } from '../../maths/vec3/type' -import { Plane } from '../../maths/plane/type' +import type { Vec3 } from '../../maths/vec3/type.d.ts' +import type { Plane } from '../../maths/plane/type.d.ts' +import type { Poly3 } from './type.d.ts' export function fromVerticesAndPlane(vertices: Array, plane: Plane): Poly3 diff --git a/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.js b/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.js index 9cf7b1a19..2d5e48672 100644 --- a/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.js +++ b/packages/modeling/src/geometries/poly3/fromVerticesAndPlane.js @@ -4,8 +4,8 @@ import { create } from './create.js' * Create a polygon from the given vertices and plane. * NOTE: No checks are performed on the parameters. * @param {Array} vertices - list of vertices (3D) - * @param {plane} plane - plane of the polygon - * @returns {poly3} a new polygon + * @param {Plane} plane - plane of the polygon + * @returns {Poly3} a new polygon * @alias module:modeling/geometries/poly3.fromVerticesAndPlane */ export const fromVerticesAndPlane = (vertices, plane) => { diff --git a/packages/modeling/src/geometries/poly3/index.d.ts b/packages/modeling/src/geometries/poly3/index.d.ts index da1600716..40eadbc00 100644 --- a/packages/modeling/src/geometries/poly3/index.d.ts +++ b/packages/modeling/src/geometries/poly3/index.d.ts @@ -1,17 +1,17 @@ -export { clone } from './clone' -export { create } from './create' -export { fromVerticesAndPlane } from './fromVerticesAndPlane' -export { invert } from './invert' -export { isA } from './isA' -export { isConvex } from './isConvex' -export { measureArea } from './measureArea' -export { measureBoundingBox } from './measureBoundingBox' -export { measureBoundingSphere } from './measureBoundingSphere' -export { measureSignedVolume } from './measureSignedVolume' -export { plane } from './plane' -export { toVertices } from './toVertices' -export { toString } from './toString' -export { transform } from './transform' -export { validate } from './validate' +export { clone } from './clone.js' +export { create } from './create.js' +export { fromVerticesAndPlane } from './fromVerticesAndPlane.js' +export { invert } from './invert.js' +export { isA } from './isA.js' +export { isConvex } from './isConvex.js' +export { measureArea } from './measureArea.js' +export { measureBoundingBox } from './measureBoundingBox.js' +export { measureBoundingSphere } from './measureBoundingSphere.js' +export { measureSignedVolume } from './measureSignedVolume.js' +export { plane } from './plane.js' +export { toVertices } from './toVertices.js' +export { toString } from './toString.js' +export { transform } from './transform.js' +export { validate } from './validate.js' -export { Poly3 } from './type' +export type { Poly3 } from './type.d.ts' diff --git a/packages/modeling/src/geometries/poly3/invert.d.ts b/packages/modeling/src/geometries/poly3/invert.d.ts index f96dd20e3..5bebc1e04 100644 --- a/packages/modeling/src/geometries/poly3/invert.d.ts +++ b/packages/modeling/src/geometries/poly3/invert.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function invert(polygon: Poly3): Poly3 diff --git a/packages/modeling/src/geometries/poly3/invert.js b/packages/modeling/src/geometries/poly3/invert.js index 535e4e3b5..609ec40ec 100644 --- a/packages/modeling/src/geometries/poly3/invert.js +++ b/packages/modeling/src/geometries/poly3/invert.js @@ -5,8 +5,8 @@ import { create } from './create.js' /** * Invert the give polygon to face the opposite direction. * - * @param {poly3} polygon - the polygon to invert - * @returns {poly3} a new poly3 + * @param {Poly3} polygon - the polygon to invert + * @returns {Poly3} a new poly3 * @alias module:modeling/geometries/poly3.invert */ export const invert = (polygon) => { diff --git a/packages/modeling/src/geometries/poly3/isA.d.ts b/packages/modeling/src/geometries/poly3/isA.d.ts index ad8ec2ac3..7b86a085b 100644 --- a/packages/modeling/src/geometries/poly3/isA.d.ts +++ b/packages/modeling/src/geometries/poly3/isA.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function isA(object: any): object is Poly3 diff --git a/packages/modeling/src/geometries/poly3/isA.js b/packages/modeling/src/geometries/poly3/isA.js index 2f42f9737..2dbbef03b 100644 --- a/packages/modeling/src/geometries/poly3/isA.js +++ b/packages/modeling/src/geometries/poly3/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a polygon. - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @returns {Boolean} true if the object matches a poly3 * @alias module:modeling/geometries/poly3.isA */ diff --git a/packages/modeling/src/geometries/poly3/isConvex.d.ts b/packages/modeling/src/geometries/poly3/isConvex.d.ts index cabb18eb0..b3f65e7ad 100644 --- a/packages/modeling/src/geometries/poly3/isConvex.d.ts +++ b/packages/modeling/src/geometries/poly3/isConvex.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function isConvex(polygon: Poly3): boolean diff --git a/packages/modeling/src/geometries/poly3/isConvex.js b/packages/modeling/src/geometries/poly3/isConvex.js index 62053c08f..6e1a08184 100644 --- a/packages/modeling/src/geometries/poly3/isConvex.js +++ b/packages/modeling/src/geometries/poly3/isConvex.js @@ -3,7 +3,7 @@ import * as vec3 from '../../maths/vec3/index.js' /** * Check whether the given polygon is convex. - * @param {poly3} polygon - the polygon to interrogate + * @param {Poly3} polygon - the polygon to interrogate * @returns {Boolean} true if convex * @alias module:modeling/geometries/poly3.isConvex */ diff --git a/packages/modeling/src/geometries/poly3/measureArea.d.ts b/packages/modeling/src/geometries/poly3/measureArea.d.ts index 3722eba3e..a779d9557 100644 --- a/packages/modeling/src/geometries/poly3/measureArea.d.ts +++ b/packages/modeling/src/geometries/poly3/measureArea.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function measureArea(polygon: Poly3): number diff --git a/packages/modeling/src/geometries/poly3/measureArea.js b/packages/modeling/src/geometries/poly3/measureArea.js index bc1b37d12..c61bdd748 100644 --- a/packages/modeling/src/geometries/poly3/measureArea.js +++ b/packages/modeling/src/geometries/poly3/measureArea.js @@ -3,8 +3,8 @@ import { plane } from './plane.js' /** * Measure the area of the given polygon. * @see 2000 softSurfer http://geomalgorithms.com - * @param {poly3} polygon - the polygon to measure - * @return {Number} area of the polygon + * @param {Poly3} polygon - the polygon to measure + * @return {number} area of the polygon * @alias module:modeling/geometries/poly3.measureArea */ export const measureArea = (polygon) => { diff --git a/packages/modeling/src/geometries/poly3/measureBoundingBox.d.ts b/packages/modeling/src/geometries/poly3/measureBoundingBox.d.ts index 07e35df2f..9ce4da39b 100644 --- a/packages/modeling/src/geometries/poly3/measureBoundingBox.d.ts +++ b/packages/modeling/src/geometries/poly3/measureBoundingBox.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Vec3 } from '../../maths/vec3/type' +import type { Poly3 } from './type.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export function measureBoundingBox(polygon: Poly3): [Vec3, Vec3] diff --git a/packages/modeling/src/geometries/poly3/measureBoundingBox.js b/packages/modeling/src/geometries/poly3/measureBoundingBox.js index a5662f143..3ba3c1293 100644 --- a/packages/modeling/src/geometries/poly3/measureBoundingBox.js +++ b/packages/modeling/src/geometries/poly3/measureBoundingBox.js @@ -1,7 +1,7 @@ import * as vec3 from '../../maths/vec3/index.js' /** - * @param {poly3} polygon - the polygon to measure + * @param {Poly3} polygon - the polygon to measure * @returns {Array} an array of two vectors (3D); minimum and maximum coordinates * @alias module:modeling/geometries/poly3.measureBoundingBox */ diff --git a/packages/modeling/src/geometries/poly3/measureBoundingSphere.d.ts b/packages/modeling/src/geometries/poly3/measureBoundingSphere.d.ts index 7f4692ac0..80a085b28 100644 --- a/packages/modeling/src/geometries/poly3/measureBoundingSphere.d.ts +++ b/packages/modeling/src/geometries/poly3/measureBoundingSphere.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Vec4 } from '../../maths/vec4/type' +import type { Poly3 } from './type.d.ts' +import type { Vec4 } from '../../maths/vec4/type.d.ts' export function measureBoundingSphere(polygon: Poly3): Vec4 diff --git a/packages/modeling/src/geometries/poly3/measureBoundingSphere.js b/packages/modeling/src/geometries/poly3/measureBoundingSphere.js index a4ec9822b..e73a503e7 100644 --- a/packages/modeling/src/geometries/poly3/measureBoundingSphere.js +++ b/packages/modeling/src/geometries/poly3/measureBoundingSphere.js @@ -4,8 +4,8 @@ const cache = new WeakMap() /** * Measure the bounding sphere of the given polygon. - * @param {poly3} polygon - the polygon to measure - * @returns {vec4} the computed bounding sphere; center vertex (3D) and radius + * @param {Poly3} polygon - the polygon to measure + * @returns {Vec4} the computed bounding sphere; center vertex (3D) and radius * @alias module:modeling/geometries/poly3.measureBoundingSphere */ export const measureBoundingSphere = (polygon) => { diff --git a/packages/modeling/src/geometries/poly3/measureSignedVolume.d.ts b/packages/modeling/src/geometries/poly3/measureSignedVolume.d.ts index 858ca9b41..061027b80 100644 --- a/packages/modeling/src/geometries/poly3/measureSignedVolume.d.ts +++ b/packages/modeling/src/geometries/poly3/measureSignedVolume.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function measureSignedVolume(polygon: Poly3): number diff --git a/packages/modeling/src/geometries/poly3/measureSignedVolume.js b/packages/modeling/src/geometries/poly3/measureSignedVolume.js index f6a1ab692..7f4131bab 100644 --- a/packages/modeling/src/geometries/poly3/measureSignedVolume.js +++ b/packages/modeling/src/geometries/poly3/measureSignedVolume.js @@ -5,8 +5,8 @@ import * as vec3 from '../../maths/vec3/index.js' * The volume is that formed by the tetrahedron connected to the axis [0,0,0], * and will be positive or negative based on the rotation of the vertices. * @see http://chenlab.ece.cornell.edu/Publication/Cha/icip01_Cha.pdf - * @param {poly3} polygon - the polygon to measure - * @return {Number} volume of the polygon + * @param {Poly3} polygon - the polygon to measure + * @return {number} volume of the polygon * @alias module:modeling/geometries/poly3.measureSignedVolume */ export const measureSignedVolume = (polygon) => { diff --git a/packages/modeling/src/geometries/poly3/plane.d.ts b/packages/modeling/src/geometries/poly3/plane.d.ts index 3f7ed3c58..de7503731 100644 --- a/packages/modeling/src/geometries/poly3/plane.d.ts +++ b/packages/modeling/src/geometries/poly3/plane.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Plane } from '../../maths/plane/type' +import type { Plane } from '../../maths/plane/type.d.ts' +import type { Poly3 } from './type.d.ts' export function plane(polygon: Poly3): Plane; diff --git a/packages/modeling/src/geometries/poly3/toString.d.ts b/packages/modeling/src/geometries/poly3/toString.d.ts index 84f01dfc0..918fc9b15 100644 --- a/packages/modeling/src/geometries/poly3/toString.d.ts +++ b/packages/modeling/src/geometries/poly3/toString.d.ts @@ -1,3 +1,3 @@ -import { Poly3 } from './type' +import type { Poly3 } from './type.d.ts' export function toString(polygon: Poly3): string diff --git a/packages/modeling/src/geometries/poly3/toString.js b/packages/modeling/src/geometries/poly3/toString.js index 2d8d51f6c..b3310a626 100644 --- a/packages/modeling/src/geometries/poly3/toString.js +++ b/packages/modeling/src/geometries/poly3/toString.js @@ -2,7 +2,7 @@ import * as vec3 from '../../maths/vec3/index.js' /** * Convert the given polygon to a readable string. - * @param {poly3} polygon - the polygon to convert + * @param {Poly3} polygon - the polygon to convert * @return {String} the string representation * @alias module:modeling/geometries/poly3.toString */ diff --git a/packages/modeling/src/geometries/poly3/toVertices.d.ts b/packages/modeling/src/geometries/poly3/toVertices.d.ts index 7a5530d7f..280df48ce 100644 --- a/packages/modeling/src/geometries/poly3/toVertices.d.ts +++ b/packages/modeling/src/geometries/poly3/toVertices.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Vec3 } from '../../maths/vec3/type' +import type { Poly3 } from './type.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export function toVertices(polygon: Poly3): Array diff --git a/packages/modeling/src/geometries/poly3/toVertices.js b/packages/modeling/src/geometries/poly3/toVertices.js index f5919dfc7..f7bab9901 100644 --- a/packages/modeling/src/geometries/poly3/toVertices.js +++ b/packages/modeling/src/geometries/poly3/toVertices.js @@ -1,7 +1,7 @@ /** * Return the given polygon as a list of vertices. * NOTE: The returned array should not be modified as the vertices are shared with the geometry. - * @param {poly3} polygon - the polygon + * @param {Poly3} polygon - the polygon * @return {Array} list of vertices (3D) * @alias module:modeling/geometries/poly3.toVertices */ diff --git a/packages/modeling/src/geometries/poly3/transform.d.ts b/packages/modeling/src/geometries/poly3/transform.d.ts index 12d67eaa0..56dab913f 100644 --- a/packages/modeling/src/geometries/poly3/transform.d.ts +++ b/packages/modeling/src/geometries/poly3/transform.d.ts @@ -1,4 +1,4 @@ -import { Poly3 } from './type' -import { Mat4 } from '../../maths/mat4/type' +import type { Poly3 } from './type.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' export function transform(matrix: Mat4, polygon: Poly3): Poly3 diff --git a/packages/modeling/src/geometries/poly3/transform.js b/packages/modeling/src/geometries/poly3/transform.js index 9c39f86bf..258e42436 100644 --- a/packages/modeling/src/geometries/poly3/transform.js +++ b/packages/modeling/src/geometries/poly3/transform.js @@ -5,9 +5,9 @@ import { create } from './create.js' /** * Transform the given polygon using the given matrix. - * @param {mat4} matrix - the matrix to transform with - * @param {poly3} polygon - the polygon to transform - * @returns {poly3} a new polygon + * @param {Mat4} matrix - the matrix to transform with + * @param {Poly3} polygon - the polygon to transform + * @returns {Poly3} a new polygon * @alias module:modeling/geometries/poly3.transform */ export const transform = (matrix, polygon) => { diff --git a/packages/modeling/src/geometries/poly3/type.d.ts b/packages/modeling/src/geometries/poly3/type.d.ts index c55d49539..2e0c15a09 100644 --- a/packages/modeling/src/geometries/poly3/type.d.ts +++ b/packages/modeling/src/geometries/poly3/type.d.ts @@ -1,7 +1,10 @@ -import { Vec3 } from '../../maths/vec3/type' -import { Color } from '../types' +import type { Vec3 } from '../../maths/vec3/type.d.ts' +import type { Color } from '../types.d.ts' export interface Poly3 { vertices: Array color?: Color + + // used internally for caching: + plane?: Plane } diff --git a/packages/modeling/src/geometries/poly3/validate.js b/packages/modeling/src/geometries/poly3/validate.js index 79af66e06..3007b0753 100644 --- a/packages/modeling/src/geometries/poly3/validate.js +++ b/packages/modeling/src/geometries/poly3/validate.js @@ -13,7 +13,7 @@ import { plane } from './plane.js' * * **If the geometry is not valid, an exception will be thrown with details of the geometry error.** * - * @param {Object} object - the object to interrogate + * @param {object} object - the object to interrogate * @throws {Error} error if the geometry is not valid * @alias module:modeling/geometries/poly3.validate */ diff --git a/packages/modeling/src/geometries/slice/calculatePlane.d.ts b/packages/modeling/src/geometries/slice/calculatePlane.d.ts index 364b7af79..b9fd2a9f9 100644 --- a/packages/modeling/src/geometries/slice/calculatePlane.d.ts +++ b/packages/modeling/src/geometries/slice/calculatePlane.d.ts @@ -1,5 +1,5 @@ -import { Plane } from '../../maths/plane/type' +import type { Plane } from '../../maths/plane/type.d.ts' -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function calculatePlane(slice: Slice): Plane diff --git a/packages/modeling/src/geometries/slice/calculatePlane.js b/packages/modeling/src/geometries/slice/calculatePlane.js index b4e8c0d29..1ea5d80de 100644 --- a/packages/modeling/src/geometries/slice/calculatePlane.js +++ b/packages/modeling/src/geometries/slice/calculatePlane.js @@ -4,15 +4,17 @@ import * as vec3 from '../../maths/vec3/index.js' /** * Calculate the plane of the given slice. * NOTE: The slice (and all vertices) are assumed to be planar from the beginning. - * @param {slice} slice - the slice - * @returns {plane} the plane of the slice + * @param {Slice} slice - the slice + * @returns {Plane} the plane of the slice * @alias module:modeling/geometries/slice.calculatePlane * * @example * let myPlane = calculatePlane(slice) */ export const calculatePlane = (slice) => { - if (slice.contours < 1) throw new Error('slices must have at least one contour to calculate a plane') + if (slice.contours.length < 1) { + throw new Error('slices must have at least one contour to calculate a plane') + } // find the middle of the slice, which will lie on the plane by definition const middle = vec3.create() @@ -26,7 +28,7 @@ export const calculatePlane = (slice) => { vec3.scale(middle, middle, 1 / n) // find the farthest edge from the middle, which will be on an outside edge - let farthestContour + let farthestContour = [] let farthestBefore let farthestVertex let distance = 0 diff --git a/packages/modeling/src/geometries/slice/clone.d.ts b/packages/modeling/src/geometries/slice/clone.d.ts index 84ed07456..8e3e9df8e 100644 --- a/packages/modeling/src/geometries/slice/clone.d.ts +++ b/packages/modeling/src/geometries/slice/clone.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function clone(slice: Slice): Slice diff --git a/packages/modeling/src/geometries/slice/clone.js b/packages/modeling/src/geometries/slice/clone.js index cb94fc2a5..cf7abd490 100644 --- a/packages/modeling/src/geometries/slice/clone.js +++ b/packages/modeling/src/geometries/slice/clone.js @@ -2,8 +2,8 @@ /** * Create a deep clone of the given slice. * - * @param {slice} slice - slice to clone - * @returns {slice} a new slice + * @param {Slice} slice - slice to clone + * @returns {Slice} a new slice * @alias module:modeling/geometries/slice.clone */ export const clone = (slice) => Object.assign({}, slice) diff --git a/packages/modeling/src/geometries/slice/create.d.ts b/packages/modeling/src/geometries/slice/create.d.ts index 5be151131..a02b2c2ab 100644 --- a/packages/modeling/src/geometries/slice/create.d.ts +++ b/packages/modeling/src/geometries/slice/create.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from '../../maths/types' -import { Slice } from './type' +import type { Vec3 } from '../../maths/types.d.ts' +import type { Slice } from './type.d.ts' export function create(contours?: Array>): Slice diff --git a/packages/modeling/src/geometries/slice/create.js b/packages/modeling/src/geometries/slice/create.js index 4a4f99d5c..c0ad1a081 100644 --- a/packages/modeling/src/geometries/slice/create.js +++ b/packages/modeling/src/geometries/slice/create.js @@ -1,7 +1,6 @@ /** * Represents a 3D geometry consisting of a list of contours, * where each contour consists of a list of planar vertices. - * @typedef {Object} slice * @property {Array} contours - list of contours, each contour containing a list of 3D vertices * @example * {"contours": [[[0,0,1], [4,0,1], [4,3,1]]]} @@ -11,7 +10,7 @@ * Creates a new slice from the given contours. * * @param {Array} [contours] - a list of contours, where each contour contains a list of vertices (3D) - * @returns {slice} a new slice + * @returns {Slice} a new slice * @alias module:modeling/geometries/slice.create * @example * const slice = create([ [[0,0,1], [4,0,1], [4,3,1]] ]) diff --git a/packages/modeling/src/geometries/slice/earcut/assignHoles.js b/packages/modeling/src/geometries/slice/earcut/assignHoles.js index e19cb6581..696351b8f 100644 --- a/packages/modeling/src/geometries/slice/earcut/assignHoles.js +++ b/packages/modeling/src/geometries/slice/earcut/assignHoles.js @@ -7,7 +7,7 @@ import * as poly2 from '../../poly2/index.js' * The hierarchy is represented as a forest of trees. All trees shall be depth at most 2. * If a solid exists inside the hole of another solid, it will be split out as its own root. * - * @param {geom2} geometry + * @param {Geom2} geometry * @returns {Array} an array of polygons with associated holes * @alias module:modeling/geometries/geom2.toTree * diff --git a/packages/modeling/src/geometries/slice/equals.d.ts b/packages/modeling/src/geometries/slice/equals.d.ts index 75ea9f97c..5ffea5f4a 100644 --- a/packages/modeling/src/geometries/slice/equals.d.ts +++ b/packages/modeling/src/geometries/slice/equals.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function equals(a: Slice, b: Slice): boolean diff --git a/packages/modeling/src/geometries/slice/equals.js b/packages/modeling/src/geometries/slice/equals.js index f80980b01..b88aae491 100644 --- a/packages/modeling/src/geometries/slice/equals.js +++ b/packages/modeling/src/geometries/slice/equals.js @@ -2,8 +2,8 @@ import * as vec3 from '../../maths/vec3/index.js' /** * Determine if the given slices have the same contours. - * @param {slice} a - the first slice to compare - * @param {slice} b - the second slice to compare + * @param {Slice} a - the first slice to compare + * @param {Slice} b - the second slice to compare * @returns {Boolean} true if the slices are equal * @alias module:modeling/geometries/slice.equals */ diff --git a/packages/modeling/src/geometries/slice/fromGeom2.d.ts b/packages/modeling/src/geometries/slice/fromGeom2.d.ts index 78690ab9d..0dafa7dc9 100644 --- a/packages/modeling/src/geometries/slice/fromGeom2.d.ts +++ b/packages/modeling/src/geometries/slice/fromGeom2.d.ts @@ -1,5 +1,5 @@ -import { Geom2 } from '../geom2/type' +import type { Geom2 } from '../geom2/type.d.ts' -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function fromGeom2(geometry: Geom2): Slice diff --git a/packages/modeling/src/geometries/slice/fromGeom2.js b/packages/modeling/src/geometries/slice/fromGeom2.js index 963166746..058bebccf 100644 --- a/packages/modeling/src/geometries/slice/fromGeom2.js +++ b/packages/modeling/src/geometries/slice/fromGeom2.js @@ -6,8 +6,8 @@ import { create } from './create.js' /** * Create a slice from a geom2. * - * @param {Object} geometry - the 2D geometry to create a slice from - * @returns {slice} a new slice + * @param {object} geometry - the 2D geometry to create a slice from + * @returns {Slice} a new slice * @alias module:modeling/geometries/slice.fromGeom2 */ export const fromGeom2 = (geometry) => { diff --git a/packages/modeling/src/geometries/slice/fromVertices.d.ts b/packages/modeling/src/geometries/slice/fromVertices.d.ts index eef8dd8fb..8676bb3d8 100644 --- a/packages/modeling/src/geometries/slice/fromVertices.d.ts +++ b/packages/modeling/src/geometries/slice/fromVertices.d.ts @@ -1,6 +1,6 @@ -import { Vec2, Vec3 } from '../../maths/types' +import type { Vec2, Vec3 } from '../../maths/types.d.ts' -import { Slice } from './type' +import type { Slice } from './type.d.ts' type Vertex = Vec2 | Vec3 diff --git a/packages/modeling/src/geometries/slice/fromVertices.js b/packages/modeling/src/geometries/slice/fromVertices.js index b5593885a..dc0554c81 100644 --- a/packages/modeling/src/geometries/slice/fromVertices.js +++ b/packages/modeling/src/geometries/slice/fromVertices.js @@ -6,7 +6,7 @@ import { create } from './create.js' * Create a slice from the given vertices. * * @param {Array} vertices - list of vertices, where each vertex is either 2D or 3D - * @returns {slice} a new slice + * @returns {Slice} a new slice * @alias module:modeling/geometries/slice.fromVertices * * @example diff --git a/packages/modeling/src/geometries/slice/index.d.ts b/packages/modeling/src/geometries/slice/index.d.ts index 357c18115..9005492b0 100644 --- a/packages/modeling/src/geometries/slice/index.d.ts +++ b/packages/modeling/src/geometries/slice/index.d.ts @@ -1,15 +1,15 @@ -export { calculatePlane } from './calculatePlane' -export { clone } from './clone' -export { create } from './create' -export { equals } from './equals' -export { fromGeom2 } from './fromGeom2' -export { fromVertices } from './fromVertices' -export { isA } from './isA' -export { reverse } from './reverse' -export { toEdges } from './toEdges' -export { toVertices } from './toVertices' -export { toPolygons } from './toPolygons' -export { toString } from './toString' -export { transform } from './transform' +export { calculatePlane } from './calculatePlane.js' +export { clone } from './clone.js' +export { create } from './create.js' +export { equals } from './equals.js' +export { fromGeom2 } from './fromGeom2.js' +export { fromVertices } from './fromVertices.js' +export { isA } from './isA.js' +export { reverse } from './reverse.js' +export { toEdges } from './toEdges.js' +export { toVertices } from './toVertices.js' +export { toPolygons } from './toPolygons.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Slice } from './type' +export type { Slice } from './type.d.ts' diff --git a/packages/modeling/src/geometries/slice/isA.d.ts b/packages/modeling/src/geometries/slice/isA.d.ts index 65e65bf97..e202c21f1 100644 --- a/packages/modeling/src/geometries/slice/isA.d.ts +++ b/packages/modeling/src/geometries/slice/isA.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function isA(object: any): object is Slice diff --git a/packages/modeling/src/geometries/slice/isA.js b/packages/modeling/src/geometries/slice/isA.js index c7cb72139..6fb5372b2 100644 --- a/packages/modeling/src/geometries/slice/isA.js +++ b/packages/modeling/src/geometries/slice/isA.js @@ -1,6 +1,6 @@ /** * Determine if the given object is a slice. - * @param {slice} object - the object to interrogate + * @param {Slice} object - the object to interrogate * @returns {Boolean} true if the object matches a slice * @alias module:modeling/geometries/slice.isA */ diff --git a/packages/modeling/src/geometries/slice/reverse.d.ts b/packages/modeling/src/geometries/slice/reverse.d.ts index ff97df57e..a6620c502 100644 --- a/packages/modeling/src/geometries/slice/reverse.d.ts +++ b/packages/modeling/src/geometries/slice/reverse.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function reverse(slice: Slice): Slice diff --git a/packages/modeling/src/geometries/slice/reverse.js b/packages/modeling/src/geometries/slice/reverse.js index 712b2f67b..f3fb9025f 100644 --- a/packages/modeling/src/geometries/slice/reverse.js +++ b/packages/modeling/src/geometries/slice/reverse.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Reverse the edges of the given slice. * - * @param {slice} slice - slice to reverse - * @returns {slice} reverse of the slice + * @param {Slice} slice - slice to reverse + * @returns {Slice} reverse of the slice * @alias module:modeling/geometries/slice.reverse */ export const reverse = (slice) => { diff --git a/packages/modeling/src/geometries/slice/toEdges.d.ts b/packages/modeling/src/geometries/slice/toEdges.d.ts index 2443727ae..6315ea262 100644 --- a/packages/modeling/src/geometries/slice/toEdges.d.ts +++ b/packages/modeling/src/geometries/slice/toEdges.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function toEdges(slice: Slice): Slice['contours'] diff --git a/packages/modeling/src/geometries/slice/toEdges.js b/packages/modeling/src/geometries/slice/toEdges.js index 29a4a37e8..331873203 100644 --- a/packages/modeling/src/geometries/slice/toEdges.js +++ b/packages/modeling/src/geometries/slice/toEdges.js @@ -1,7 +1,7 @@ /** * Produces an array of edges from the given slice. * The returned array should not be modified as the data is shared with the slice. - * @param {slice} slice - the slice + * @param {Slice} slice - the slice * @returns {Array} an array of edges, each edge contains an array of two vertices (3D) * @alias module:modeling/geometries/slice.toEdges * diff --git a/packages/modeling/src/geometries/slice/toPolygons.d.ts b/packages/modeling/src/geometries/slice/toPolygons.d.ts index 9f2123142..c0fa6df59 100644 --- a/packages/modeling/src/geometries/slice/toPolygons.d.ts +++ b/packages/modeling/src/geometries/slice/toPolygons.d.ts @@ -1,5 +1,5 @@ -import { Poly3 } from '../poly3/type' +import type { Poly3 } from '../poly3/type.d.ts' -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function toPolygons(slice: Slice): Array diff --git a/packages/modeling/src/geometries/slice/toPolygons.js b/packages/modeling/src/geometries/slice/toPolygons.js index 799f231b6..8f63bb262 100644 --- a/packages/modeling/src/geometries/slice/toPolygons.js +++ b/packages/modeling/src/geometries/slice/toPolygons.js @@ -5,7 +5,7 @@ import { PolygonHierarchy } from './earcut/polygonHierarchy.js' /** * Return a list of polygons which are enclosed by the slice. - * @param {slice} slice - the slice + * @param {Slice} slice - the slice * @return {Array} a list of polygons (3D) * @alias module:modeling/geometries/slice.toPolygons */ diff --git a/packages/modeling/src/geometries/slice/toString.d.ts b/packages/modeling/src/geometries/slice/toString.d.ts index fb2ff5bc4..57bf4128e 100644 --- a/packages/modeling/src/geometries/slice/toString.d.ts +++ b/packages/modeling/src/geometries/slice/toString.d.ts @@ -1,3 +1,3 @@ -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function toString(slice: Slice): string diff --git a/packages/modeling/src/geometries/slice/toString.js b/packages/modeling/src/geometries/slice/toString.js index 8cb61a315..6e8c81cbf 100644 --- a/packages/modeling/src/geometries/slice/toString.js +++ b/packages/modeling/src/geometries/slice/toString.js @@ -2,7 +2,7 @@ import * as vec3 from '../../maths/vec3/index.js' /** * Convert the given slice to a readable string. - * @param {slice} slice - the slice + * @param {Slice} slice - the slice * @return {String} the string representation * @alias module:modeling/geometries/slice.toString */ diff --git a/packages/modeling/src/geometries/slice/toVertices.d.ts b/packages/modeling/src/geometries/slice/toVertices.d.ts index 71372853d..9b80b3464 100644 --- a/packages/modeling/src/geometries/slice/toVertices.d.ts +++ b/packages/modeling/src/geometries/slice/toVertices.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from '../../maths/types' -import { Slice } from './type' +import type { Vec3 } from '../../maths/types.d.ts' +import type { Slice } from './type.d.ts' export function toVertices(slice: Slice): Array diff --git a/packages/modeling/src/geometries/slice/toVertices.js b/packages/modeling/src/geometries/slice/toVertices.js index 12a7ad0a7..bddbe66e1 100644 --- a/packages/modeling/src/geometries/slice/toVertices.js +++ b/packages/modeling/src/geometries/slice/toVertices.js @@ -1,7 +1,7 @@ /** * Produces an array of vertices from the given slice. * The returned array should not be modified as the data is shared with the slice. - * @param {slice} slice - the slice + * @param {Slice} slice - the slice * @returns {Array} an array of 3D vertices * @alias module:modeling/geometries/slice.toVertices * diff --git a/packages/modeling/src/geometries/slice/transform.d.ts b/packages/modeling/src/geometries/slice/transform.d.ts index 9a4c5228e..016250586 100644 --- a/packages/modeling/src/geometries/slice/transform.d.ts +++ b/packages/modeling/src/geometries/slice/transform.d.ts @@ -1,5 +1,5 @@ -import { Mat4 } from '../../maths/mat4/type' +import type { Mat4 } from '../../maths/mat4/type.d.ts' -import { Slice } from './type' +import type { Slice } from './type.d.ts' export function transform(matrix: Mat4, slice: Slice): Slice diff --git a/packages/modeling/src/geometries/slice/transform.js b/packages/modeling/src/geometries/slice/transform.js index eb039e80d..28649d96e 100644 --- a/packages/modeling/src/geometries/slice/transform.js +++ b/packages/modeling/src/geometries/slice/transform.js @@ -4,9 +4,9 @@ import { create } from './create.js' /** * Transform the given slice using the given matrix. - * @param {mat4} matrix - transform matrix - * @param {slice} slice - slice to transform - * @returns {slice} the transformed slice + * @param {Mat4} matrix - transform matrix + * @param {Slice} slice - slice to transform + * @returns {Slice} the transformed slice * @alias module:modeling/geometries/slice.transform * * @example diff --git a/packages/modeling/src/geometries/slice/type.d.ts b/packages/modeling/src/geometries/slice/type.d.ts index 274db6342..730a2f1bb 100644 --- a/packages/modeling/src/geometries/slice/type.d.ts +++ b/packages/modeling/src/geometries/slice/type.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from '../../maths/vec3/type' +import type { Vec3 } from '../../maths/vec3/type.d.ts' export interface Slice { contours: Array> diff --git a/packages/modeling/src/geometries/types.d.ts b/packages/modeling/src/geometries/types.d.ts index e919a70ee..77f18e471 100644 --- a/packages/modeling/src/geometries/types.d.ts +++ b/packages/modeling/src/geometries/types.d.ts @@ -1,9 +1,9 @@ -import { Geom2 } from './geom2/type' -import { Geom3 } from './geom3/type' -import { Path2 } from './path2/type' -import { Poly3 } from './poly3/type' -import { Slice } from './slice/type' -import { RGB, RGBA } from '../colors' +import type { Geom2 } from './geom2/type.d.ts' +import type { Geom3 } from './geom3/type.d.ts' +import type { Path2 } from './path2/type.d.ts' +import type { Poly3 } from './poly3/type.d.ts' +import type { Slice } from './slice/type.d.ts' +import type { RGB, RGBA } from '../colors/index.d.ts' // NOTE (@ahdinosaur): Poly2 is not included as not well-supported. // see https://github.com/jscad/OpenJSCAD.org/pull/726#issuecomment-724575265 @@ -15,9 +15,9 @@ export interface Colored { color: Color } -export { Geom2 } from './geom2/type' -export { Geom3 } from './geom3/type' -export { Path2 } from './path2/type' -export { Poly2 } from './poly2/type' -export { Poly3 } from './poly3/type' -export { Slice } from './slice/type' +export type { Geom2 } from './geom2/type.d.ts' +export type { Geom3 } from './geom3/type.d.ts' +export type { Path2 } from './path2/type.d.ts' +export type { Poly2 } from './poly2/type.d.ts' +export type { Poly3 } from './poly3/type.d.ts' +export type { Slice } from './slice/type.d.ts' diff --git a/packages/modeling/src/index.d.ts b/packages/modeling/src/index.d.ts index 3255ec0b5..99f12e700 100644 --- a/packages/modeling/src/index.d.ts +++ b/packages/modeling/src/index.d.ts @@ -13,5 +13,3 @@ export * as hulls from './operations/hulls' export * as modifiers from './operations/modifiers' export * as offsets from './operations/offsets' export * as transforms from './operations/transforms' - -export as namespace modeling diff --git a/packages/modeling/src/maths/index.d.ts b/packages/modeling/src/maths/index.d.ts index bc2b954e4..0907afa9a 100644 --- a/packages/modeling/src/maths/index.d.ts +++ b/packages/modeling/src/maths/index.d.ts @@ -1,11 +1,9 @@ -export * as constants from './constants' -export * as line2 from './line2' -export * as line3 from './line3' -export * as mat4 from './mat4' -export * as plane from './plane' -export * as utils from './utils' -export * as vec2 from './vec2' -export * as vec3 from './vec3' -export * as vec4 from './vec4' - -export as namespace maths +export * as constants from './constants.js' +export * as line2 from './line2/index.js' +export * as line3 from './line3/index.js' +export * as mat4 from './mat4/index.js' +export * as plane from './plane/index.js' +export * as utils from './utils/index.js' +export * as vec2 from './vec2/index.js' +export * as vec3 from './vec3/index.js' +export * as vec4 from './vec4/index.js' diff --git a/packages/modeling/src/maths/line2/clone.d.ts b/packages/modeling/src/maths/line2/clone.d.ts index b30c008c4..7728e2617 100644 --- a/packages/modeling/src/maths/line2/clone.d.ts +++ b/packages/modeling/src/maths/line2/clone.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function clone(line: Line2): Line2 diff --git a/packages/modeling/src/maths/line2/clone.js b/packages/modeling/src/maths/line2/clone.js index db498e961..77a929607 100644 --- a/packages/modeling/src/maths/line2/clone.js +++ b/packages/modeling/src/maths/line2/clone.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Create a clone of the given line. * - * @param {line2} line - line to clone - * @returns {line2} a new unbounded line + * @param {Line2} line - line to clone + * @returns {Line2} a new unbounded line * @alias module:modeling/maths/line2.clone */ export const clone = (line) => { diff --git a/packages/modeling/src/maths/line2/closestPoint.d.ts b/packages/modeling/src/maths/line2/closestPoint.d.ts index 192c6cef7..a08d05fcb 100644 --- a/packages/modeling/src/maths/line2/closestPoint.d.ts +++ b/packages/modeling/src/maths/line2/closestPoint.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function closestPoint(line: Line2, point: Vec2): Vec2 diff --git a/packages/modeling/src/maths/line2/closestPoint.js b/packages/modeling/src/maths/line2/closestPoint.js index e02d75ced..b06390c7d 100644 --- a/packages/modeling/src/maths/line2/closestPoint.js +++ b/packages/modeling/src/maths/line2/closestPoint.js @@ -6,9 +6,9 @@ import { origin } from './origin.js' /** * Determine the closest point on the given line to the given point. * - * @param {line2} line - line of reference - * @param {vec2} point - point of reference - * @returns {vec2} closest point + * @param {Line2} line - line of reference + * @param {Vec2} point - point of reference + * @returns {Vec2} closest point * @alias module:modeling/maths/line2.closestPoint */ export const closestPoint = (line, point) => { diff --git a/packages/modeling/src/maths/line2/copy.d.ts b/packages/modeling/src/maths/line2/copy.d.ts index 441e0f1cb..266a67ed0 100644 --- a/packages/modeling/src/maths/line2/copy.d.ts +++ b/packages/modeling/src/maths/line2/copy.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function copy(out: Line2, line: Line2): Line2 diff --git a/packages/modeling/src/maths/line2/copy.js b/packages/modeling/src/maths/line2/copy.js index 3edfa12be..920284865 100644 --- a/packages/modeling/src/maths/line2/copy.js +++ b/packages/modeling/src/maths/line2/copy.js @@ -1,9 +1,9 @@ /** * Copy the given line to the receiving line. * - * @param {line2} out - receiving line - * @param {line2} line - line to copy - * @returns {line2} out + * @param {Line2} out - receiving line + * @param {Line2} line - line to copy + * @returns {Line2} out * @alias module:modeling/maths/line2.copy */ export const copy = (out, line) => { diff --git a/packages/modeling/src/maths/line2/create.d.ts b/packages/modeling/src/maths/line2/create.d.ts index 4974350a9..25b923696 100644 --- a/packages/modeling/src/maths/line2/create.d.ts +++ b/packages/modeling/src/maths/line2/create.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function create(): Line2 diff --git a/packages/modeling/src/maths/line2/create.js b/packages/modeling/src/maths/line2/create.js index 1d1e6b493..140a5e32d 100644 --- a/packages/modeling/src/maths/line2/create.js +++ b/packages/modeling/src/maths/line2/create.js @@ -6,13 +6,12 @@ * Equation: A Point (P) is on Line (L) if dot(L.normal, P) == L.distance * * The contents of the array are a normal [0,1] and a distance [2]. - * @typedef {Array} line2 */ /** * Create a line, positioned at 0,0, and running along the X axis. * - * @returns {line2} a new unbounded line + * @returns {Line2} a new unbounded line * @alias module:modeling/maths/line2.create */ export const create = () => [0, 1, 0] // normal and distance diff --git a/packages/modeling/src/maths/line2/direction.d.ts b/packages/modeling/src/maths/line2/direction.d.ts index 44480f1cd..f270aa314 100644 --- a/packages/modeling/src/maths/line2/direction.d.ts +++ b/packages/modeling/src/maths/line2/direction.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function direction(line: Line2): Vec2 diff --git a/packages/modeling/src/maths/line2/direction.js b/packages/modeling/src/maths/line2/direction.js index 126251179..0ba497c07 100644 --- a/packages/modeling/src/maths/line2/direction.js +++ b/packages/modeling/src/maths/line2/direction.js @@ -3,8 +3,8 @@ import * as vec2 from '../vec2/index.js' /** * Return the direction of the given line. * - * @param {line2} line - line of reference - * @return {vec2} a vector in the direction of the line + * @param {Line2} line - line of reference + * @return {Vec2} a vector in the direction of the line * @alias module:modeling/maths/line2.direction */ export const direction = (line) => { diff --git a/packages/modeling/src/maths/line2/distanceToPoint.d.ts b/packages/modeling/src/maths/line2/distanceToPoint.d.ts index 5dc836593..02fde4c3d 100644 --- a/packages/modeling/src/maths/line2/distanceToPoint.d.ts +++ b/packages/modeling/src/maths/line2/distanceToPoint.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function distanceToPoint(line: Line2, point: Vec2): number diff --git a/packages/modeling/src/maths/line2/distanceToPoint.js b/packages/modeling/src/maths/line2/distanceToPoint.js index 6e9bc6cbe..6dfcc54df 100644 --- a/packages/modeling/src/maths/line2/distanceToPoint.js +++ b/packages/modeling/src/maths/line2/distanceToPoint.js @@ -3,9 +3,9 @@ import * as vec2 from '../vec2/index.js' /** * Calculate the distance (positive) between the given point and line. * - * @param {line2} line - line of reference - * @param {vec2} point - point of reference - * @return {Number} distance between line and point + * @param {Line2} line - line of reference + * @param {Vec2} point - point of reference + * @return {number} distance between line and point * @alias module:modeling/maths/line2.distanceToPoint */ export const distanceToPoint = (line, point) => { diff --git a/packages/modeling/src/maths/line2/equals.d.ts b/packages/modeling/src/maths/line2/equals.d.ts index 204884fc9..f7c723562 100644 --- a/packages/modeling/src/maths/line2/equals.d.ts +++ b/packages/modeling/src/maths/line2/equals.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function equals(a: Line2, b: Line2): boolean diff --git a/packages/modeling/src/maths/line2/equals.js b/packages/modeling/src/maths/line2/equals.js index b45877fc0..839ffebe5 100644 --- a/packages/modeling/src/maths/line2/equals.js +++ b/packages/modeling/src/maths/line2/equals.js @@ -1,9 +1,9 @@ /** * Compare the given lines for equality. * - * @param {line2} line1 - first line to compare - * @param {line2} line2 - second line to compare - * @return {Boolean} true if lines are equal + * @param {Line2} line1 - first line to compare + * @param {Line2} line2 - second line to compare + * @return {boolean} true if lines are equal * @alias module:modeling/maths/line2.equals */ export const equals = (line1, line2) => (line1[0] === line2[0]) && (line1[1] === line2[1] && (line1[2] === line2[2])) diff --git a/packages/modeling/src/maths/line2/fromPoints.d.ts b/packages/modeling/src/maths/line2/fromPoints.d.ts index 2496f3ed3..6c3fe7138 100644 --- a/packages/modeling/src/maths/line2/fromPoints.d.ts +++ b/packages/modeling/src/maths/line2/fromPoints.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function fromPoints(out: Line2, point1: Vec2, point2: Vec2): Line2 diff --git a/packages/modeling/src/maths/line2/fromPoints.js b/packages/modeling/src/maths/line2/fromPoints.js index b243edb08..eb20bd930 100644 --- a/packages/modeling/src/maths/line2/fromPoints.js +++ b/packages/modeling/src/maths/line2/fromPoints.js @@ -3,10 +3,10 @@ import * as vec2 from '../vec2/index.js' /** * Create a new line that passes through the given points. * - * @param {line2} out - receiving line - * @param {vec2} point1 - start point of the line - * @param {vec2} point2 - end point of the line - * @returns {line2} a new unbounded line + * @param {Line2} out - receiving line + * @param {Vec2} point1 - start point of the line + * @param {Vec2} point2 - end point of the line + * @returns {Line2} a new unbounded line * @alias module:modeling/maths/line2.fromPoints */ export const fromPoints = (out, point1, point2) => { diff --git a/packages/modeling/src/maths/line2/fromValues.d.ts b/packages/modeling/src/maths/line2/fromValues.d.ts index c49e8cbb5..6df18ada1 100644 --- a/packages/modeling/src/maths/line2/fromValues.d.ts +++ b/packages/modeling/src/maths/line2/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function fromValues(x: number, y: number, d: number): Line2 diff --git a/packages/modeling/src/maths/line2/fromValues.js b/packages/modeling/src/maths/line2/fromValues.js index 65d5443dc..91851dc0a 100644 --- a/packages/modeling/src/maths/line2/fromValues.js +++ b/packages/modeling/src/maths/line2/fromValues.js @@ -3,10 +3,10 @@ import { create } from './create.js' /** * Creates a new line initialized with the given values. * - * @param {Number} x - X coordinate of the unit normal - * @param {Number} y - Y coordinate of the unit normal - * @param {Number} d - distance of the line from [0,0] - * @returns {line2} a new unbounded line + * @param {number} x - X coordinate of the unit normal + * @param {number} y - Y coordinate of the unit normal + * @param {number} d - distance of the line from [0,0] + * @returns {Line2} a new unbounded line * @alias module:modeling/maths/line2.fromValues */ export const fromValues = (x, y, d) => { diff --git a/packages/modeling/src/maths/line2/index.d.ts b/packages/modeling/src/maths/line2/index.d.ts index e3377912f..da40fe069 100644 --- a/packages/modeling/src/maths/line2/index.d.ts +++ b/packages/modeling/src/maths/line2/index.d.ts @@ -1,18 +1,17 @@ -export { clone } from './clone' -export { closestPoint } from './closestPoint' -export { copy } from './copy' -export { create } from './create' -export { direction } from './direction' -export { distanceToPoint } from './distanceToPoint' -export { equals } from './equals' -export { fromPoints } from './fromPoints' -export { fromValues } from './fromValues' -export { intersectPointOfLines } from './intersectPointOfLines' -export { origin } from './origin' -export { reverse } from './reverse' -export { toString } from './toString' -export { transform } from './transform' -export { xAtY } from './xAtY' +export { clone } from './clone.js' +export { closestPoint } from './closestPoint.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { direction } from './direction.js' +export { distanceToPoint } from './distanceToPoint.js' +export { equals } from './equals.js' +export { fromPoints } from './fromPoints.js' +export { fromValues } from './fromValues.js' +export { intersectPointOfLines } from './intersectPointOfLines.js' +export { origin } from './origin.js' +export { reverse } from './reverse.js' +export { toString } from './toString.js' +export { transform } from './transform.js' +export { xAtY } from './xAtY.js' -export { Line2 } from './type' -export as namespace line2 +export type { Line2 } from './type.d.ts' diff --git a/packages/modeling/src/maths/line2/intersectPointOfLines.d.ts b/packages/modeling/src/maths/line2/intersectPointOfLines.d.ts index a7292680b..3c729b815 100644 --- a/packages/modeling/src/maths/line2/intersectPointOfLines.d.ts +++ b/packages/modeling/src/maths/line2/intersectPointOfLines.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function intersectPointOfLines(a: Line2, b: Line2): Vec2 diff --git a/packages/modeling/src/maths/line2/intersectPointOfLines.js b/packages/modeling/src/maths/line2/intersectPointOfLines.js index 4037e5970..802717180 100644 --- a/packages/modeling/src/maths/line2/intersectPointOfLines.js +++ b/packages/modeling/src/maths/line2/intersectPointOfLines.js @@ -9,9 +9,9 @@ import { solve2Linear } from '../utils/index.js' * The point will have Infinity values if the lines are parallel. * The point will have NaN values if the lines are the same. * - * @param {line2} line1 - line of reference - * @param {line2} line2 - line of reference - * @return {vec2} the point of intersection + * @param {Line2} line1 - line of reference + * @param {Line2} line2 - line of reference + * @return {Vec2} the point of intersection * @alias module:modeling/maths/line2.intersectPointOfLines */ export const intersectPointOfLines = (line1, line2) => { diff --git a/packages/modeling/src/maths/line2/origin.d.ts b/packages/modeling/src/maths/line2/origin.d.ts index 06d069d56..be995fb79 100644 --- a/packages/modeling/src/maths/line2/origin.d.ts +++ b/packages/modeling/src/maths/line2/origin.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Vec2 } from '../vec2/type' +import type { Line2 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function origin(line: Line2): Vec2 diff --git a/packages/modeling/src/maths/line2/origin.js b/packages/modeling/src/maths/line2/origin.js index 77b75383e..7276f27af 100644 --- a/packages/modeling/src/maths/line2/origin.js +++ b/packages/modeling/src/maths/line2/origin.js @@ -4,8 +4,8 @@ import * as vec2 from '../vec2/index.js' * Return the origin of the given line. * The origin is the point on the line which is closest to the origin [0, 0]. * - * @param {line2} line - line of reference - * @return {vec2} the origin of the line + * @param {Line2} line - line of reference + * @return {Vec2} the origin of the line * @alias module:modeling/maths/line2.origin */ export const origin = (line) => vec2.scale(vec2.create(), line, line[2]) diff --git a/packages/modeling/src/maths/line2/reverse.d.ts b/packages/modeling/src/maths/line2/reverse.d.ts index d21ccfe33..95679165d 100644 --- a/packages/modeling/src/maths/line2/reverse.d.ts +++ b/packages/modeling/src/maths/line2/reverse.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function reverse(out: Line2, line: Line2): Line2 diff --git a/packages/modeling/src/maths/line2/reverse.js b/packages/modeling/src/maths/line2/reverse.js index d9397b3e2..28f7fa20a 100644 --- a/packages/modeling/src/maths/line2/reverse.js +++ b/packages/modeling/src/maths/line2/reverse.js @@ -6,9 +6,9 @@ import { fromValues } from './fromValues.js' /** * Create a new line in the opposite direction as the given. * - * @param {line2} out - receiving line - * @param {line2} line - line to reverse - * @returns {line2} out + * @param {Line2} out - receiving line + * @param {Line2} line - line to reverse + * @returns {Line2} out * @alias module:modeling/maths/line2.reverse */ export const reverse = (out, line) => { diff --git a/packages/modeling/src/maths/line2/toString.d.ts b/packages/modeling/src/maths/line2/toString.d.ts index cfa85e4ce..db5778317 100644 --- a/packages/modeling/src/maths/line2/toString.d.ts +++ b/packages/modeling/src/maths/line2/toString.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function toString(line: Line2): string diff --git a/packages/modeling/src/maths/line2/toString.js b/packages/modeling/src/maths/line2/toString.js index eb3b1e1ea..ed564dbb2 100644 --- a/packages/modeling/src/maths/line2/toString.js +++ b/packages/modeling/src/maths/line2/toString.js @@ -1,8 +1,8 @@ /** * Return a string representing the given line. * - * @param {line2} line - line of reference - * @returns {String} string representation + * @param {Line2} line - line of reference + * @returns {string} string representation * @alias module:modeling/maths/line2.toString */ export const toString = (line) => `line2: (${line[0].toFixed(7)}, ${line[1].toFixed(7)}, ${line[2].toFixed(7)})` diff --git a/packages/modeling/src/maths/line2/transform.d.ts b/packages/modeling/src/maths/line2/transform.d.ts index cd505d462..49a5c82c4 100644 --- a/packages/modeling/src/maths/line2/transform.d.ts +++ b/packages/modeling/src/maths/line2/transform.d.ts @@ -1,4 +1,4 @@ -import { Line2 } from './type' -import { Mat4 } from '../mat4/type' +import type { Line2 } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Line2, line: Line2, matrix: Mat4): Line2 diff --git a/packages/modeling/src/maths/line2/transform.js b/packages/modeling/src/maths/line2/transform.js index bf4765b60..4a46b5600 100644 --- a/packages/modeling/src/maths/line2/transform.js +++ b/packages/modeling/src/maths/line2/transform.js @@ -7,10 +7,10 @@ import { direction } from './direction.js' /** * Transforms the given line using the given matrix. * - * @param {line2} out - receiving line - * @param {line2} line - line to transform - * @param {mat4} matrix - matrix to transform with - * @returns {line2} out + * @param {Line2} out - receiving line + * @param {Line2} line - line to transform + * @param {Mat4} matrix - matrix to transform with + * @returns {Line2} out * @alias module:modeling/maths/line2.transform */ export const transform = (out, line, matrix) => { diff --git a/packages/modeling/src/maths/line2/xAtY.d.ts b/packages/modeling/src/maths/line2/xAtY.d.ts index 14196b2bc..0b08d4fb7 100644 --- a/packages/modeling/src/maths/line2/xAtY.d.ts +++ b/packages/modeling/src/maths/line2/xAtY.d.ts @@ -1,3 +1,3 @@ -import { Line2 } from './type' +import type { Line2 } from './type.d.ts' export function xAtY(line: Line2, y: number): number diff --git a/packages/modeling/src/maths/line2/xAtY.js b/packages/modeling/src/maths/line2/xAtY.js index 910c5e7d5..c23bba286 100644 --- a/packages/modeling/src/maths/line2/xAtY.js +++ b/packages/modeling/src/maths/line2/xAtY.js @@ -5,9 +5,9 @@ import { origin } from './origin.js' * * The X coordinate will be Infinity if the line is parallel to the X axis. * - * @param {line2} line - line of reference - * @param {Number} y - Y coordinate on the line - * @return {Number} the X coordinate on the line + * @param {Line2} line - line of reference + * @param {number} y - Y coordinate on the line + * @return {number} the X coordinate on the line * @alias module:modeling/maths/line2.xAtY */ export const xAtY = (line, y) => { diff --git a/packages/modeling/src/maths/line3/clone.d.ts b/packages/modeling/src/maths/line3/clone.d.ts index b024be56f..be165eb05 100644 --- a/packages/modeling/src/maths/line3/clone.d.ts +++ b/packages/modeling/src/maths/line3/clone.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function clone(line: Line3): Line3 diff --git a/packages/modeling/src/maths/line3/clone.js b/packages/modeling/src/maths/line3/clone.js index bce908425..8748b5496 100644 --- a/packages/modeling/src/maths/line3/clone.js +++ b/packages/modeling/src/maths/line3/clone.js @@ -5,8 +5,8 @@ import { create } from './create.js' /** * Create a clone of the given line. * - * @param {line3} line - line to clone - * @returns {line3} a new unbounded line + * @param {Line3} line - line to clone + * @returns {Line3} a new unbounded line * @alias module:modeling/maths/line3.clone */ export const clone = (line) => { diff --git a/packages/modeling/src/maths/line3/closestPoint.d.ts b/packages/modeling/src/maths/line3/closestPoint.d.ts index f24bc9b33..6c8aff2ad 100644 --- a/packages/modeling/src/maths/line3/closestPoint.d.ts +++ b/packages/modeling/src/maths/line3/closestPoint.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function closestPoint(line: Line3, point: Vec3): Vec3 diff --git a/packages/modeling/src/maths/line3/closestPoint.js b/packages/modeling/src/maths/line3/closestPoint.js index af402dc74..3f8a4b4f0 100644 --- a/packages/modeling/src/maths/line3/closestPoint.js +++ b/packages/modeling/src/maths/line3/closestPoint.js @@ -3,9 +3,9 @@ import * as vec3 from '../vec3/index.js' /** * Determine the closest point on the given line to the given point. * - * @param {line3} line - line of reference - * @param {vec3} point - point of reference - * @returns {vec3} a point + * @param {Line3} line - line of reference + * @param {Vec3} point - point of reference + * @returns {Vec3} a point * @alias module:modeling/maths/line3.closestPoint */ export const closestPoint = (line, point) => { diff --git a/packages/modeling/src/maths/line3/copy.d.ts b/packages/modeling/src/maths/line3/copy.d.ts index a95ec8a8b..fa1bc5a57 100644 --- a/packages/modeling/src/maths/line3/copy.d.ts +++ b/packages/modeling/src/maths/line3/copy.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function copy(out: Line3, line: Line3): Line3 diff --git a/packages/modeling/src/maths/line3/copy.js b/packages/modeling/src/maths/line3/copy.js index d20aeb768..b204b02b8 100644 --- a/packages/modeling/src/maths/line3/copy.js +++ b/packages/modeling/src/maths/line3/copy.js @@ -3,9 +3,9 @@ import * as vec3 from '../vec3/index.js' /** * Copy the given line into the receiving line. * - * @param {line3} out - receiving line - * @param {line3} line - line to copy - * @returns {line3} out + * @param {Line3} out - receiving line + * @param {Line3} line - line to copy + * @returns {Line3} out * @alias module:modeling/maths/line3.copy */ export const copy = (out, line) => { diff --git a/packages/modeling/src/maths/line3/create.d.ts b/packages/modeling/src/maths/line3/create.d.ts index 3e6c9b9d7..88401e1aa 100644 --- a/packages/modeling/src/maths/line3/create.d.ts +++ b/packages/modeling/src/maths/line3/create.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function create(): Line3 diff --git a/packages/modeling/src/maths/line3/create.js b/packages/modeling/src/maths/line3/create.js index 16dc8ba8b..9ee60d4c0 100644 --- a/packages/modeling/src/maths/line3/create.js +++ b/packages/modeling/src/maths/line3/create.js @@ -6,13 +6,12 @@ import * as vec3 from '../vec3/index.js' * * The array contents are two 3D vectors; origin [0,0,0] and directional vector [0,0,1]. * @see https://en.wikipedia.org/wiki/Hesse_normal_form - * @typedef {Array} line3 */ /** * Create a line, positioned at 0,0,0 and lying on the X axis. * - * @returns {line3} a new unbounded line + * @returns {Line3} a new unbounded line * @alias module:modeling/maths/line3.create */ export const create = () => [ diff --git a/packages/modeling/src/maths/line3/direction.d.ts b/packages/modeling/src/maths/line3/direction.d.ts index d73b08384..f27c1dc00 100644 --- a/packages/modeling/src/maths/line3/direction.d.ts +++ b/packages/modeling/src/maths/line3/direction.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function direction(line: Line3): Vec3 diff --git a/packages/modeling/src/maths/line3/direction.js b/packages/modeling/src/maths/line3/direction.js index 902fd8c65..b68df1475 100644 --- a/packages/modeling/src/maths/line3/direction.js +++ b/packages/modeling/src/maths/line3/direction.js @@ -1,8 +1,8 @@ /** * Return the direction of the given line. * - * @param {line3} line - line for reference - * @return {vec3} the relative vector in the direction of the line + * @param {Line3} line - line for reference + * @return {Vec3} the relative vector in the direction of the line * @alias module:modeling/maths/line3.direction */ export const direction = (line) => line[1] diff --git a/packages/modeling/src/maths/line3/distanceToPoint.d.ts b/packages/modeling/src/maths/line3/distanceToPoint.d.ts index d8a7fee5e..597a2f821 100644 --- a/packages/modeling/src/maths/line3/distanceToPoint.d.ts +++ b/packages/modeling/src/maths/line3/distanceToPoint.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function distanceToPoint(line: Line3, point: Vec3): number diff --git a/packages/modeling/src/maths/line3/distanceToPoint.js b/packages/modeling/src/maths/line3/distanceToPoint.js index 2ca58e4fc..9a07712bc 100644 --- a/packages/modeling/src/maths/line3/distanceToPoint.js +++ b/packages/modeling/src/maths/line3/distanceToPoint.js @@ -5,9 +5,9 @@ import { closestPoint } from './closestPoint.js' /** * Calculate the distance (positive) between the given point and line. * - * @param {line3} line - line of reference - * @param {vec3} point - point of reference - * @return {Number} distance between line and point + * @param {Line3} line - line of reference + * @param {Vec3} point - point of reference + * @return {number} distance between line and point * @alias module:modeling/maths/line3.distanceToPoint */ export const distanceToPoint = (line, point) => { diff --git a/packages/modeling/src/maths/line3/equals.d.ts b/packages/modeling/src/maths/line3/equals.d.ts index dbee0e1b0..d66bd295d 100644 --- a/packages/modeling/src/maths/line3/equals.d.ts +++ b/packages/modeling/src/maths/line3/equals.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function equals(a: Line3, b: Line3): boolean diff --git a/packages/modeling/src/maths/line3/equals.js b/packages/modeling/src/maths/line3/equals.js index 49f510270..766a17783 100644 --- a/packages/modeling/src/maths/line3/equals.js +++ b/packages/modeling/src/maths/line3/equals.js @@ -3,8 +3,8 @@ import * as vec3 from '../vec3/index.js' /** * Compare the given lines for equality. * - * @param {line3} line1 - first line to compare - * @param {line3} line2 - second line to compare + * @param {Line3} line1 - first line to compare + * @param {Line3} line2 - second line to compare * @return {Boolean} true if lines are equal * @alias module:modeling/maths/line3.equals */ diff --git a/packages/modeling/src/maths/line3/fromPlanes.d.ts b/packages/modeling/src/maths/line3/fromPlanes.d.ts index 533babab0..babbeb0b6 100644 --- a/packages/modeling/src/maths/line3/fromPlanes.d.ts +++ b/packages/modeling/src/maths/line3/fromPlanes.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Plane } from '../plane/type' +import type { Line3 } from './type.d.ts' +import type { Plane } from '../plane/type.d.ts' export function fromPlanes(out: Line3, a: Plane, b: Plane): Line3 diff --git a/packages/modeling/src/maths/line3/fromPlanes.js b/packages/modeling/src/maths/line3/fromPlanes.js index 561bb2917..64314c62d 100644 --- a/packages/modeling/src/maths/line3/fromPlanes.js +++ b/packages/modeling/src/maths/line3/fromPlanes.js @@ -7,10 +7,10 @@ import { fromPointAndDirection } from './fromPointAndDirection.js' /** * Create a line the intersection of the given planes. * - * @param {line3} out - receiving line - * @param {plane} plane1 - first plane of reference - * @param {plane} plane2 - second plane of reference - * @returns {line3} out + * @param {Line3} out - receiving line + * @param {Plane} plane1 - first plane of reference + * @param {Plane} plane2 - second plane of reference + * @returns {Line3} out * @alias module:modeling/maths/line3.fromPlanes */ export const fromPlanes = (out, plane1, plane2) => { diff --git a/packages/modeling/src/maths/line3/fromPointAndDirection.d.ts b/packages/modeling/src/maths/line3/fromPointAndDirection.d.ts index 577ce6950..575506ef4 100644 --- a/packages/modeling/src/maths/line3/fromPointAndDirection.d.ts +++ b/packages/modeling/src/maths/line3/fromPointAndDirection.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromPointAndDirection(out: Line3, point: Vec3, direction: Vec3): Line3 diff --git a/packages/modeling/src/maths/line3/fromPointAndDirection.js b/packages/modeling/src/maths/line3/fromPointAndDirection.js index 1e38e8111..273a40168 100644 --- a/packages/modeling/src/maths/line3/fromPointAndDirection.js +++ b/packages/modeling/src/maths/line3/fromPointAndDirection.js @@ -8,10 +8,10 @@ import * as vec3 from '../vec3/index.js' * * See the logic of fromPoints() for appropriate values. * - * @param {line3} out - receiving line - * @param {vec3} point - start point of the line segment - * @param {vec3} direction - direction of the line segment - * @returns {line3} out + * @param {Line3} out - receiving line + * @param {Vec3} point - start point of the line segment + * @param {Vec3} direction - direction of the line segment + * @returns {Line3} out * @alias module:modeling/maths/line3.fromPointAndDirection */ export const fromPointAndDirection = (out, point, direction) => { diff --git a/packages/modeling/src/maths/line3/fromPoints.d.ts b/packages/modeling/src/maths/line3/fromPoints.d.ts index 20c0ae21d..3a17eb0bc 100644 --- a/packages/modeling/src/maths/line3/fromPoints.d.ts +++ b/packages/modeling/src/maths/line3/fromPoints.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromPoints(out: Line3, point1: Vec3, point2: Vec3): Line3 diff --git a/packages/modeling/src/maths/line3/fromPoints.js b/packages/modeling/src/maths/line3/fromPoints.js index ce4875899..e01753640 100644 --- a/packages/modeling/src/maths/line3/fromPoints.js +++ b/packages/modeling/src/maths/line3/fromPoints.js @@ -5,10 +5,10 @@ import { fromPointAndDirection } from './fromPointAndDirection.js' /** * Create a line that passes through the given points. * - * @param {line3} out - receiving line - * @param {vec3} point1 - start point of the line segment - * @param {vec3} point2 - end point of the line segment - * @returns {line3} out + * @param {Line3} out - receiving line + * @param {Vec3} point1 - start point of the line segment + * @param {Vec3} point2 - end point of the line segment + * @returns {Line3} out * @alias module:modeling/maths/line3.fromPoints */ export const fromPoints = (out, point1, point2) => { diff --git a/packages/modeling/src/maths/line3/index.d.ts b/packages/modeling/src/maths/line3/index.d.ts index e0a086cd1..36e36dc0f 100644 --- a/packages/modeling/src/maths/line3/index.d.ts +++ b/packages/modeling/src/maths/line3/index.d.ts @@ -1,18 +1,17 @@ -export { clone } from './clone' -export { closestPoint } from './closestPoint' -export { copy } from './copy' -export { create } from './create' -export { direction } from './direction' -export { distanceToPoint } from './distanceToPoint' -export { equals } from './equals' -export { fromPlanes } from './fromPlanes' -export { fromPointAndDirection } from './fromPointAndDirection' -export { fromPoints } from './fromPoints' -export { intersectPointOfLineAndPlane } from './intersectPointOfLineAndPlane' -export { origin } from './origin' -export { reverse } from './reverse' -export { toString } from './toString' -export { transform } from './transform' +export { clone } from './clone.js' +export { closestPoint } from './closestPoint.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { direction } from './direction.js' +export { distanceToPoint } from './distanceToPoint.js' +export { equals } from './equals.js' +export { fromPlanes } from './fromPlanes.js' +export { fromPointAndDirection } from './fromPointAndDirection.js' +export { fromPoints } from './fromPoints.js' +export { intersectPointOfLineAndPlane } from './intersectPointOfLineAndPlane.js' +export { origin } from './origin.js' +export { reverse } from './reverse.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Line3 } from './type' -export as namespace line3 +export type { Line3 } from './type.d.ts' diff --git a/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.d.ts b/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.d.ts index ca60a3321..55534588d 100644 --- a/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.d.ts +++ b/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.d.ts @@ -1,5 +1,5 @@ -import { Line3 } from './type' -import { Plane } from '../plane/type' -import { Vec3 } from '../vec3/type' +import type { Plane } from '../plane/type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' +import type { Line3 } from './type.d.ts' export function intersectPointOfLineAndPlane(line: Line3, plane: Plane): Vec3 diff --git a/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.js b/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.js index f7eb6826b..7e69145a6 100644 --- a/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.js +++ b/packages/modeling/src/maths/line3/intersectPointOfLineAndPlane.js @@ -6,9 +6,9 @@ import * as vec3 from '../vec3/index.js' * NOTES: * The point of intersection will be invalid if the line is parallel to the plane, e.g. NaN. * - * @param {line3} line - line of reference - * @param {plane} plane - plane of reference - * @returns {vec3} a point on the line + * @param {Line3} line - line of reference + * @param {Plane} plane - plane of reference + * @returns {Vec3} a point on the line * @alias module:modeling/maths/line3.intersectPointOfLineAndPlane */ export const intersectPointOfLineAndPlane = (line, plane) => { diff --git a/packages/modeling/src/maths/line3/origin.d.ts b/packages/modeling/src/maths/line3/origin.d.ts index 474a97782..e8ffdd5c9 100644 --- a/packages/modeling/src/maths/line3/origin.d.ts +++ b/packages/modeling/src/maths/line3/origin.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Vec3 } from '../vec3/type' +import type { Line3 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function origin(line: Line3): Vec3 diff --git a/packages/modeling/src/maths/line3/origin.js b/packages/modeling/src/maths/line3/origin.js index f42a2c2ea..d0ca6f321 100644 --- a/packages/modeling/src/maths/line3/origin.js +++ b/packages/modeling/src/maths/line3/origin.js @@ -1,8 +1,8 @@ /** * Return the origin of the given line. * - * @param {line3} line - line of reference - * @return {vec3} the origin of the line + * @param {Line3} line - line of reference + * @return {Vec3} the origin of the line * @alias module:modeling/maths/line3.origin */ export const origin = (line) => line[0] diff --git a/packages/modeling/src/maths/line3/reverse.d.ts b/packages/modeling/src/maths/line3/reverse.d.ts index 1164ecb78..b35252166 100644 --- a/packages/modeling/src/maths/line3/reverse.d.ts +++ b/packages/modeling/src/maths/line3/reverse.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function reverse(out: Line3, line: Line3): Line3 diff --git a/packages/modeling/src/maths/line3/reverse.js b/packages/modeling/src/maths/line3/reverse.js index 7fe4b6cef..00ddba7c1 100644 --- a/packages/modeling/src/maths/line3/reverse.js +++ b/packages/modeling/src/maths/line3/reverse.js @@ -5,9 +5,9 @@ import { fromPointAndDirection } from './fromPointAndDirection.js' /** * Create a line in the opposite direction as the given. * - * @param {line3} out - receiving line - * @param {line3} line - line to reverse - * @returns {line3} out + * @param {Line3} out - receiving line + * @param {Line3} line - line to reverse + * @returns {Line3} out * @alias module:modeling/maths/line3.reverse */ export const reverse = (out, line) => { diff --git a/packages/modeling/src/maths/line3/toString.d.ts b/packages/modeling/src/maths/line3/toString.d.ts index 628093328..b47228d32 100644 --- a/packages/modeling/src/maths/line3/toString.d.ts +++ b/packages/modeling/src/maths/line3/toString.d.ts @@ -1,3 +1,3 @@ -import { Line3 } from './type' +import type { Line3 } from './type.d.ts' export function toString(line: Line3): string diff --git a/packages/modeling/src/maths/line3/toString.js b/packages/modeling/src/maths/line3/toString.js index c6160261b..d52d95827 100644 --- a/packages/modeling/src/maths/line3/toString.js +++ b/packages/modeling/src/maths/line3/toString.js @@ -1,8 +1,8 @@ /** * Return a string representing the given line. * - * @param {line3} line - line of reference - * @returns {String} string representation + * @param {Line3} line - line of reference + * @returns {string} string representation * @alias module:modeling/maths/line3.toString */ export const toString = (line) => { diff --git a/packages/modeling/src/maths/line3/transform.d.ts b/packages/modeling/src/maths/line3/transform.d.ts index 88141562e..7b69b277c 100644 --- a/packages/modeling/src/maths/line3/transform.d.ts +++ b/packages/modeling/src/maths/line3/transform.d.ts @@ -1,4 +1,4 @@ -import { Line3 } from './type' -import { Mat4 } from '../mat4/type' +import type { Line3 } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Line3, line: Line3, matrix: Mat4): Line3 diff --git a/packages/modeling/src/maths/line3/transform.js b/packages/modeling/src/maths/line3/transform.js index 4f06ef02b..11d57fbd2 100644 --- a/packages/modeling/src/maths/line3/transform.js +++ b/packages/modeling/src/maths/line3/transform.js @@ -5,10 +5,10 @@ import { fromPointAndDirection } from './fromPointAndDirection.js' /** * Transforms the given line using the given matrix. * - * @param {line3} out - line to update - * @param {line3} line - line to transform - * @param {mat4} matrix - matrix to transform with - * @returns {line3} a new unbounded line + * @param {Line3} out - line to update + * @param {Line3} line - line to transform + * @param {Mat4} matrix - matrix to transform with + * @returns {Line3} a new unbounded line * @alias module:modeling/maths/line3.transform */ export const transform = (out, line, matrix) => { diff --git a/packages/modeling/src/maths/line3/type.d.ts b/packages/modeling/src/maths/line3/type.d.ts index 3b0772259..09ec3e592 100644 --- a/packages/modeling/src/maths/line3/type.d.ts +++ b/packages/modeling/src/maths/line3/type.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from '../vec3/type' +import type { Vec3 } from '../vec3/type.d.ts' export type Line3 = [Vec3, Vec3] diff --git a/packages/modeling/src/maths/mat4/add.d.ts b/packages/modeling/src/maths/mat4/add.d.ts index 09d83c90f..2f890a553 100644 --- a/packages/modeling/src/maths/mat4/add.d.ts +++ b/packages/modeling/src/maths/mat4/add.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function add(out: Mat4, a: Mat4, b: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/add.js b/packages/modeling/src/maths/mat4/add.js index dd293135a..0fc4818d0 100644 --- a/packages/modeling/src/maths/mat4/add.js +++ b/packages/modeling/src/maths/mat4/add.js @@ -1,10 +1,10 @@ /** * Adds the two matrices (A+B). * - * @param {mat4} out - receiving matrix - * @param {mat4} a - first operand - * @param {mat4} b - second operand - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} a - first operand + * @param {Mat4} b - second operand + * @returns {Mat4} out * @alias module:modeling/maths/mat4.add */ export const add = (out, a, b) => { diff --git a/packages/modeling/src/maths/mat4/clone.d.ts b/packages/modeling/src/maths/mat4/clone.d.ts index 327205aa9..fb3fc9159 100644 --- a/packages/modeling/src/maths/mat4/clone.d.ts +++ b/packages/modeling/src/maths/mat4/clone.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function clone(matrix: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/clone.js b/packages/modeling/src/maths/mat4/clone.js index 7c2502888..cf1bccf5e 100644 --- a/packages/modeling/src/maths/mat4/clone.js +++ b/packages/modeling/src/maths/mat4/clone.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Creates a clone of the given matrix. * - * @param {mat4} matrix - matrix to clone - * @returns {mat4} a new matrix + * @param {Mat4} matrix - matrix to clone + * @returns {Mat4} a new matrix * @alias module:modeling/maths/mat4.clone */ export const clone = (matrix) => { diff --git a/packages/modeling/src/maths/mat4/copy.d.ts b/packages/modeling/src/maths/mat4/copy.d.ts index e998aa894..7356864ba 100644 --- a/packages/modeling/src/maths/mat4/copy.d.ts +++ b/packages/modeling/src/maths/mat4/copy.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function copy(out: Mat4, matrix: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/copy.js b/packages/modeling/src/maths/mat4/copy.js index 9cf8d7a07..3301cb27d 100644 --- a/packages/modeling/src/maths/mat4/copy.js +++ b/packages/modeling/src/maths/mat4/copy.js @@ -1,9 +1,9 @@ /** * Creates a copy of the given matrix. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to copy - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to copy + * @returns {Mat4} out * @alias module:modeling/maths/mat4.copy */ export const copy = (out, matrix) => { diff --git a/packages/modeling/src/maths/mat4/create.d.ts b/packages/modeling/src/maths/mat4/create.d.ts index dff67f801..202c9103b 100644 --- a/packages/modeling/src/maths/mat4/create.d.ts +++ b/packages/modeling/src/maths/mat4/create.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function create(): Mat4 diff --git a/packages/modeling/src/maths/mat4/create.js b/packages/modeling/src/maths/mat4/create.js index c80fbf067..5996a148b 100644 --- a/packages/modeling/src/maths/mat4/create.js +++ b/packages/modeling/src/maths/mat4/create.js @@ -1,13 +1,12 @@ /** * Represents a 4x4 matrix which is column-major (when typed out it looks row-major). * See fromValues(). - * @typedef {Array} mat4 */ /** * Creates a new identity matrix. * - * @returns {mat4} a new matrix + * @returns {Mat4} a new matrix * @alias module:modeling/maths/mat4.create */ export const create = () => [ diff --git a/packages/modeling/src/maths/mat4/equals.d.ts b/packages/modeling/src/maths/mat4/equals.d.ts index abad4fe6d..65548158b 100644 --- a/packages/modeling/src/maths/mat4/equals.d.ts +++ b/packages/modeling/src/maths/mat4/equals.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function equals(a: Mat4, b: Mat4): boolean diff --git a/packages/modeling/src/maths/mat4/equals.js b/packages/modeling/src/maths/mat4/equals.js index 05351883d..ee468cd3b 100644 --- a/packages/modeling/src/maths/mat4/equals.js +++ b/packages/modeling/src/maths/mat4/equals.js @@ -1,8 +1,8 @@ /** * Returns whether the matrices have exactly the same elements in the same position. * - * @param {mat4} a - first matrix - * @param {mat4} b - second matrix + * @param {Mat4} a - first matrix + * @param {Mat4} b - second matrix * @returns {Boolean} true if the matrices are equal * @alias module:modeling/maths/mat4.equals */ diff --git a/packages/modeling/src/maths/mat4/fromRotation.d.ts b/packages/modeling/src/maths/mat4/fromRotation.d.ts index e378e036b..a2d771198 100644 --- a/packages/modeling/src/maths/mat4/fromRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromRotation.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromRotation(out: Mat4, rad: number, axis: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromRotation.js b/packages/modeling/src/maths/mat4/fromRotation.js index 75ac3fdbc..6ea6a9b36 100644 --- a/packages/modeling/src/maths/mat4/fromRotation.js +++ b/packages/modeling/src/maths/mat4/fromRotation.js @@ -11,10 +11,10 @@ import { identity } from './identity.js' * mat4.identity(dest) * mat4.rotate(dest, dest, rad, axis) * - * @param {mat4} out - receiving matrix - * @param {Number} rad - angle to rotate the matrix by - * @param {vec3} axis - axis of which to rotate around - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {number} rad - angle to rotate the matrix by + * @param {Vec3} axis - axis of which to rotate around + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromRotation * @example * let matrix = fromRotation(create(), TAU / 4, [0, 0, 3]) diff --git a/packages/modeling/src/maths/mat4/fromScaling.d.ts b/packages/modeling/src/maths/mat4/fromScaling.d.ts index 506773756..8ae94f9fa 100644 --- a/packages/modeling/src/maths/mat4/fromScaling.d.ts +++ b/packages/modeling/src/maths/mat4/fromScaling.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromScaling(out: Mat4, vector: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromScaling.js b/packages/modeling/src/maths/mat4/fromScaling.js index 489b6a6e3..46b4b8059 100644 --- a/packages/modeling/src/maths/mat4/fromScaling.js +++ b/packages/modeling/src/maths/mat4/fromScaling.js @@ -5,9 +5,9 @@ * mat4.identity(dest) * mat4.scale(dest, dest, vec) * - * @param {mat4} out - receiving matrix - * @param {vec3} vector - X, Y, Z factors by which to scale - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Vec3} vector - X, Y, Z factors by which to scale + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromScaling * @example * let matrix = fromScaling([1, 2, 0.5]) diff --git a/packages/modeling/src/maths/mat4/fromTaitBryanRotation.d.ts b/packages/modeling/src/maths/mat4/fromTaitBryanRotation.d.ts index 877e23c0c..2550a5a77 100644 --- a/packages/modeling/src/maths/mat4/fromTaitBryanRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromTaitBryanRotation.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function fromTaitBryanRotation(out: Mat4, yaw: number, pitch: number, roll: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromTaitBryanRotation.js b/packages/modeling/src/maths/mat4/fromTaitBryanRotation.js index 68f0d56f7..e64b3afab 100644 --- a/packages/modeling/src/maths/mat4/fromTaitBryanRotation.js +++ b/packages/modeling/src/maths/mat4/fromTaitBryanRotation.js @@ -6,11 +6,11 @@ import { sin, cos } from '../utils/trigonometry.js' * Tait-Bryan Euler angle convention using active, intrinsic rotations around the axes in the order z-y-x. * @see https://en.wikipedia.org/wiki/Euler_angles * - * @param {mat4} out - receiving matrix - * @param {Number} yaw - Z rotation in radians - * @param {Number} pitch - Y rotation in radians - * @param {Number} roll - X rotation in radians - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {number} yaw - Z rotation in radians + * @param {number} pitch - Y rotation in radians + * @param {number} roll - X rotation in radians + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromTaitBryanRotation * @example * let matrix = fromTaitBryanRotation(create(), TAU / 4, 0, TAU / 2) diff --git a/packages/modeling/src/maths/mat4/fromTranslation.d.ts b/packages/modeling/src/maths/mat4/fromTranslation.d.ts index 09484031a..12c5b3954 100644 --- a/packages/modeling/src/maths/mat4/fromTranslation.d.ts +++ b/packages/modeling/src/maths/mat4/fromTranslation.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromTranslation(out: Mat4, vector: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromTranslation.js b/packages/modeling/src/maths/mat4/fromTranslation.js index bccd57305..939706d2b 100644 --- a/packages/modeling/src/maths/mat4/fromTranslation.js +++ b/packages/modeling/src/maths/mat4/fromTranslation.js @@ -5,9 +5,9 @@ * mat4.identity(dest) * mat4.translate(dest, dest, vec) * - * @param {mat4} out - receiving matrix - * @param {vec3} vector - offset (vector) of translation - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Vec3} vector - offset (vector) of translation + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromTranslation * @example * let matrix = fromTranslation(create(), [1, 2, 3]) diff --git a/packages/modeling/src/maths/mat4/fromValues.d.ts b/packages/modeling/src/maths/mat4/fromValues.d.ts index 2ec76d860..186a58028 100644 --- a/packages/modeling/src/maths/mat4/fromValues.d.ts +++ b/packages/modeling/src/maths/mat4/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromValues.js b/packages/modeling/src/maths/mat4/fromValues.js index 100fd379c..ead00d3e5 100644 --- a/packages/modeling/src/maths/mat4/fromValues.js +++ b/packages/modeling/src/maths/mat4/fromValues.js @@ -3,23 +3,23 @@ import { create } from './create.js' /** * Create a matrix with the given values. * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} a new matrix + * @param {number} m00 Component in column 0, row 0 position (index 0) + * @param {number} m01 Component in column 0, row 1 position (index 1) + * @param {number} m02 Component in column 0, row 2 position (index 2) + * @param {number} m03 Component in column 0, row 3 position (index 3) + * @param {number} m10 Component in column 1, row 0 position (index 4) + * @param {number} m11 Component in column 1, row 1 position (index 5) + * @param {number} m12 Component in column 1, row 2 position (index 6) + * @param {number} m13 Component in column 1, row 3 position (index 7) + * @param {number} m20 Component in column 2, row 0 position (index 8) + * @param {number} m21 Component in column 2, row 1 position (index 9) + * @param {number} m22 Component in column 2, row 2 position (index 10) + * @param {number} m23 Component in column 2, row 3 position (index 11) + * @param {number} m30 Component in column 3, row 0 position (index 12) + * @param {number} m31 Component in column 3, row 1 position (index 13) + * @param {number} m32 Component in column 3, row 2 position (index 14) + * @param {number} m33 Component in column 3, row 3 position (index 15) + * @returns {Mat4} a new matrix * @alias module:modeling/maths/mat4.fromValues * @example * let matrix = fromValues( diff --git a/packages/modeling/src/maths/mat4/fromVectorRotation.d.ts b/packages/modeling/src/maths/mat4/fromVectorRotation.d.ts index 1fd663199..db483b714 100644 --- a/packages/modeling/src/maths/mat4/fromVectorRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromVectorRotation.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromVectorRotation(out: Mat4, source: Vec3, target: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromVectorRotation.js b/packages/modeling/src/maths/mat4/fromVectorRotation.js index ce34a30b3..cb1b0218d 100644 --- a/packages/modeling/src/maths/mat4/fromVectorRotation.js +++ b/packages/modeling/src/maths/mat4/fromVectorRotation.js @@ -7,10 +7,10 @@ import { fromRotation } from './fromRotation.js' * * Each vector must be a directional vector with a length greater than zero. * @see https://gist.github.com/kevinmoran/b45980723e53edeb8a5a43c49f134724 - * @param {mat4} out - receiving matrix - * @param {vec3} source - source vector - * @param {vec3} target - target vector - * @returns {mat4} a new matrix + * @param {Mat4} out - receiving matrix + * @param {Vec3} source - source vector + * @param {Vec3} target - target vector + * @returns {Mat4} a new matrix * @alias module:modeling/maths/mat4.fromVectorRotation * @example * let matrix = fromVectorRotation(create(), [1, 2, 2], [-3, 3, 12]) diff --git a/packages/modeling/src/maths/mat4/fromXRotation.d.ts b/packages/modeling/src/maths/mat4/fromXRotation.d.ts index 4d0c77fee..917103673 100644 --- a/packages/modeling/src/maths/mat4/fromXRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromXRotation.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function fromXRotation(out: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromXRotation.js b/packages/modeling/src/maths/mat4/fromXRotation.js index 38c69d65b..74a7f8980 100644 --- a/packages/modeling/src/maths/mat4/fromXRotation.js +++ b/packages/modeling/src/maths/mat4/fromXRotation.js @@ -7,9 +7,9 @@ import { sin, cos } from '../utils/trigonometry.js' * mat4.identity(dest) * mat4.rotateX(dest, dest, radians) * - * @param {mat4} out - receiving matrix - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromXRotation * @example * let matrix = fromXRotation(create(), TAU / 4) diff --git a/packages/modeling/src/maths/mat4/fromYRotation.d.ts b/packages/modeling/src/maths/mat4/fromYRotation.d.ts index d3ea1d85b..818d611f3 100644 --- a/packages/modeling/src/maths/mat4/fromYRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromYRotation.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function fromYRotation(out: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromYRotation.js b/packages/modeling/src/maths/mat4/fromYRotation.js index ebb9c3a09..3c392da0b 100644 --- a/packages/modeling/src/maths/mat4/fromYRotation.js +++ b/packages/modeling/src/maths/mat4/fromYRotation.js @@ -7,9 +7,9 @@ import { sin, cos } from '../utils/trigonometry.js' * mat4.identity(dest) * mat4.rotateY(dest, dest, radians) * - * @param {mat4} out - receiving matrix - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromYRotation * @example * let matrix = fromYRotation(create(), TAU / 4) diff --git a/packages/modeling/src/maths/mat4/fromZRotation.d.ts b/packages/modeling/src/maths/mat4/fromZRotation.d.ts index a3f92007f..64136b27d 100644 --- a/packages/modeling/src/maths/mat4/fromZRotation.d.ts +++ b/packages/modeling/src/maths/mat4/fromZRotation.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function fromZRotation(out: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/fromZRotation.js b/packages/modeling/src/maths/mat4/fromZRotation.js index bf943bc74..87f80ee50 100644 --- a/packages/modeling/src/maths/mat4/fromZRotation.js +++ b/packages/modeling/src/maths/mat4/fromZRotation.js @@ -7,9 +7,9 @@ import { sin, cos } from '../utils/trigonometry.js' * mat4.identity(dest) * mat4.rotateZ(dest, dest, radians) * - * @param {mat4} out - receiving matrix - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.fromZRotation * @example * let matrix = fromZRotation(create(), TAU / 4) diff --git a/packages/modeling/src/maths/mat4/identity.d.ts b/packages/modeling/src/maths/mat4/identity.d.ts index 0556ef4a1..3cf585931 100644 --- a/packages/modeling/src/maths/mat4/identity.d.ts +++ b/packages/modeling/src/maths/mat4/identity.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function identity(out: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/identity.js b/packages/modeling/src/maths/mat4/identity.js index c0e839c66..a6c09052b 100644 --- a/packages/modeling/src/maths/mat4/identity.js +++ b/packages/modeling/src/maths/mat4/identity.js @@ -1,8 +1,8 @@ /** * Set a matrix to the identity transform. * - * @param {mat4} out - receiving matrix - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @returns {Mat4} out * @alias module:modeling/maths/mat4.identity */ export const identity = (out) => { diff --git a/packages/modeling/src/maths/mat4/index.d.ts b/packages/modeling/src/maths/mat4/index.d.ts index f3cb211ef..bcb240b01 100644 --- a/packages/modeling/src/maths/mat4/index.d.ts +++ b/packages/modeling/src/maths/mat4/index.d.ts @@ -1,28 +1,31 @@ -export { add } from './add' -export { clone } from './clone' -export { copy } from './copy' -export { create } from './create' -export { equals } from './equals' -export { fromRotation } from './fromRotation' -export { fromScaling } from './fromScaling' -export { fromTaitBryanRotation } from './fromTaitBryanRotation' -export { fromTranslation } from './fromTranslation' -export { fromValues } from './fromValues' -export { fromXRotation } from './fromXRotation' -export { fromYRotation } from './fromYRotation' -export { fromZRotation } from './fromZRotation' -export { identity } from './identity' -export { isMirroring } from './isMirroring' -export { mirrorByPlane } from './mirrorByPlane' -export { multiply } from './multiply' -export { rotate } from './rotate' -export { rotateX } from './rotateX' -export { rotateY } from './rotateY' -export { rotateZ } from './rotateZ' -export { scale } from './scale' -export { subtract } from './subtract' -export { toString } from './toString' -export { translate } from './translate' +export { add } from './add.js' +export { clone } from './clone.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { equals } from './equals.js' +export { fromRotation } from './fromRotation.js' +export { fromScaling } from './fromScaling.js' +export { fromTaitBryanRotation } from './fromTaitBryanRotation.js' +export { fromTranslation } from './fromTranslation.js' +export { fromValues } from './fromValues.js' +export { fromVectorRotation } from './fromVectorRotation.js' +export { fromXRotation } from './fromXRotation.js' +export { fromYRotation } from './fromYRotation.js' +export { fromZRotation } from './fromZRotation.js' +export { identity } from './identity.js' +export { invert } from './invert.js' +export { isIdentity } from './isIdentity.js' +export { isMirroring } from './isMirroring.js' +export { isOnlyTransformScale } from './isOnlyTransformScale.js' +export { mirrorByPlane } from './mirrorByPlane.js' +export { multiply } from './multiply.js' +export { rotate } from './rotate.js' +export { rotateX } from './rotateX.js' +export { rotateY } from './rotateY.js' +export { rotateZ } from './rotateZ.js' +export { scale } from './scale.js' +export { subtract } from './subtract.js' +export { toString } from './toString.js' +export { translate } from './translate.js' -export { Mat4 } from './type' -export as namespace mat4 +export type { Mat4 } from './type.d.ts' diff --git a/packages/modeling/src/maths/mat4/index.js b/packages/modeling/src/maths/mat4/index.js index c5ed71297..32c38c1f0 100644 --- a/packages/modeling/src/maths/mat4/index.js +++ b/packages/modeling/src/maths/mat4/index.js @@ -7,7 +7,6 @@ export { add } from './add.js' export { clone } from './clone.js' export { copy } from './copy.js' export { create } from './create.js' -export { invert } from './invert.js' export { equals } from './equals.js' export { fromRotation } from './fromRotation.js' export { fromScaling } from './fromScaling.js' @@ -19,9 +18,10 @@ export { fromXRotation } from './fromXRotation.js' export { fromYRotation } from './fromYRotation.js' export { fromZRotation } from './fromZRotation.js' export { identity } from './identity.js' +export { invert } from './invert.js' export { isIdentity } from './isIdentity.js' -export { isOnlyTransformScale } from './isOnlyTransformScale.js' export { isMirroring } from './isMirroring.js' +export { isOnlyTransformScale } from './isOnlyTransformScale.js' export { mirrorByPlane } from './mirrorByPlane.js' export { multiply } from './multiply.js' export { rotate } from './rotate.js' diff --git a/packages/modeling/src/maths/mat4/invert.js b/packages/modeling/src/maths/mat4/invert.js index 7392cb6c1..c5ea70186 100644 --- a/packages/modeling/src/maths/mat4/invert.js +++ b/packages/modeling/src/maths/mat4/invert.js @@ -3,9 +3,9 @@ * @author Julian Lloyd * code from https://github.com/jlmakes/rematrix/blob/master/src/index.js * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to invert - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to invert + * @returns {Mat4} out * @alias module:modeling/maths/mat4.invert */ export const invert = (out, matrix) => { diff --git a/packages/modeling/src/maths/mat4/isIdentity.js b/packages/modeling/src/maths/mat4/isIdentity.js index e10bfcf2c..26fde95d5 100644 --- a/packages/modeling/src/maths/mat4/isIdentity.js +++ b/packages/modeling/src/maths/mat4/isIdentity.js @@ -4,7 +4,7 @@ * * mat4.equals(mat4.create(), matrix) * - * @param {mat4} matrix - the matrix + * @param {Mat4} matrix - the matrix * @returns {Boolean} true if matrix is the identity transform * @alias module:modeling/maths/mat4.isIdentity * @example diff --git a/packages/modeling/src/maths/mat4/isMirroring.d.ts b/packages/modeling/src/maths/mat4/isMirroring.d.ts index 233855232..4d760d2d8 100644 --- a/packages/modeling/src/maths/mat4/isMirroring.d.ts +++ b/packages/modeling/src/maths/mat4/isMirroring.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function isMirroring(matrix: Mat4): boolean diff --git a/packages/modeling/src/maths/mat4/isMirroring.js b/packages/modeling/src/maths/mat4/isMirroring.js index dbfcaab99..c51db76fc 100644 --- a/packages/modeling/src/maths/mat4/isMirroring.js +++ b/packages/modeling/src/maths/mat4/isMirroring.js @@ -1,7 +1,7 @@ /** * Determine whether the given matrix is a mirroring transformation. * - * @param {mat4} matrix - matrix of reference + * @param {Mat4} matrix - matrix of reference * @returns {Boolean} true if matrix is a mirroring transformation * @alias module:modeling/maths/mat4.isMirroring */ diff --git a/packages/modeling/src/maths/mat4/isOnlyTransformScale.js b/packages/modeling/src/maths/mat4/isOnlyTransformScale.js index 87fff1cdc..53dfbc3ad 100644 --- a/packages/modeling/src/maths/mat4/isOnlyTransformScale.js +++ b/packages/modeling/src/maths/mat4/isOnlyTransformScale.js @@ -3,7 +3,7 @@ * Determine whether the given matrix is only translate and/or scale. * This code returns true for TAU / 2 rotation as it can be interpreted as scale. * - * @param {mat4} matrix - the matrix + * @param {Mat4} matrix - the matrix * @returns {Boolean} true if matrix is for translate and/or scale * @alias module:modeling/maths/mat4.isOnlyTransformScale */ diff --git a/packages/modeling/src/maths/mat4/leftMultiplyVec2.d.ts b/packages/modeling/src/maths/mat4/leftMultiplyVec2.d.ts index f8b8898ca..572deff32 100644 --- a/packages/modeling/src/maths/mat4/leftMultiplyVec2.d.ts +++ b/packages/modeling/src/maths/mat4/leftMultiplyVec2.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec2 } from '../vec2/type' +import type { Mat4 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function leftMultiplyVec2(vector: Vec2, matrix: Mat4): Vec2 diff --git a/packages/modeling/src/maths/mat4/leftMultiplyVec2.js b/packages/modeling/src/maths/mat4/leftMultiplyVec2.js index 1b1912dc0..0dfadf0b5 100644 --- a/packages/modeling/src/maths/mat4/leftMultiplyVec2.js +++ b/packages/modeling/src/maths/mat4/leftMultiplyVec2.js @@ -4,9 +4,9 @@ import { fromValues } from '../vec2/index.js' * Multiply the input matrix by a Vector2 (interpreted as 2 column, 1 row) * (result = v*M) * Fourth element is set to 1 - * @param {vec2} vector the input vector - * @param {mat4} matrix the input matrix - * @returns {vec2} output + * @param {Vec2} vector the input vector + * @param {Mat4} matrix the input matrix + * @returns {Vec2} output */ export const leftMultiplyVec2 = (vector, matrix) => { const [v0, v1] = vector diff --git a/packages/modeling/src/maths/mat4/leftMultiplyVec3.d.ts b/packages/modeling/src/maths/mat4/leftMultiplyVec3.d.ts index 6bf4d33c0..17ef0a937 100644 --- a/packages/modeling/src/maths/mat4/leftMultiplyVec3.d.ts +++ b/packages/modeling/src/maths/mat4/leftMultiplyVec3.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function leftMultiplyVec3(vector: Vec3, matrix: Mat4): Vec3 diff --git a/packages/modeling/src/maths/mat4/leftMultiplyVec3.js b/packages/modeling/src/maths/mat4/leftMultiplyVec3.js index 073f5ccc1..185346f77 100644 --- a/packages/modeling/src/maths/mat4/leftMultiplyVec3.js +++ b/packages/modeling/src/maths/mat4/leftMultiplyVec3.js @@ -4,9 +4,9 @@ import { fromValues } from '../vec3/index.js' * Multiply the input matrix by a Vector3 (interpreted as 3 column, 1 row) * (result = v*M) * Fourth element is set to 1 - * @param {vec3} vector the input vector - * @param {mat4} matrix the input matrix - * @returns {vec3} output + * @param {Vec3} vector the input vector + * @param {Mat4} matrix the input matrix + * @returns {Vec3} output */ export const leftMultiplyVec3 = (vector, matrix) => { const [v0, v1, v2] = vector diff --git a/packages/modeling/src/maths/mat4/mirror.d.ts b/packages/modeling/src/maths/mat4/mirror.d.ts index 6f60b2877..ea1e6a19f 100644 --- a/packages/modeling/src/maths/mat4/mirror.d.ts +++ b/packages/modeling/src/maths/mat4/mirror.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function mirror(out: Mat4, vec: Vec3, matrix: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/mirror.js b/packages/modeling/src/maths/mat4/mirror.js index 0d0c8a9d4..985bd83fe 100644 --- a/packages/modeling/src/maths/mat4/mirror.js +++ b/packages/modeling/src/maths/mat4/mirror.js @@ -2,10 +2,10 @@ * m the mat4 by the dimensions in the given vec3 * create an affine matrix for mirroring into an arbitrary plane: * - * @param {mat4} out - the receiving matrix - * @param {vec3} vector - the vec3 to mirror the matrix by - * @param {mat4} matrix - the matrix to mirror - * @returns {mat4} out + * @param {Mat4} out - the receiving matrix + * @param {Vec3} vector - the vec3 to mirror the matrix by + * @param {Mat4} matrix - the matrix to mirror + * @returns {Mat4} out */ export const mirror = (out, vector, matrix) => { const x = vector[0] diff --git a/packages/modeling/src/maths/mat4/mirrorByPlane.d.ts b/packages/modeling/src/maths/mat4/mirrorByPlane.d.ts index a5a345f23..92c5a5f5e 100644 --- a/packages/modeling/src/maths/mat4/mirrorByPlane.d.ts +++ b/packages/modeling/src/maths/mat4/mirrorByPlane.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Plane } from '../plane/type' +import type { Mat4 } from './type.d.ts' +import type { Plane } from '../plane/type.d.ts' export function mirrorByPlane(out: Mat4, plane: Plane): Mat4 diff --git a/packages/modeling/src/maths/mat4/mirrorByPlane.js b/packages/modeling/src/maths/mat4/mirrorByPlane.js index 6a0c75f6b..03c710313 100644 --- a/packages/modeling/src/maths/mat4/mirrorByPlane.js +++ b/packages/modeling/src/maths/mat4/mirrorByPlane.js @@ -1,9 +1,9 @@ /** * Create a matrix for mirroring about the given plane. * - * @param {mat4} out - receiving matrix - * @param {vec4} plane - plane of which to mirror the matrix - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Vec4} plane - plane of which to mirror the matrix + * @returns {Mat4} out * @alias module:modeling/maths/mat4.mirrorByPlane */ export const mirrorByPlane = (out, plane) => { diff --git a/packages/modeling/src/maths/mat4/multiply.d.ts b/packages/modeling/src/maths/mat4/multiply.d.ts index b36648cec..4588e1cda 100644 --- a/packages/modeling/src/maths/mat4/multiply.d.ts +++ b/packages/modeling/src/maths/mat4/multiply.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function multiply(out: Mat4, a: Mat4, b: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/multiply.js b/packages/modeling/src/maths/mat4/multiply.js index 9afaa19f7..9caf87de6 100644 --- a/packages/modeling/src/maths/mat4/multiply.js +++ b/packages/modeling/src/maths/mat4/multiply.js @@ -1,10 +1,10 @@ /** * Multiplies the two matrices. * - * @param {mat4} out - receiving matrix - * @param {mat4} a - first operand - * @param {mat4} b - second operand - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} a - first operand + * @param {Mat4} b - second operand + * @returns {Mat4} out * @alias module:modeling/maths/mat4.multiply */ export const multiply = (out, a, b) => { diff --git a/packages/modeling/src/maths/mat4/rightMultiplyVec2.d.ts b/packages/modeling/src/maths/mat4/rightMultiplyVec2.d.ts index 5fb8f6c6d..349216ee6 100644 --- a/packages/modeling/src/maths/mat4/rightMultiplyVec2.d.ts +++ b/packages/modeling/src/maths/mat4/rightMultiplyVec2.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec2 } from '../vec2/type' +import type { Mat4 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function rightMultiplyVec2(vector: Vec2, matrix: Mat4): Vec2 diff --git a/packages/modeling/src/maths/mat4/rightMultiplyVec2.js b/packages/modeling/src/maths/mat4/rightMultiplyVec2.js index f19cb9999..4775fa96e 100644 --- a/packages/modeling/src/maths/mat4/rightMultiplyVec2.js +++ b/packages/modeling/src/maths/mat4/rightMultiplyVec2.js @@ -4,9 +4,9 @@ import { fromValues } from '../vec2/index.js' * Multiply a 2D vector by a matrix (interpreted as 2 row, 1 column). * * Calculation: result = v*M, where the fourth element is set to 1. - * @param {vec2} vector - input vector - * @param {mat4} matrix - input matrix - * @returns {vec2} a new vector + * @param {Vec2} vector - input vector + * @param {Mat4} matrix - input matrix + * @returns {Vec2} a new vector * @alias module:modeling/maths/mat4.rightMultiplyVec2 */ export const rightMultiplyVec2 = (vector, matrix) => { diff --git a/packages/modeling/src/maths/mat4/rightMultiplyVec3.d.ts b/packages/modeling/src/maths/mat4/rightMultiplyVec3.d.ts index 716030a99..1080cf419 100644 --- a/packages/modeling/src/maths/mat4/rightMultiplyVec3.d.ts +++ b/packages/modeling/src/maths/mat4/rightMultiplyVec3.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function rightMultiplyVec3(vector: Vec3, matrix: Mat4): Vec3 diff --git a/packages/modeling/src/maths/mat4/rightMultiplyVec3.js b/packages/modeling/src/maths/mat4/rightMultiplyVec3.js index 8c81f6c1e..df1e10d32 100644 --- a/packages/modeling/src/maths/mat4/rightMultiplyVec3.js +++ b/packages/modeling/src/maths/mat4/rightMultiplyVec3.js @@ -4,9 +4,9 @@ import { fromValues } from '../vec3/index.js' * Multiply a 3D vector by a matrix (interpreted as 3 row, 1 column) * * Calculation: result = v*M, where the fourth element is set to 1. - * @param {vec3} vector - input vector - * @param {mat4} matrix - input matrix - * @returns {vec3} a new vector + * @param {Vec3} vector - input vector + * @param {Mat4} matrix - input matrix + * @returns {Vec3} a new vector * @alias module:modeling/maths/mat4.rightMultiplyVec3 */ export const rightMultiplyVec3 = (vector, matrix) => { diff --git a/packages/modeling/src/maths/mat4/rotate.d.ts b/packages/modeling/src/maths/mat4/rotate.d.ts index f3da8f109..14040d487 100644 --- a/packages/modeling/src/maths/mat4/rotate.d.ts +++ b/packages/modeling/src/maths/mat4/rotate.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function rotate(out: Mat4, matrix: Mat4, radians: number, axis: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/rotate.js b/packages/modeling/src/maths/mat4/rotate.js index 793a0d1cc..0d6dcf850 100644 --- a/packages/modeling/src/maths/mat4/rotate.js +++ b/packages/modeling/src/maths/mat4/rotate.js @@ -7,11 +7,11 @@ import { copy } from './copy.js' /** * Rotates a matrix by the given angle about the given axis. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to rotate - * @param {Number} radians - angle to rotate the matrix by - * @param {vec3} axis - axis to rotate around - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to rotate + * @param {number} radians - angle to rotate the matrix by + * @param {Vec3} axis - axis to rotate around + * @returns {Mat4} out * @alias module:modeling/maths/mat4.rotate */ export const rotate = (out, matrix, radians, axis) => { diff --git a/packages/modeling/src/maths/mat4/rotate.test.js b/packages/modeling/src/maths/mat4/rotate.test.js index ec03e7f0f..12d6e0047 100644 --- a/packages/modeling/src/maths/mat4/rotate.test.js +++ b/packages/modeling/src/maths/mat4/rotate.test.js @@ -10,12 +10,12 @@ test('mat4: rotate() called with out parameter should return a new mat4 with cor const idn = create() // invalid condition when axis is 0,0,0 - const out1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + const out1 = create() const ret1 = rotate(out1, idn, rotation, [0, 0, 0]) t.is(out1, ret1) t.true(compareVectors(out1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) - const out2 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + const out2 = create() const ret2 = rotate(out2, idn, rotation, [0, 0, 1]) t.true(compareVectors(out2, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) t.true(compareVectors(ret2, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) diff --git a/packages/modeling/src/maths/mat4/rotateX.d.ts b/packages/modeling/src/maths/mat4/rotateX.d.ts index dd4d2241c..cfe2e495c 100644 --- a/packages/modeling/src/maths/mat4/rotateX.d.ts +++ b/packages/modeling/src/maths/mat4/rotateX.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function rotateX(out: Mat4, matrix: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/rotateX.js b/packages/modeling/src/maths/mat4/rotateX.js index d3cc791b5..a7b0cb3eb 100644 --- a/packages/modeling/src/maths/mat4/rotateX.js +++ b/packages/modeling/src/maths/mat4/rotateX.js @@ -3,10 +3,10 @@ import { sin, cos } from '../utils/trigonometry.js' /** * Rotates a matrix by the given angle around the X axis. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to rotate - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to rotate + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.rotateX */ export const rotateX = (out, matrix, radians) => { diff --git a/packages/modeling/src/maths/mat4/rotateY.d.ts b/packages/modeling/src/maths/mat4/rotateY.d.ts index fd830a0b9..d7686bcf6 100644 --- a/packages/modeling/src/maths/mat4/rotateY.d.ts +++ b/packages/modeling/src/maths/mat4/rotateY.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function rotateY(out: Mat4, matrix: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/rotateY.js b/packages/modeling/src/maths/mat4/rotateY.js index c1af55811..bf1390585 100644 --- a/packages/modeling/src/maths/mat4/rotateY.js +++ b/packages/modeling/src/maths/mat4/rotateY.js @@ -3,10 +3,10 @@ import { sin, cos } from '../utils/trigonometry.js' /** * Rotates a matrix by the given angle around the Y axis. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to rotate - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to rotate + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.rotateY */ export const rotateY = (out, matrix, radians) => { diff --git a/packages/modeling/src/maths/mat4/rotateZ.d.ts b/packages/modeling/src/maths/mat4/rotateZ.d.ts index 632c5b2b7..df15e6f40 100644 --- a/packages/modeling/src/maths/mat4/rotateZ.d.ts +++ b/packages/modeling/src/maths/mat4/rotateZ.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function rotateZ(out: Mat4, matrix: Mat4, radians: number): Mat4 diff --git a/packages/modeling/src/maths/mat4/rotateZ.js b/packages/modeling/src/maths/mat4/rotateZ.js index 3cae1eed6..8b4bec1b6 100644 --- a/packages/modeling/src/maths/mat4/rotateZ.js +++ b/packages/modeling/src/maths/mat4/rotateZ.js @@ -3,10 +3,10 @@ import { sin, cos } from '../utils/trigonometry.js' /** * Rotates a matrix by the given angle around the Z axis. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to rotate - * @param {Number} radians - angle to rotate the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to rotate + * @param {number} radians - angle to rotate the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.rotateZ */ export const rotateZ = (out, matrix, radians) => { diff --git a/packages/modeling/src/maths/mat4/scale.d.ts b/packages/modeling/src/maths/mat4/scale.d.ts index c944b1f18..988789354 100644 --- a/packages/modeling/src/maths/mat4/scale.d.ts +++ b/packages/modeling/src/maths/mat4/scale.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function scale(out: Mat4, matrix: Mat4, dimensions: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/scale.js b/packages/modeling/src/maths/mat4/scale.js index 02413276b..5c4a09ca7 100644 --- a/packages/modeling/src/maths/mat4/scale.js +++ b/packages/modeling/src/maths/mat4/scale.js @@ -1,10 +1,10 @@ /** * Scales the matrix by the given dimensions. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to scale - * @param {vec3} dimensions - dimensions to scale the matrix by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to scale + * @param {Vec3} dimensions - dimensions to scale the matrix by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.scale */ export const scale = (out, matrix, dimensions) => { diff --git a/packages/modeling/src/maths/mat4/subtract.d.ts b/packages/modeling/src/maths/mat4/subtract.d.ts index 8c7b14e36..ff2034676 100644 --- a/packages/modeling/src/maths/mat4/subtract.d.ts +++ b/packages/modeling/src/maths/mat4/subtract.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function subtract(out: Mat4, a: Mat4, b: Mat4): Mat4 diff --git a/packages/modeling/src/maths/mat4/subtract.js b/packages/modeling/src/maths/mat4/subtract.js index 5a9d2c289..f6c20d2c7 100644 --- a/packages/modeling/src/maths/mat4/subtract.js +++ b/packages/modeling/src/maths/mat4/subtract.js @@ -1,10 +1,10 @@ /** * Subtracts matrix b from matrix a. (A-B) * - * @param {mat4} out - receiving matrix - * @param {mat4} a - first operand - * @param {mat4} b - second operand - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} a - first operand + * @param {Mat4} b - second operand + * @returns {Mat4} out * @alias module:modeling/maths/mat4.subtract */ export const subtract = (out, a, b) => { diff --git a/packages/modeling/src/maths/mat4/toString.d.ts b/packages/modeling/src/maths/mat4/toString.d.ts index f538877bd..2c8c06ea1 100644 --- a/packages/modeling/src/maths/mat4/toString.d.ts +++ b/packages/modeling/src/maths/mat4/toString.d.ts @@ -1,3 +1,3 @@ -import { Mat4 } from './type' +import type { Mat4 } from './type.d.ts' export function toString(matrix: Mat4): string diff --git a/packages/modeling/src/maths/mat4/toString.js b/packages/modeling/src/maths/mat4/toString.js index 4ba9d02e4..49a704df0 100644 --- a/packages/modeling/src/maths/mat4/toString.js +++ b/packages/modeling/src/maths/mat4/toString.js @@ -1,8 +1,8 @@ /** * Return a string representing the given matrix. * - * @param {mat4} mat - matrix of reference - * @returns {String} string representation + * @param {Mat4} mat - matrix of reference + * @returns {string} string representation * @alias module:modeling/maths/mat4.toString */ export const toString = (mat) => mat.map((n) => n.toFixed(7)).toString() diff --git a/packages/modeling/src/maths/mat4/translate.d.ts b/packages/modeling/src/maths/mat4/translate.d.ts index 3a02caaa9..06e2931ef 100644 --- a/packages/modeling/src/maths/mat4/translate.d.ts +++ b/packages/modeling/src/maths/mat4/translate.d.ts @@ -1,4 +1,4 @@ -import { Mat4 } from './type' -import { Vec3 } from '../vec3/type' +import type { Mat4 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function translate(out: Mat4, matrix: Mat4, offsets: Vec3): Mat4 diff --git a/packages/modeling/src/maths/mat4/translate.js b/packages/modeling/src/maths/mat4/translate.js index 013badb56..3c5c0229d 100644 --- a/packages/modeling/src/maths/mat4/translate.js +++ b/packages/modeling/src/maths/mat4/translate.js @@ -1,10 +1,10 @@ /** * Translate the matrix by the given offset vector. * - * @param {mat4} out - receiving matrix - * @param {mat4} matrix - matrix to translate - * @param {vec3} offsets - offset vector to translate by - * @returns {mat4} out + * @param {Mat4} out - receiving matrix + * @param {Mat4} matrix - matrix to translate + * @param {Vec3} offsets - offset vector to translate by + * @returns {Mat4} out * @alias module:modeling/maths/mat4.translate */ export const translate = (out, matrix, offsets) => { diff --git a/packages/modeling/src/maths/mat4/translate.test.js b/packages/modeling/src/maths/mat4/translate.test.js index 7d35f17bf..05f0a2871 100644 --- a/packages/modeling/src/maths/mat4/translate.test.js +++ b/packages/modeling/src/maths/mat4/translate.test.js @@ -1,16 +1,11 @@ import test from 'ava' -import { translate, create } from './index.js' +import { translate, create, fromValues } from './index.js' import { compareVectors } from '../../../test/helpers/index.js' test('mat4: translate() called with three parameters should update a mat4 with correct values', (t) => { - const identityMatrix = [ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ] + const identityMatrix = create() const obs1 = create() const ret1 = translate(obs1, identityMatrix, [0, 0, 0]) @@ -26,12 +21,12 @@ test('mat4: translate() called with three parameters should update a mat4 with c const x = 1 const y = 5 const z = 7 - const translationMatrix = [ + const translationMatrix = fromValues( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 - ] + ) const obs3 = create() const ret3 = translate(obs3, translationMatrix, [-2, -3, -6]) @@ -41,24 +36,24 @@ test('mat4: translate() called with three parameters should update a mat4 with c const w = 1 const h = 3 const d = 5 - const scaleMatrix = [ + const scaleMatrix = fromValues( w, 0, 0, 0, 0, h, 0, 0, 0, 0, d, 0, 0, 0, 0, 1 - ] + ) const obs4 = create() const ret4 = translate(obs4, scaleMatrix, [2, 3, 6]) t.true(compareVectors(obs4, [1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 2, 9, 30, 1])) t.true(compareVectors(ret4, [1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 2, 9, 30, 1])) - const rotateZMatrix = [ + const rotateZMatrix = fromValues( 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 - ] + ) const obs5 = create() const ret5 = translate(obs5, rotateZMatrix, [6, 4, 2]) diff --git a/packages/modeling/src/maths/plane/clone.d.ts b/packages/modeling/src/maths/plane/clone.d.ts index 34283a8b5..974fdc718 100644 --- a/packages/modeling/src/maths/plane/clone.d.ts +++ b/packages/modeling/src/maths/plane/clone.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function clone(plane: Plane): Plane diff --git a/packages/modeling/src/maths/plane/copy.d.ts b/packages/modeling/src/maths/plane/copy.d.ts index 31603d08c..2b168dc6d 100644 --- a/packages/modeling/src/maths/plane/copy.d.ts +++ b/packages/modeling/src/maths/plane/copy.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function copy(out: Plane, plane: Plane): Plane diff --git a/packages/modeling/src/maths/plane/create.d.ts b/packages/modeling/src/maths/plane/create.d.ts index a84edcc8c..93f946e7b 100644 --- a/packages/modeling/src/maths/plane/create.d.ts +++ b/packages/modeling/src/maths/plane/create.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function create(): Plane diff --git a/packages/modeling/src/maths/plane/equals.d.ts b/packages/modeling/src/maths/plane/equals.d.ts index 3fd5b9977..223bd2159 100644 --- a/packages/modeling/src/maths/plane/equals.d.ts +++ b/packages/modeling/src/maths/plane/equals.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function equals(a: Plane, b: Plane): boolean diff --git a/packages/modeling/src/maths/plane/flip.d.ts b/packages/modeling/src/maths/plane/flip.d.ts index 957660fd0..bf517d444 100644 --- a/packages/modeling/src/maths/plane/flip.d.ts +++ b/packages/modeling/src/maths/plane/flip.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function flip(out: Plane, plane: Plane): Plane diff --git a/packages/modeling/src/maths/plane/flip.js b/packages/modeling/src/maths/plane/flip.js index 98e38e442..1162fbef7 100644 --- a/packages/modeling/src/maths/plane/flip.js +++ b/packages/modeling/src/maths/plane/flip.js @@ -1,9 +1,9 @@ /** * Flip the given plane. * - * @param {plane} out - receiving plane - * @param {plane} plane - plane to flip - * @return {plane} out + * @param {Plane} out - receiving plane + * @param {Plane} plane - plane to flip + * @return {Plane} out * @alias module:modeling/maths/plane.flip */ export const flip = (out, plane) => { diff --git a/packages/modeling/src/maths/plane/fromNormalAndPoint.d.ts b/packages/modeling/src/maths/plane/fromNormalAndPoint.d.ts index 8ff04ec5e..a1781e1db 100644 --- a/packages/modeling/src/maths/plane/fromNormalAndPoint.d.ts +++ b/packages/modeling/src/maths/plane/fromNormalAndPoint.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Vec3 } from '../vec3/type' +import type { Plane } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromNormalAndPoint(out: Plane, normal: Vec3, point: Vec3): Plane diff --git a/packages/modeling/src/maths/plane/fromNormalAndPoint.js b/packages/modeling/src/maths/plane/fromNormalAndPoint.js index 9e3713738..ac52e2286 100644 --- a/packages/modeling/src/maths/plane/fromNormalAndPoint.js +++ b/packages/modeling/src/maths/plane/fromNormalAndPoint.js @@ -6,16 +6,15 @@ import * as vec3 from '../vec3/index.js' * * The contents of the array are a normal [0,1,2] and a distance [3]. * @see https://en.wikipedia.org/wiki/Hesse_normal_form - * @typedef {Array} plane */ /** * Create a new plane from the given normal and point values. * - * @param {plane} out - receiving plane - * @param {vec3} normal - directional vector - * @param {vec3} point - origin of plane - * @returns {plane} out + * @param {Plane} out - receiving plane + * @param {Vec3} normal - directional vector + * @param {Vec3} point - origin of plane + * @returns {Plane} out * @alias module:modeling/maths/plane.fromNormalAndPoint */ export const fromNormalAndPoint = (out, normal, point) => { diff --git a/packages/modeling/src/maths/plane/fromPoints.d.ts b/packages/modeling/src/maths/plane/fromPoints.d.ts index e89547521..6026f954c 100644 --- a/packages/modeling/src/maths/plane/fromPoints.d.ts +++ b/packages/modeling/src/maths/plane/fromPoints.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Vec3 } from '../vec3/type' +import type { Plane } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromPoints(out: Plane, ...vertices: Array): Plane diff --git a/packages/modeling/src/maths/plane/fromPoints.js b/packages/modeling/src/maths/plane/fromPoints.js index 99ae986ba..83129f1eb 100644 --- a/packages/modeling/src/maths/plane/fromPoints.js +++ b/packages/modeling/src/maths/plane/fromPoints.js @@ -3,9 +3,9 @@ import * as vec3 from '../vec3/index.js' /** * Create a plane from the given points. * - * @param {plane} out - receiving plane + * @param {Plane} out - receiving plane * @param {Array} vertices - points on the plane - * @returns {plane} out + * @returns {Plane} out * @alias module:modeling/maths/plane.fromPoints */ export const fromPoints = (out, ...vertices) => { diff --git a/packages/modeling/src/maths/plane/fromPointsRandom.d.ts b/packages/modeling/src/maths/plane/fromPointsRandom.d.ts index 86abe2dfc..5534b420d 100644 --- a/packages/modeling/src/maths/plane/fromPointsRandom.d.ts +++ b/packages/modeling/src/maths/plane/fromPointsRandom.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Vec3 } from '../vec3/type' +import type { Plane } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function fromPointsRandom(out: Plane, a: Vec3, b: Vec3, c: Vec3): Plane diff --git a/packages/modeling/src/maths/plane/fromPointsRandom.js b/packages/modeling/src/maths/plane/fromPointsRandom.js index a42caeafa..6f21b7a5f 100644 --- a/packages/modeling/src/maths/plane/fromPointsRandom.js +++ b/packages/modeling/src/maths/plane/fromPointsRandom.js @@ -7,11 +7,11 @@ import * as vec3 from '../vec3/index.js' * but allow the vectors to be on one point or one line. * In such a case, a random plane through the given points is constructed. * - * @param {plane} out - receiving plane - * @param {vec3} a - 3D point - * @param {vec3} b - 3D point - * @param {vec3} c - 3D point - * @returns {plane} out + * @param {Plane} out - receiving plane + * @param {Vec3} a - 3D point + * @param {Vec3} b - 3D point + * @param {Vec3} c - 3D point + * @returns {Plane} out * @alias module:modeling/maths/plane.fromPointsRandom */ export const fromPointsRandom = (out, a, b, c) => { diff --git a/packages/modeling/src/maths/plane/fromValues.d.ts b/packages/modeling/src/maths/plane/fromValues.d.ts index 4835fae34..8619aee37 100644 --- a/packages/modeling/src/maths/plane/fromValues.d.ts +++ b/packages/modeling/src/maths/plane/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function fromValues(x: number, y: number, z: number, w: number): Plane diff --git a/packages/modeling/src/maths/plane/index.d.ts b/packages/modeling/src/maths/plane/index.d.ts index 231f8c64c..73a52b4b2 100644 --- a/packages/modeling/src/maths/plane/index.d.ts +++ b/packages/modeling/src/maths/plane/index.d.ts @@ -1,16 +1,15 @@ -export { clone } from './clone' -export { copy } from './copy' -export { create } from './create' -export { equals } from './equals' -export { flip } from './flip' -export { fromNormalAndPoint } from './fromNormalAndPoint' -export { fromValues } from './fromValues' -export { fromPoints } from './fromPoints' -export { fromPointsRandom } from './fromPointsRandom' -export { signedDistanceToPoint } from './signedDistanceToPoint' -export { projectionOfPoint } from './projectionOfPoint' -export { toString } from './toString' -export { transform } from './transform' +export { clone } from './clone.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { equals } from './equals.js' +export { flip } from './flip.js' +export { fromNormalAndPoint } from './fromNormalAndPoint.js' +export { fromValues } from './fromValues.js' +export { fromPoints } from './fromPoints.js' +export { fromPointsRandom } from './fromPointsRandom.js' +export { signedDistanceToPoint } from './signedDistanceToPoint.js' +export { projectionOfPoint } from './projectionOfPoint.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Plane } from './type' -export as namespace plane +export type { Plane } from './type.d.ts' diff --git a/packages/modeling/src/maths/plane/projectionOfPoint.d.ts b/packages/modeling/src/maths/plane/projectionOfPoint.d.ts index f4e855dd1..3750bad52 100644 --- a/packages/modeling/src/maths/plane/projectionOfPoint.d.ts +++ b/packages/modeling/src/maths/plane/projectionOfPoint.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Vec3 } from '../vec3/type' +import type { Plane } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function projectionOfPoint(plane: Plane, point: Vec3): Vec3 diff --git a/packages/modeling/src/maths/plane/projectionOfPoint.js b/packages/modeling/src/maths/plane/projectionOfPoint.js index 4e28edc47..b44f55470 100644 --- a/packages/modeling/src/maths/plane/projectionOfPoint.js +++ b/packages/modeling/src/maths/plane/projectionOfPoint.js @@ -3,9 +3,9 @@ import * as vec3 from '../vec3/index.js' /** * Project the given point on to the given plane. * - * @param {plane} plane - plane of reference - * @param {vec3} point - point of reference - * @return {vec3} projected point on plane + * @param {Plane} plane - plane of reference + * @param {Vec3} point - point of reference + * @return {Vec3} projected point on plane * @alias module:modeling/maths/plane.projectionOfPoint */ export const projectionOfPoint = (plane, point) => { diff --git a/packages/modeling/src/maths/plane/signedDistanceToPoint.d.ts b/packages/modeling/src/maths/plane/signedDistanceToPoint.d.ts index ab20de666..8ad0c3c34 100644 --- a/packages/modeling/src/maths/plane/signedDistanceToPoint.d.ts +++ b/packages/modeling/src/maths/plane/signedDistanceToPoint.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Vec3 } from '../vec3/type' +import type { Plane } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function signedDistanceToPoint(plane: Plane, vec: Vec3): number diff --git a/packages/modeling/src/maths/plane/signedDistanceToPoint.js b/packages/modeling/src/maths/plane/signedDistanceToPoint.js index 773d160d7..c4ee95056 100644 --- a/packages/modeling/src/maths/plane/signedDistanceToPoint.js +++ b/packages/modeling/src/maths/plane/signedDistanceToPoint.js @@ -3,9 +3,9 @@ import * as vec3 from '../vec3/index.js' /** * Calculate the distance to the given point. * - * @param {plane} plane - plane of reference - * @param {vec3} point - point of reference - * @return {Number} signed distance to point + * @param {Plane} plane - plane of reference + * @param {Vec3} point - point of reference + * @return {number} signed distance to point * @alias module:modeling/maths/plane.signedDistanceToPoint */ export const signedDistanceToPoint = (plane, point) => vec3.dot(plane, point) - plane[3] diff --git a/packages/modeling/src/maths/plane/toString.d.ts b/packages/modeling/src/maths/plane/toString.d.ts index 8f09128aa..af000401f 100644 --- a/packages/modeling/src/maths/plane/toString.d.ts +++ b/packages/modeling/src/maths/plane/toString.d.ts @@ -1,3 +1,3 @@ -import { Plane } from './type' +import type { Plane } from './type.d.ts' export function toString(plane: Plane): string diff --git a/packages/modeling/src/maths/plane/transform.d.ts b/packages/modeling/src/maths/plane/transform.d.ts index 9339d78a1..cf1707ef1 100644 --- a/packages/modeling/src/maths/plane/transform.d.ts +++ b/packages/modeling/src/maths/plane/transform.d.ts @@ -1,4 +1,4 @@ -import { Plane } from './type' -import { Mat4 } from '../mat4/type' +import type { Plane } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Plane, plane: Plane, matrix: Mat4): Plane diff --git a/packages/modeling/src/maths/plane/transform.js b/packages/modeling/src/maths/plane/transform.js index d05f9e92b..e46979e8f 100644 --- a/packages/modeling/src/maths/plane/transform.js +++ b/packages/modeling/src/maths/plane/transform.js @@ -7,10 +7,10 @@ import { flip } from './flip.js' /** * Transform the given plane using the given matrix * - * @param {plane} out - receiving plane - * @param {plane} plane - plane to transform - * @param {mat4} matrix - matrix to transform with - * @return {plane} out + * @param {Plane} out - receiving plane + * @param {Plane} plane - plane to transform + * @param {Mat4} matrix - matrix to transform with + * @return {Plane} out * @alias module:modeling/maths/plane.transform */ export const transform = (out, plane, matrix) => { diff --git a/packages/modeling/src/maths/types.d.ts b/packages/modeling/src/maths/types.d.ts index ece5b4bb8..425763836 100644 --- a/packages/modeling/src/maths/types.d.ts +++ b/packages/modeling/src/maths/types.d.ts @@ -1,8 +1,15 @@ -export { Line2 } from './line2/type' -export { Line3 } from './line3/type' -export { Mat4 } from './mat4/type' -export { Plane } from './plane/type' -export { Vec1 } from './vec1/type' -export { Vec2 } from './vec2/type' -export { Vec3 } from './vec3/type' -export { Vec4 } from './vec4/type' +import type { Vec1 } from './vec1/type.d.ts' +import type { Vec2 } from './vec2/type.d.ts' +import type { Vec3 } from './vec3/type.d.ts' +import type { Vec4 } from './vec4/type.d.ts' + +export type { Line2 } from './line2/type.d.ts' +export type { Line3 } from './line3/type.d.ts' +export type { Mat4 } from './mat4/type.d.ts' +export type { Plane } from './plane/type.d.ts' +export type { Vec1 } from './vec1/type.d.ts' +export type { Vec2 } from './vec2/type.d.ts' +export type { Vec3 } from './vec3/type.d.ts' +export type { Vec4 } from './vec4/type.d.ts' + +export type Vec = Vec1 | Vec2 | Vec3 | Vec4 diff --git a/packages/modeling/src/maths/utils/OrthonormalFormula.d.ts b/packages/modeling/src/maths/utils/OrthonormalFormula.d.ts index f431b27a2..671500cd0 100644 --- a/packages/modeling/src/maths/utils/OrthonormalFormula.d.ts +++ b/packages/modeling/src/maths/utils/OrthonormalFormula.d.ts @@ -1,6 +1,6 @@ -import { Plane } from '../plane/type' -import { Vec2 } from '../vec2/type' -import { Vec3 } from '../vec3/type' +import type { Plane } from '../plane/type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export class OrthonormalFormula { constructor (plane: Plane) diff --git a/packages/modeling/src/maths/utils/OrthonormalFormula.js b/packages/modeling/src/maths/utils/OrthonormalFormula.js index 67d3c862f..4039033f7 100644 --- a/packages/modeling/src/maths/utils/OrthonormalFormula.js +++ b/packages/modeling/src/maths/utils/OrthonormalFormula.js @@ -10,7 +10,7 @@ import * as vec3 from '../vec3/index.js' export class OrthonormalFormula { /** * Construct the standard basis formula from the given plane. - * @param {plane} the plane of which to convert vertices to/from the orthonormal basis + * @param {Plane} plane - the plane of which to convert vertices to/from the orthonormal basis */ constructor (plane) { // plane normal is one component @@ -27,7 +27,7 @@ export class OrthonormalFormula { /** * Convert the basis formula to a projection matrix. - * return {mat4} matrix which can be used to convert 3D vertices to 2D points + * @return {Mat4} matrix which can be used to convert 3D vertices to 2D points */ getProjectionMatrix () { return mat4.fromValues( @@ -40,7 +40,7 @@ export class OrthonormalFormula { /** * Convert the basis formula to an inverse projection matrix. - * return {mat4} matrix which can be used to convert 2D points to 3D vertices + * @return {Mat4} matrix which can be used to convert 2D points to 3D vertices */ getInverseProjectionMatrix () { return mat4.fromValues( @@ -53,8 +53,8 @@ export class OrthonormalFormula { /** * Convert the given 3D vertex to a 2D point which exists in the orthonormal basis - * @param {vec3} - 3D vertex which lies within the original basis (set) - * @return {vec2} - 2D point which lies within the orthonormal basis + * @param {Vec3} vertex - 3D vertex which lies within the original basis (set) + * @return {Vec2} - 2D point which lies within the orthonormal basis */ to2D (vertex) { const point = vec2.fromValues(vec3.dot(vertex, this.u), vec3.dot(vertex, this.v)) @@ -64,8 +64,8 @@ export class OrthonormalFormula { /** * Convert the given 2D point to a 3D vertex which exists in the original basis (set) - * @param {vec2} - 2D point which lies within the orthonormal basis - * @return {vec3} - 3D vertex which lies within the original basis (set) + * @param {Vec2} point - 2D point which lies within the orthonormal basis + * @return {Vec3} - 3D vertex which lies within the original basis (set) */ to3D (point) { // return the original vertex if possible, i.e. no floating point error diff --git a/packages/modeling/src/maths/utils/OrthonormalFormula.test.js b/packages/modeling/src/maths/utils/OrthonormalFormula.test.js index 942b2c9b1..df5af08dd 100644 --- a/packages/modeling/src/maths/utils/OrthonormalFormula.test.js +++ b/packages/modeling/src/maths/utils/OrthonormalFormula.test.js @@ -1,5 +1,6 @@ import test from 'ava' +import * as vec3 from '../vec3/index.js' import { plane } from '../index.js' import { OrthonormalFormula } from './index.js' @@ -21,12 +22,12 @@ test('utils: OrthonormalFormula methods', (t) => { const p1 = plane.fromNormalAndPoint(plane.create(), [5, 0, 0], [5, 0, 0]) const o1 = new OrthonormalFormula(p1) - const v1 = [5, 0, 0] - const v2 = [0, 5, 0] - const v3 = [0, 0, 5] - const v4 = [-5, 0, 0] - const v5 = [0, -5, 0] - const v6 = [0, 0, -5] + const v1 = vec3.fromValues(5, 0, 0) + const v2 = vec3.fromValues(0, 5, 0) + const v3 = vec3.fromValues(0, 0, 5) + const v4 = vec3.fromValues(-5, 0, 0) + const v5 = vec3.fromValues(0, -5, 0) + const v6 = vec3.fromValues(0, 0, -5) const t1 = o1.to2D(v1) t.deepEqual(t1, [0, 0]) diff --git a/packages/modeling/src/maths/utils/aboutEqualNormals.d.ts b/packages/modeling/src/maths/utils/aboutEqualNormals.d.ts index 36e3fc0dd..c2edce4c4 100644 --- a/packages/modeling/src/maths/utils/aboutEqualNormals.d.ts +++ b/packages/modeling/src/maths/utils/aboutEqualNormals.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from '../vec3/type' +import type { Vec3 } from '../vec3/type.d.ts' export function aboutEqualNormals(a: Vec3, b: Vec3): boolean diff --git a/packages/modeling/src/maths/utils/aboutEqualNormals.js b/packages/modeling/src/maths/utils/aboutEqualNormals.js index e47613022..15b8c1e9f 100644 --- a/packages/modeling/src/maths/utils/aboutEqualNormals.js +++ b/packages/modeling/src/maths/utils/aboutEqualNormals.js @@ -2,8 +2,8 @@ import { NEPS } from '../constants.js' /** * Compare two normals (unit vectors) for near equality. - * @param {vec3} a - normal a - * @param {vec3} b - normal b + * @param {Vec3} a - normal a + * @param {Vec3} b - normal b * @returns {Boolean} true if a and b are nearly equal * @alias module:modeling/maths/utils.aboutEqualNormals */ diff --git a/packages/modeling/src/maths/utils/area.d.ts b/packages/modeling/src/maths/utils/area.d.ts index f1de5fb41..64c43da24 100644 --- a/packages/modeling/src/maths/utils/area.d.ts +++ b/packages/modeling/src/maths/utils/area.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from '../vec2/type' +import type { Vec2 } from '../vec2/type.d.ts' export function area(points: Array): number diff --git a/packages/modeling/src/maths/utils/area.js b/packages/modeling/src/maths/utils/area.js index 2d2c874bf..99e118099 100644 --- a/packages/modeling/src/maths/utils/area.js +++ b/packages/modeling/src/maths/utils/area.js @@ -1,7 +1,7 @@ /** * Calculate the area under the given points. * @param {Array} points - list of 2D points - * @return {Number} area under the given points + * @return {number} area under the given points * @alias module:modeling/maths/utils.area */ export const area = (points) => { diff --git a/packages/modeling/src/maths/utils/index.d.ts b/packages/modeling/src/maths/utils/index.d.ts index 22e332d0f..f34abe971 100644 --- a/packages/modeling/src/maths/utils/index.d.ts +++ b/packages/modeling/src/maths/utils/index.d.ts @@ -1,9 +1,7 @@ -export { aboutEqualNormals } from './aboutEqualNormals' -export { area } from './area' -export { interpolateBetween2DPointsForY } from './interpolateBetween2DPointsForY' -export { intersect } from './intersect' -export { solve2Linear } from './solve2Linear' -export { sin, cos } from './trigonometry' -export { OrthonormalFormula } from './OrthonormalFormula' - -export as namespace utils +export { aboutEqualNormals } from './aboutEqualNormals.js' +export { area } from './area.js' +export { interpolateBetween2DPointsForY } from './interpolateBetween2DPointsForY.js' +export { intersect } from './intersect.js' +export { solve2Linear } from './solve2Linear.js' +export { sin, cos } from './trigonometry.js' +export { OrthonormalFormula } from './OrthonormalFormula.js' diff --git a/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.d.ts b/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.d.ts index 3c26db0de..3b24422db 100644 --- a/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.d.ts +++ b/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from '../vec2/type' +import type { Vec2 } from '../vec2/type.d.ts' export function interpolateBetween2DPointsForY(point1: Vec2, point2: Vec2, y: number): number diff --git a/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.js b/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.js index 9d0bcf594..3d2d57170 100644 --- a/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.js +++ b/packages/modeling/src/maths/utils/interpolateBetween2DPointsForY.js @@ -1,9 +1,9 @@ /** * Get the X coordinate of a point with a certain Y coordinate, interpolated between two points. * Interpolation is robust even if the points have the same Y coordinate - * @param {vec2} point1 - * @param {vec2} point2 - * @param {Number} y + * @param {Vec2} point1 + * @param {Vec2} point2 + * @param {number} y * @return {Array} X and Y of interpolated point * @alias module:modeling/maths/utils.interpolateBetween2DPointsForY */ diff --git a/packages/modeling/src/maths/utils/intersect.d.ts b/packages/modeling/src/maths/utils/intersect.d.ts index 093a71932..1f1b81c88 100644 --- a/packages/modeling/src/maths/utils/intersect.d.ts +++ b/packages/modeling/src/maths/utils/intersect.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from '../vec2/type' +import type { Vec2 } from '../vec2/type.d.ts' -export function intersect(p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, endpointTouch: boolean): Vec2 +export function intersect(p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2, endpointTouch?: boolean): Vec2 diff --git a/packages/modeling/src/maths/utils/intersect.js b/packages/modeling/src/maths/utils/intersect.js index 0fb4d81b1..c592a602c 100644 --- a/packages/modeling/src/maths/utils/intersect.js +++ b/packages/modeling/src/maths/utils/intersect.js @@ -3,12 +3,12 @@ * If the endpointTouch parameter is false, intersections at segment end points are excluded. * Note: If the line segments do NOT intersect then undefined is returned. * @see http://paulbourke.net/geometry/pointlineplane/ - * @param {vec2} p1 - first point of first line segment - * @param {vec2} p2 - second point of first line segment - * @param {vec2} p3 - first point of second line segment - * @param {vec2} p4 - second point of second line segment - * @param {Boolean} endpointTouch - include intersections at segment endpoints - * @returns {vec2} intersection point of the two line segments, or undefined + * @param {Vec2} p1 - first point of first line segment + * @param {Vec2} p2 - second point of first line segment + * @param {Vec2} p3 - first point of second line segment + * @param {Vec2} p4 - second point of second line segment + * @param {boolean} endpointTouch - include intersections at segment endpoints + * @returns {Vec2} intersection point of the two line segments, or undefined * @alias module:modeling/maths/utils.intersect */ export const intersect = (p1, p2, p3, p4, endpointTouch = true) => { diff --git a/packages/modeling/src/maths/utils/intersect.test.js b/packages/modeling/src/maths/utils/intersect.test.js index fd7350ef8..3ae80b540 100644 --- a/packages/modeling/src/maths/utils/intersect.test.js +++ b/packages/modeling/src/maths/utils/intersect.test.js @@ -1,5 +1,6 @@ import test from 'ava' +import * as vec2 from '../vec2/index.js' import { intersect } from './index.js' // A __F @@ -8,13 +9,13 @@ import { intersect } from './index.js' // \ / \ // C G -const a = [0, 1] -const b = [-1, 0] -const c = [0, -1] -const d = [1, 0] -const e = [2, 0.5] -const f = [3, 1] -const g = [2, -1] +const a = vec2.fromValues(0, 1) +const b = vec2.fromValues(-1, 0) +const c = vec2.fromValues(0, -1) +const d = vec2.fromValues(1, 0) +const e = vec2.fromValues(2, 0.5) +const f = vec2.fromValues(3, 1) +const g = vec2.fromValues(2, -1) test('utils: intersect() for intersecting lines', (t) => { t.deepEqual(intersect(a, c, b, d), [0, 0]) diff --git a/packages/modeling/src/maths/utils/solve2Linear.d.ts b/packages/modeling/src/maths/utils/solve2Linear.d.ts index f57969213..1425ba6e8 100644 --- a/packages/modeling/src/maths/utils/solve2Linear.d.ts +++ b/packages/modeling/src/maths/utils/solve2Linear.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from '../vec2/type' +import type { Vec2 } from '../vec2/type.d.ts' export function solve2Linear(a: number, b: number, c: number, d: number, u: number, v: number): Vec2 diff --git a/packages/modeling/src/maths/utils/trigonometry.js b/packages/modeling/src/maths/utils/trigonometry.js index 35ff99edb..6e814dab8 100644 --- a/packages/modeling/src/maths/utils/trigonometry.js +++ b/packages/modeling/src/maths/utils/trigonometry.js @@ -9,8 +9,8 @@ const rezero = (n) => Math.abs(n) < NEPS ? 0 : n * Return Math.sin but accurate for TAU / 4 rotations. * Fixes rounding errors when sin should be 0. * - * @param {Number} radians - angle in radians - * @returns {Number} sine of the given angle + * @param {number} radians - angle in radians + * @returns {number} sine of the given angle * @alias module:modeling/utils.sin * @example * sin(TAU / 2) == 0 @@ -22,8 +22,8 @@ export const sin = (radians) => rezero(Math.sin(radians)) * Return Math.cos but accurate for TAU / 4 rotations. * Fixes rounding errors when cos should be 0. * - * @param {Number} radians - angle in radians - * @returns {Number} cosine of the given angle + * @param {number} radians - angle in radians + * @returns {number} cosine of the given angle * @alias module:modeling/utils.cos * @example * cos(TAU * 0.25) == 0 diff --git a/packages/modeling/src/maths/vec2/abs.d.ts b/packages/modeling/src/maths/vec2/abs.d.ts index 63f1e5c47..d2c60ff7a 100644 --- a/packages/modeling/src/maths/vec2/abs.d.ts +++ b/packages/modeling/src/maths/vec2/abs.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function abs(out: Vec2, vector: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/abs.js b/packages/modeling/src/maths/vec2/abs.js index 0b184f182..cddbb6b99 100644 --- a/packages/modeling/src/maths/vec2/abs.js +++ b/packages/modeling/src/maths/vec2/abs.js @@ -1,9 +1,9 @@ /** * Calculates the absolute coordinates of the given vector. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector of reference - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector of reference + * @returns {Vec2} out * @alias module:modeling/maths/vec2.abs */ export const abs = (out, vector) => { diff --git a/packages/modeling/src/maths/vec2/add.d.ts b/packages/modeling/src/maths/vec2/add.d.ts index c142c3043..6441b418b 100644 --- a/packages/modeling/src/maths/vec2/add.d.ts +++ b/packages/modeling/src/maths/vec2/add.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function add(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/add.js b/packages/modeling/src/maths/vec2/add.js index 818473152..2b527823e 100644 --- a/packages/modeling/src/maths/vec2/add.js +++ b/packages/modeling/src/maths/vec2/add.js @@ -1,10 +1,10 @@ /** * Adds the coordinates of two vectors (A+B). * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.add */ export const add = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/angle.d.ts b/packages/modeling/src/maths/vec2/angle.d.ts index 9ab8f5c8a..6d58239f1 100644 --- a/packages/modeling/src/maths/vec2/angle.d.ts +++ b/packages/modeling/src/maths/vec2/angle.d.ts @@ -1 +1 @@ -export { angleRadians as angle } from './angleRadians' +export { angleRadians as angle } from './angleRadians.js' diff --git a/packages/modeling/src/maths/vec2/angleDegrees.d.ts b/packages/modeling/src/maths/vec2/angleDegrees.d.ts index f9c5b10f7..49e6f6d1d 100644 --- a/packages/modeling/src/maths/vec2/angleDegrees.d.ts +++ b/packages/modeling/src/maths/vec2/angleDegrees.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function angleDegrees(vector: Vec2): number diff --git a/packages/modeling/src/maths/vec2/angleDegrees.js b/packages/modeling/src/maths/vec2/angleDegrees.js index 6996cf1df..270809483 100644 --- a/packages/modeling/src/maths/vec2/angleDegrees.js +++ b/packages/modeling/src/maths/vec2/angleDegrees.js @@ -3,8 +3,8 @@ import { angleRadians } from './angleRadians.js' /** * Calculate the angle of the given vector. * - * @param {vec2} vector - vector of reference - * @returns {Number} angle in degrees + * @param {Vec2} vector - vector of reference + * @returns {number} angle in degrees * @alias module:modeling/maths/vec2.angleDegrees */ export const angleDegrees = (vector) => angleRadians(vector) * 57.29577951308232 diff --git a/packages/modeling/src/maths/vec2/angleRadians.d.ts b/packages/modeling/src/maths/vec2/angleRadians.d.ts index fe7398419..45a5f1c89 100644 --- a/packages/modeling/src/maths/vec2/angleRadians.d.ts +++ b/packages/modeling/src/maths/vec2/angleRadians.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function angleRadians(vector: Vec2): number diff --git a/packages/modeling/src/maths/vec2/angleRadians.js b/packages/modeling/src/maths/vec2/angleRadians.js index 3adef53b5..e06d4f0cb 100644 --- a/packages/modeling/src/maths/vec2/angleRadians.js +++ b/packages/modeling/src/maths/vec2/angleRadians.js @@ -1,8 +1,8 @@ /** * Calculate the angle of the given vector. * - * @param {vec2} vector - vector of reference - * @returns {Number} angle in radians + * @param {Vec2} vector - vector of reference + * @returns {number} angle in radians * @alias module:modeling/maths/vec2.angleRadians */ export const angleRadians = (vector) => Math.atan2(vector[1], vector[0]) // y=sin, x=cos diff --git a/packages/modeling/src/maths/vec2/clone.d.ts b/packages/modeling/src/maths/vec2/clone.d.ts index 1f5aaf587..8efdca7ae 100644 --- a/packages/modeling/src/maths/vec2/clone.d.ts +++ b/packages/modeling/src/maths/vec2/clone.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function clone(vec: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/clone.js b/packages/modeling/src/maths/vec2/clone.js index 7b11beac2..e1cf140f5 100644 --- a/packages/modeling/src/maths/vec2/clone.js +++ b/packages/modeling/src/maths/vec2/clone.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Create a clone of the given vector. * - * @param {vec2} vector - vector to clone - * @returns {vec2} a new vector + * @param {Vec2} vector - vector to clone + * @returns {Vec2} a new vector * @alias module:modeling/maths/vec2.clone */ export const clone = (vector) => { diff --git a/packages/modeling/src/maths/vec2/copy.d.ts b/packages/modeling/src/maths/vec2/copy.d.ts index c5d8beec2..ff8ee093f 100644 --- a/packages/modeling/src/maths/vec2/copy.d.ts +++ b/packages/modeling/src/maths/vec2/copy.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function copy(out: Vec2, vector: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/copy.js b/packages/modeling/src/maths/vec2/copy.js index 535369f0d..e6408e18e 100644 --- a/packages/modeling/src/maths/vec2/copy.js +++ b/packages/modeling/src/maths/vec2/copy.js @@ -1,9 +1,9 @@ /** * Create a copy of the given vector. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - source vector - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - source vector + * @returns {Vec2} out * @alias module:modeling/maths/vec2.copy */ export const copy = (out, vector) => { diff --git a/packages/modeling/src/maths/vec2/create.d.ts b/packages/modeling/src/maths/vec2/create.d.ts index d129f44fd..109c477ef 100644 --- a/packages/modeling/src/maths/vec2/create.d.ts +++ b/packages/modeling/src/maths/vec2/create.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function create(): Vec2 diff --git a/packages/modeling/src/maths/vec2/create.js b/packages/modeling/src/maths/vec2/create.js index 15eec125f..ad8dacf42 100644 --- a/packages/modeling/src/maths/vec2/create.js +++ b/packages/modeling/src/maths/vec2/create.js @@ -1,13 +1,12 @@ /** * Represents a two dimensional vector. * See fromValues(). - * @typedef {Array} vec2 */ /** * Creates a new vector, initialized to [0,0]. * - * @returns {vec2} a new vector + * @returns {Vec2} a new vector * @alias module:modeling/maths/vec2.create */ export const create = () => [0, 0] diff --git a/packages/modeling/src/maths/vec2/cross.d.ts b/packages/modeling/src/maths/vec2/cross.d.ts index a091f230d..2c3eec767 100644 --- a/packages/modeling/src/maths/vec2/cross.d.ts +++ b/packages/modeling/src/maths/vec2/cross.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from './type' -import { Vec3 } from '../vec3/type' +import type { Vec2 } from './type.d.ts' +import type { Vec3 } from '../vec3/type.d.ts' export function cross(out: Vec3, a: Vec2, b: Vec2): Vec3 diff --git a/packages/modeling/src/maths/vec2/cross.js b/packages/modeling/src/maths/vec2/cross.js index 1e2ee0f61..bea90b19c 100644 --- a/packages/modeling/src/maths/vec2/cross.js +++ b/packages/modeling/src/maths/vec2/cross.js @@ -1,10 +1,10 @@ /** * Computes the cross product (3D) of two vectors. * - * @param {vec3} out - receiving vector (3D) - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector (3D) + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec2.cross */ export const cross = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/cross.test.js b/packages/modeling/src/maths/vec2/cross.test.js index 4d1a77877..b0dbb6472 100644 --- a/packages/modeling/src/maths/vec2/cross.test.js +++ b/packages/modeling/src/maths/vec2/cross.test.js @@ -1,51 +1,52 @@ import test from 'ava' +import * as vec3 from '../vec3/index.js' import { cross } from './index.js' import { compareVectors } from '../../../test/helpers/index.js' test('vec2: cross() called with three parameters should update a vec2 with correct values', (t) => { - const obs1 = [0, 0, 0] + const obs1 = vec3.create() const ret1 = cross(obs1, [0, 0], [0, 0]) t.true(compareVectors(obs1, [0, 0, 0])) t.true(compareVectors(ret1, [0, 0, 0])) - const obs2 = [0, 0, 0] + const obs2 = vec3.create() const ret2 = cross(obs2, [5, 5], [10, 20]) t.true(compareVectors(obs2, [0, 0, 50])) t.true(compareVectors(ret2, [0, 0, 50])) - const obs3 = [0, 0, 0] + const obs3 = vec3.create() const ret3 = cross(obs3, [5, 5], [10, -20]) t.true(compareVectors(obs3, [0, 0, -150])) t.true(compareVectors(ret3, [0, 0, -150])) - const obs4 = [0, 0, 0] + const obs4 = vec3.create() const ret4 = cross(obs4, [5, 5], [-10, -20]) t.true(compareVectors(obs4, [0, 0, -50])) t.true(compareVectors(ret4, [0, 0, -50])) - const obs5 = [0, 0, 0] + const obs5 = vec3.create() const ret5 = cross(obs5, [5, 5], [-10, 20]) t.true(compareVectors(obs5, [0, 0, 150])) t.true(compareVectors(ret5, [0, 0, 150])) - const obs6 = [0, 0, 0] + const obs6 = vec3.create() const ret6 = cross(obs6, [5, 5], [10, 20]) t.true(compareVectors(obs6, [0, 0, 50])) t.true(compareVectors(ret6, [0, 0, 50])) - const obs7 = [0, 0, 0] + const obs7 = vec3.create() const ret7 = cross(obs7, [5, 5], [10, -20]) t.true(compareVectors(obs7, [0, 0, -150])) t.true(compareVectors(ret7, [0, 0, -150])) - const obs8 = [0, 0, 0] + const obs8 = vec3.create() const ret8 = cross(obs8, [5, 5], [-10, -20]) t.true(compareVectors(obs8, [0, 0, -50])) t.true(compareVectors(ret8, [0, 0, -50])) - const obs9 = [0, 0, 0] + const obs9 = vec3.create() const ret9 = cross(obs9, [5, 5], [-10, 20]) t.true(compareVectors(obs9, [0, 0, 150])) t.true(compareVectors(ret9, [0, 0, 150])) diff --git a/packages/modeling/src/maths/vec2/distance.d.ts b/packages/modeling/src/maths/vec2/distance.d.ts index 04f1287eb..4f4a07642 100644 --- a/packages/modeling/src/maths/vec2/distance.d.ts +++ b/packages/modeling/src/maths/vec2/distance.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function distance(a: Vec2, b: Vec2): number diff --git a/packages/modeling/src/maths/vec2/distance.js b/packages/modeling/src/maths/vec2/distance.js index 40dc82866..03afc9d81 100644 --- a/packages/modeling/src/maths/vec2/distance.js +++ b/packages/modeling/src/maths/vec2/distance.js @@ -1,9 +1,9 @@ /** * Calculates the distance between two vectors. * - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {Number} distance + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {number} distance * @alias module:modeling/maths/vec2.distance */ export const distance = (a, b) => { diff --git a/packages/modeling/src/maths/vec2/divide.d.ts b/packages/modeling/src/maths/vec2/divide.d.ts index eb853047c..8905f3e5c 100644 --- a/packages/modeling/src/maths/vec2/divide.d.ts +++ b/packages/modeling/src/maths/vec2/divide.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function divide(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/divide.js b/packages/modeling/src/maths/vec2/divide.js index c9c7c3edf..ab5b2f116 100644 --- a/packages/modeling/src/maths/vec2/divide.js +++ b/packages/modeling/src/maths/vec2/divide.js @@ -1,10 +1,10 @@ /** * Divides the coordinates of two vectors (A/B). * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.divide */ export const divide = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/dot.d.ts b/packages/modeling/src/maths/vec2/dot.d.ts index dca16448f..8f8518138 100644 --- a/packages/modeling/src/maths/vec2/dot.d.ts +++ b/packages/modeling/src/maths/vec2/dot.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function dot(a: Vec2, b: Vec2): number diff --git a/packages/modeling/src/maths/vec2/dot.js b/packages/modeling/src/maths/vec2/dot.js index 14c690a2e..1183b81cf 100644 --- a/packages/modeling/src/maths/vec2/dot.js +++ b/packages/modeling/src/maths/vec2/dot.js @@ -1,9 +1,9 @@ /** * Calculates the dot product of two vectors. * - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {Number} dot product + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {number} dot product * @alias module:modeling/maths/vec2.dot */ export const dot = (a, b) => a[0] * b[0] + a[1] * b[1] diff --git a/packages/modeling/src/maths/vec2/equals.d.ts b/packages/modeling/src/maths/vec2/equals.d.ts index 813f79dad..5ca47f1b1 100644 --- a/packages/modeling/src/maths/vec2/equals.d.ts +++ b/packages/modeling/src/maths/vec2/equals.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function equals(a: Vec2, b: Vec2): boolean diff --git a/packages/modeling/src/maths/vec2/equals.js b/packages/modeling/src/maths/vec2/equals.js index 96a46a9be..17df3249c 100644 --- a/packages/modeling/src/maths/vec2/equals.js +++ b/packages/modeling/src/maths/vec2/equals.js @@ -1,8 +1,8 @@ /** * Compare the given vectors for equality. * - * @param {vec2} a - first operand - * @param {vec2} b - second operand + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand * @returns {Boolean} true if a and b are equal * @alias module:modeling/maths/vec2.equals */ diff --git a/packages/modeling/src/maths/vec2/fromAngleDegrees.d.ts b/packages/modeling/src/maths/vec2/fromAngleDegrees.d.ts index a54c228ea..0782152ca 100644 --- a/packages/modeling/src/maths/vec2/fromAngleDegrees.d.ts +++ b/packages/modeling/src/maths/vec2/fromAngleDegrees.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function fromAngleDegrees(out: Vec2, degrees: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/fromAngleDegrees.js b/packages/modeling/src/maths/vec2/fromAngleDegrees.js index 349af0696..4de735698 100644 --- a/packages/modeling/src/maths/vec2/fromAngleDegrees.js +++ b/packages/modeling/src/maths/vec2/fromAngleDegrees.js @@ -3,9 +3,9 @@ import { fromAngleRadians } from './fromAngleRadians.js' /** * Create a new vector in the direction of the given angle. * - * @param {vec2} out - receiving vector - * @param {Number} degrees - angle in degrees - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {number} degrees - angle in degrees + * @returns {Vec2} out * @alias module:modeling/maths/vec2.fromAngleDegrees */ export const fromAngleDegrees = (out, degrees) => fromAngleRadians(out, degrees * 0.017453292519943295) diff --git a/packages/modeling/src/maths/vec2/fromAngleRadians.d.ts b/packages/modeling/src/maths/vec2/fromAngleRadians.d.ts index 93f58e20c..bfebd56c7 100644 --- a/packages/modeling/src/maths/vec2/fromAngleRadians.d.ts +++ b/packages/modeling/src/maths/vec2/fromAngleRadians.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function fromAngleRadians(out: Vec2, radians: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/fromAngleRadians.js b/packages/modeling/src/maths/vec2/fromAngleRadians.js index d8766e4e3..34dc01f7c 100644 --- a/packages/modeling/src/maths/vec2/fromAngleRadians.js +++ b/packages/modeling/src/maths/vec2/fromAngleRadians.js @@ -3,9 +3,9 @@ import { sin, cos } from '../utils/trigonometry.js' /** * Create a new vector in the direction of the given angle. * - * @param {vec2} out - receiving vector - * @param {Number} radians - angle in radians - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {number} radians - angle in radians + * @returns {Vec2} out * @alias module:modeling/maths/vec2.fromAngleRadians */ export const fromAngleRadians = (out, radians) => { diff --git a/packages/modeling/src/maths/vec2/fromScalar.d.ts b/packages/modeling/src/maths/vec2/fromScalar.d.ts index 61197e09b..7c9d41314 100644 --- a/packages/modeling/src/maths/vec2/fromScalar.d.ts +++ b/packages/modeling/src/maths/vec2/fromScalar.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function fromScalar(out: Vec2, scalar: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/fromScalar.js b/packages/modeling/src/maths/vec2/fromScalar.js index 2eecd4ecc..7e90abc3c 100644 --- a/packages/modeling/src/maths/vec2/fromScalar.js +++ b/packages/modeling/src/maths/vec2/fromScalar.js @@ -1,9 +1,9 @@ /** * Create a vector from a single scalar value. * - * @param {vec2} out - receiving vector - * @param {Number} scalar - the scalar value - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {number} scalar - the scalar value + * @returns {Vec2} out * @alias module:modeling/maths/vec2.fromScalar */ export const fromScalar = (out, scalar) => { diff --git a/packages/modeling/src/maths/vec2/fromValues.d.ts b/packages/modeling/src/maths/vec2/fromValues.d.ts index aad818ca3..3259d84ce 100644 --- a/packages/modeling/src/maths/vec2/fromValues.d.ts +++ b/packages/modeling/src/maths/vec2/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function fromValues(x: number, y: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/fromValues.js b/packages/modeling/src/maths/vec2/fromValues.js index eeeffce70..a2a8c1c97 100644 --- a/packages/modeling/src/maths/vec2/fromValues.js +++ b/packages/modeling/src/maths/vec2/fromValues.js @@ -3,9 +3,9 @@ import { create } from './create.js' /** * Creates a new vector initialized with the given values. * - * @param {Number} x - X coordinate - * @param {Number} y - Y coordinate - * @returns {vec2} a new vector + * @param {number} x - X coordinate + * @param {number} y - Y coordinate + * @returns {Vec2} a new vector * @alias module:modeling/maths/vec2.fromValues */ export const fromValues = (x, y) => { diff --git a/packages/modeling/src/maths/vec2/index.d.ts b/packages/modeling/src/maths/vec2/index.d.ts index d3c420a89..a61c759ae 100644 --- a/packages/modeling/src/maths/vec2/index.d.ts +++ b/packages/modeling/src/maths/vec2/index.d.ts @@ -1,36 +1,35 @@ -export { abs } from './abs' -export { add } from './add' -export { angle } from './angle' -export { angleDegrees } from './angleDegrees' -export { angleRadians } from './angleRadians' -export { clone } from './clone' -export { copy } from './copy' -export { create } from './create' -export { cross } from './cross' -export { distance } from './distance' -export { divide } from './divide' -export { dot } from './dot' -export { equals } from './equals' -export { fromAngleDegrees } from './fromAngleDegrees' -export { fromAngleRadians } from './fromAngleRadians' -export { fromScalar } from './fromScalar' -export { fromValues } from './fromValues' -export { length } from './length' -export { lerp } from './lerp' -export { max } from './max' -export { min } from './min' -export { multiply } from './multiply' -export { negate } from './negate' -export { normal } from './normal' -export { normalize } from './normalize' -export { rotate } from './rotate' -export { scale } from './scale' -export { snap } from './snap' -export { squaredDistance } from './squaredDistance' -export { squaredLength } from './squaredLength' -export { subtract } from './subtract' -export { toString } from './toString' -export { transform } from './transform' +export { abs } from './abs.js' +export { add } from './add.js' +export { angle } from './angle.js' +export { angleDegrees } from './angleDegrees.js' +export { angleRadians } from './angleRadians.js' +export { clone } from './clone.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { cross } from './cross.js' +export { distance } from './distance.js' +export { divide } from './divide.js' +export { dot } from './dot.js' +export { equals } from './equals.js' +export { fromAngleDegrees } from './fromAngleDegrees.js' +export { fromAngleRadians } from './fromAngleRadians.js' +export { fromScalar } from './fromScalar.js' +export { fromValues } from './fromValues.js' +export { length } from './length.js' +export { lerp } from './lerp.js' +export { max } from './max.js' +export { min } from './min.js' +export { multiply } from './multiply.js' +export { negate } from './negate.js' +export { normal } from './normal.js' +export { normalize } from './normalize.js' +export { rotate } from './rotate.js' +export { scale } from './scale.js' +export { snap } from './snap.js' +export { squaredDistance } from './squaredDistance.js' +export { squaredLength } from './squaredLength.js' +export { subtract } from './subtract.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Vec2 } from './type' -export as namespace vec2 +export type { Vec2 } from './type.d.ts' diff --git a/packages/modeling/src/maths/vec2/length.d.ts b/packages/modeling/src/maths/vec2/length.d.ts index d76313c55..10ec3452e 100644 --- a/packages/modeling/src/maths/vec2/length.d.ts +++ b/packages/modeling/src/maths/vec2/length.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function length(vector: Vec2): number diff --git a/packages/modeling/src/maths/vec2/length.js b/packages/modeling/src/maths/vec2/length.js index 2241baa7a..820ea8b3b 100644 --- a/packages/modeling/src/maths/vec2/length.js +++ b/packages/modeling/src/maths/vec2/length.js @@ -1,8 +1,8 @@ /** * Calculates the length of the given vector. * - * @param {vec2} vector - vector of reference - * @returns {Number} length + * @param {Vec2} vector - vector of reference + * @returns {number} length * @alias module:modeling/maths/vec2.length */ export const length = (vector) => Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]) diff --git a/packages/modeling/src/maths/vec2/lerp.d.ts b/packages/modeling/src/maths/vec2/lerp.d.ts index 8639d6e32..511ced34d 100644 --- a/packages/modeling/src/maths/vec2/lerp.d.ts +++ b/packages/modeling/src/maths/vec2/lerp.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function lerp(out: Vec2, a: Vec2, b: Vec2, t: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/lerp.js b/packages/modeling/src/maths/vec2/lerp.js index 02bf0a90c..52698d35e 100644 --- a/packages/modeling/src/maths/vec2/lerp.js +++ b/packages/modeling/src/maths/vec2/lerp.js @@ -1,11 +1,11 @@ /** * Performs a linear interpolation between two vectors. * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @param {Number} t - interpolation amount between the two vectors - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @param {number} t - interpolation amount between the two vectors + * @returns {Vec2} out * @alias module:modeling/maths/vec2.lerp */ export const lerp = (out, a, b, t) => { diff --git a/packages/modeling/src/maths/vec2/max.d.ts b/packages/modeling/src/maths/vec2/max.d.ts index ce41ddffa..304b960dd 100644 --- a/packages/modeling/src/maths/vec2/max.d.ts +++ b/packages/modeling/src/maths/vec2/max.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function max(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/max.js b/packages/modeling/src/maths/vec2/max.js index abfbb2c9b..bed04406f 100644 --- a/packages/modeling/src/maths/vec2/max.js +++ b/packages/modeling/src/maths/vec2/max.js @@ -1,10 +1,10 @@ /** * Returns the maximum coordinates of two vectors. * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.max */ export const max = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/min.d.ts b/packages/modeling/src/maths/vec2/min.d.ts index 1160205d6..29b8aa580 100644 --- a/packages/modeling/src/maths/vec2/min.d.ts +++ b/packages/modeling/src/maths/vec2/min.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function min(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/min.js b/packages/modeling/src/maths/vec2/min.js index e9307f6be..9b4a753c1 100644 --- a/packages/modeling/src/maths/vec2/min.js +++ b/packages/modeling/src/maths/vec2/min.js @@ -1,10 +1,10 @@ /** * Returns the minimum coordinates of two vectors. * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.min */ export const min = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/multiply.d.ts b/packages/modeling/src/maths/vec2/multiply.d.ts index ddef60dde..453e0c144 100644 --- a/packages/modeling/src/maths/vec2/multiply.d.ts +++ b/packages/modeling/src/maths/vec2/multiply.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function multiply(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/multiply.js b/packages/modeling/src/maths/vec2/multiply.js index 6c763fa54..add527400 100644 --- a/packages/modeling/src/maths/vec2/multiply.js +++ b/packages/modeling/src/maths/vec2/multiply.js @@ -1,10 +1,10 @@ /** * Multiplies the coordinates of two vectors (A*B). * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.multiply */ export const multiply = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/negate.d.ts b/packages/modeling/src/maths/vec2/negate.d.ts index 2dbcb0d78..6b04df05d 100644 --- a/packages/modeling/src/maths/vec2/negate.d.ts +++ b/packages/modeling/src/maths/vec2/negate.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function negate(out: Vec2, vec: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/negate.js b/packages/modeling/src/maths/vec2/negate.js index f2b1e1229..020900a14 100644 --- a/packages/modeling/src/maths/vec2/negate.js +++ b/packages/modeling/src/maths/vec2/negate.js @@ -1,9 +1,9 @@ /** * Negates the coordinates of the given vector. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to negate - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to negate + * @returns {Vec2} out * @alias module:modeling/maths/vec2.negate */ export const negate = (out, vector) => { diff --git a/packages/modeling/src/maths/vec2/normal.d.ts b/packages/modeling/src/maths/vec2/normal.d.ts index 24c7156dd..2203766eb 100644 --- a/packages/modeling/src/maths/vec2/normal.d.ts +++ b/packages/modeling/src/maths/vec2/normal.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function normal(out: Vec2, vec: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/normal.js b/packages/modeling/src/maths/vec2/normal.js index c08a70b0c..67a094885 100644 --- a/packages/modeling/src/maths/vec2/normal.js +++ b/packages/modeling/src/maths/vec2/normal.js @@ -7,9 +7,9 @@ import { rotate } from './rotate.js' * Calculates the normal of the given vector. * The normal value is the given vector rotated 90 degrees. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - given value - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - given value + * @returns {Vec2} out * @alias module:modeling/maths/vec2.normal */ export const normal = (out, vector) => rotate(out, vector, create(), (TAU / 4)) diff --git a/packages/modeling/src/maths/vec2/normalize.d.ts b/packages/modeling/src/maths/vec2/normalize.d.ts index c2858794b..ec2f8938d 100644 --- a/packages/modeling/src/maths/vec2/normalize.d.ts +++ b/packages/modeling/src/maths/vec2/normalize.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function normalize(out: Vec2, vector: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/normalize.js b/packages/modeling/src/maths/vec2/normalize.js index 6030ea677..c80c0391f 100644 --- a/packages/modeling/src/maths/vec2/normalize.js +++ b/packages/modeling/src/maths/vec2/normalize.js @@ -1,9 +1,9 @@ /** * Normalize the given vector. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to normalize - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to normalize + * @returns {Vec2} out * @alias module:modeling/maths/vec2.normalize */ export const normalize = (out, vector) => { diff --git a/packages/modeling/src/maths/vec2/rotate.d.ts b/packages/modeling/src/maths/vec2/rotate.d.ts index 568e8b9ec..e50f34ea4 100644 --- a/packages/modeling/src/maths/vec2/rotate.d.ts +++ b/packages/modeling/src/maths/vec2/rotate.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function rotate(out: Vec2, vector: Vec2, origin: Vec2, angle: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/rotate.js b/packages/modeling/src/maths/vec2/rotate.js index 39cbc5f40..5d6622712 100644 --- a/packages/modeling/src/maths/vec2/rotate.js +++ b/packages/modeling/src/maths/vec2/rotate.js @@ -1,11 +1,11 @@ /** * Rotates the given vector by the given angle. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to rotate - * @param {vec2} origin - origin of the rotation - * @param {Number} radians - angle of rotation (radians) - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to rotate + * @param {Vec2} origin - origin of the rotation + * @param {number} radians - angle of rotation (radians) + * @returns {Vec2} out * @alias module:modeling/maths/vec2.rotate */ export const rotate = (out, vector, origin, radians) => { diff --git a/packages/modeling/src/maths/vec2/scale.d.ts b/packages/modeling/src/maths/vec2/scale.d.ts index 64010f82b..1c5786e7e 100644 --- a/packages/modeling/src/maths/vec2/scale.d.ts +++ b/packages/modeling/src/maths/vec2/scale.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function scale(out: Vec2, vector: Vec2, amount: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/scale.js b/packages/modeling/src/maths/vec2/scale.js index 4fee91f32..fc3c8a21e 100644 --- a/packages/modeling/src/maths/vec2/scale.js +++ b/packages/modeling/src/maths/vec2/scale.js @@ -1,10 +1,10 @@ /** * Scales the coordinates of the given vector. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to scale - * @param {Number} amount - amount to scale - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to scale + * @param {number} amount - amount to scale + * @returns {Vec2} out * @alias module:modeling/maths/vec2.scale */ export const scale = (out, vector, amount) => { diff --git a/packages/modeling/src/maths/vec2/snap.d.ts b/packages/modeling/src/maths/vec2/snap.d.ts index 1cc4ea454..f83acdb37 100644 --- a/packages/modeling/src/maths/vec2/snap.d.ts +++ b/packages/modeling/src/maths/vec2/snap.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function snap(out: Vec2, vector: Vec2, epsilon: number): Vec2 diff --git a/packages/modeling/src/maths/vec2/snap.js b/packages/modeling/src/maths/vec2/snap.js index 696a9dd71..73636b87b 100644 --- a/packages/modeling/src/maths/vec2/snap.js +++ b/packages/modeling/src/maths/vec2/snap.js @@ -1,10 +1,10 @@ /** * Snaps the coordinates of the given vector to the given epsilon. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to snap - * @param {Number} epsilon - epsilon of precision, less than 0 - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to snap + * @param {number} epsilon - epsilon of precision, less than 0 + * @returns {Vec2} out * @alias module:modeling/maths/vec2.snap */ export const snap = (out, vector, epsilon) => { diff --git a/packages/modeling/src/maths/vec2/squaredDistance.d.ts b/packages/modeling/src/maths/vec2/squaredDistance.d.ts index ce3bcf355..cbca2144a 100644 --- a/packages/modeling/src/maths/vec2/squaredDistance.d.ts +++ b/packages/modeling/src/maths/vec2/squaredDistance.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function squaredDistance(a: Vec2, b: Vec2): number diff --git a/packages/modeling/src/maths/vec2/squaredDistance.js b/packages/modeling/src/maths/vec2/squaredDistance.js index 6bffa1e67..904df3224 100644 --- a/packages/modeling/src/maths/vec2/squaredDistance.js +++ b/packages/modeling/src/maths/vec2/squaredDistance.js @@ -1,9 +1,9 @@ /** * Calculates the squared distance between the given vectors. * - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {Number} squared distance + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {number} squared distance * @alias module:modeling/maths/vec2.squaredDistance */ export const squaredDistance = (a, b) => { diff --git a/packages/modeling/src/maths/vec2/squaredLength.d.ts b/packages/modeling/src/maths/vec2/squaredLength.d.ts index 83deac0f1..5426d104f 100644 --- a/packages/modeling/src/maths/vec2/squaredLength.d.ts +++ b/packages/modeling/src/maths/vec2/squaredLength.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function squaredLength(vector: Vec2): number diff --git a/packages/modeling/src/maths/vec2/squaredLength.js b/packages/modeling/src/maths/vec2/squaredLength.js index 09b93d32d..5a6382fd8 100644 --- a/packages/modeling/src/maths/vec2/squaredLength.js +++ b/packages/modeling/src/maths/vec2/squaredLength.js @@ -1,8 +1,8 @@ /** * Calculates the squared length of the given vector. * - * @param {vec2} vector - vector of reference - * @returns {Number} squared length + * @param {Vec2} vector - vector of reference + * @returns {number} squared length * @alias module:modeling/maths/vec2.squaredLength */ export const squaredLength = (vector) => { diff --git a/packages/modeling/src/maths/vec2/subtract.d.ts b/packages/modeling/src/maths/vec2/subtract.d.ts index c206faccf..a5e39c715 100644 --- a/packages/modeling/src/maths/vec2/subtract.d.ts +++ b/packages/modeling/src/maths/vec2/subtract.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function subtract(out: Vec2, a: Vec2, b: Vec2): Vec2 diff --git a/packages/modeling/src/maths/vec2/subtract.js b/packages/modeling/src/maths/vec2/subtract.js index 80e8ab091..ff79e0024 100644 --- a/packages/modeling/src/maths/vec2/subtract.js +++ b/packages/modeling/src/maths/vec2/subtract.js @@ -1,10 +1,10 @@ /** * Subtracts the coordinates of two vectors (A-B). * - * @param {vec2} out - receiving vector - * @param {vec2} a - first operand - * @param {vec2} b - second operand - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} a - first operand + * @param {Vec2} b - second operand + * @returns {Vec2} out * @alias module:modeling/maths/vec2.subtract */ export const subtract = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec2/toString.d.ts b/packages/modeling/src/maths/vec2/toString.d.ts index ae387ea82..4574ff3e9 100644 --- a/packages/modeling/src/maths/vec2/toString.d.ts +++ b/packages/modeling/src/maths/vec2/toString.d.ts @@ -1,3 +1,3 @@ -import { Vec2 } from './type' +import type { Vec2 } from './type.d.ts' export function toString(vec: Vec2): string diff --git a/packages/modeling/src/maths/vec2/toString.js b/packages/modeling/src/maths/vec2/toString.js index d74e77c3f..cbb0ad69b 100644 --- a/packages/modeling/src/maths/vec2/toString.js +++ b/packages/modeling/src/maths/vec2/toString.js @@ -1,8 +1,8 @@ /** * Convert the given vector to a representative string. * - * @param {vec2} vector - vector of reference - * @returns {String} string representation + * @param {Vec2} vector - vector of reference + * @returns {string} string representation * @alias module:modeling/maths/vec2.toString */ export const toString = (vector) => `[${vector[0].toFixed(7)}, ${vector[1].toFixed(7)}]` diff --git a/packages/modeling/src/maths/vec2/transform.d.ts b/packages/modeling/src/maths/vec2/transform.d.ts index b21b361fe..d283a7a89 100644 --- a/packages/modeling/src/maths/vec2/transform.d.ts +++ b/packages/modeling/src/maths/vec2/transform.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from './type' -import { Mat4 } from '../mat4/type' +import type { Vec2 } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Vec2, vector: Vec2, matrix: Mat4): Vec2 diff --git a/packages/modeling/src/maths/vec2/transform.js b/packages/modeling/src/maths/vec2/transform.js index cb877e665..c24ed3890 100644 --- a/packages/modeling/src/maths/vec2/transform.js +++ b/packages/modeling/src/maths/vec2/transform.js @@ -1,10 +1,10 @@ /** * Transforms the given vector using the given matrix. * - * @param {vec2} out - receiving vector - * @param {vec2} vector - vector to transform - * @param {mat4} matrix - matrix to transform with - * @returns {vec2} out + * @param {Vec2} out - receiving vector + * @param {Vec2} vector - vector to transform + * @param {Mat4} matrix - matrix to transform with + * @returns {Vec2} out * @alias module:modeling/maths/vec2.transform */ export const transform = (out, vector, matrix) => { diff --git a/packages/modeling/src/maths/vec3/abs.d.ts b/packages/modeling/src/maths/vec3/abs.d.ts index e724b1e72..5f7ee026d 100644 --- a/packages/modeling/src/maths/vec3/abs.d.ts +++ b/packages/modeling/src/maths/vec3/abs.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function abs(out: Vec3, vector: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/abs.js b/packages/modeling/src/maths/vec3/abs.js index d4acde52e..50b698120 100644 --- a/packages/modeling/src/maths/vec3/abs.js +++ b/packages/modeling/src/maths/vec3/abs.js @@ -1,9 +1,9 @@ /** * Calculates the absolute coordinates of the give vector. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector of reference - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector of reference + * @returns {Vec3} out * @alias module:modeling/maths/vec3.abs */ export const abs = (out, vector) => { diff --git a/packages/modeling/src/maths/vec3/add.d.ts b/packages/modeling/src/maths/vec3/add.d.ts index 5b207adfe..63af3316e 100644 --- a/packages/modeling/src/maths/vec3/add.d.ts +++ b/packages/modeling/src/maths/vec3/add.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function add(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/add.js b/packages/modeling/src/maths/vec3/add.js index f2505188f..39edfecba 100644 --- a/packages/modeling/src/maths/vec3/add.js +++ b/packages/modeling/src/maths/vec3/add.js @@ -1,10 +1,10 @@ /** * Adds the coordinates of two vectors (A+B). * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec3.add */ export const add = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/angle.d.ts b/packages/modeling/src/maths/vec3/angle.d.ts index 322b261c0..06ae21285 100644 --- a/packages/modeling/src/maths/vec3/angle.d.ts +++ b/packages/modeling/src/maths/vec3/angle.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function angle(a: Vec3, b: Vec3): number diff --git a/packages/modeling/src/maths/vec3/angle.js b/packages/modeling/src/maths/vec3/angle.js index fd8fefd88..4bbc9955c 100644 --- a/packages/modeling/src/maths/vec3/angle.js +++ b/packages/modeling/src/maths/vec3/angle.js @@ -3,9 +3,9 @@ import { dot } from './dot.js' /** * Calculate the angle between two vectors. * - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {Number} angle (radians) + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {number} angle (radians) * @alias module:modeling/maths/vec3.angle */ export const angle = (a, b) => { diff --git a/packages/modeling/src/maths/vec3/clone.d.ts b/packages/modeling/src/maths/vec3/clone.d.ts index 447f8c52c..81ff839c1 100644 --- a/packages/modeling/src/maths/vec3/clone.d.ts +++ b/packages/modeling/src/maths/vec3/clone.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function clone(vector: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/clone.js b/packages/modeling/src/maths/vec3/clone.js index 9a0196893..be52af678 100644 --- a/packages/modeling/src/maths/vec3/clone.js +++ b/packages/modeling/src/maths/vec3/clone.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Create a clone of the given vector. * - * @param {vec3} vector - vector to clone - * @returns {vec3} a new vector + * @param {Vec3} vector - vector to clone + * @returns {Vec3} a new vector * @alias module:modeling/maths/vec3.clone */ export const clone = (vector) => { diff --git a/packages/modeling/src/maths/vec3/copy.d.ts b/packages/modeling/src/maths/vec3/copy.d.ts index f7628ccd5..27e88a0dd 100644 --- a/packages/modeling/src/maths/vec3/copy.d.ts +++ b/packages/modeling/src/maths/vec3/copy.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function copy(out: Vec3, vector: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/copy.js b/packages/modeling/src/maths/vec3/copy.js index 421ba03f8..320de2824 100644 --- a/packages/modeling/src/maths/vec3/copy.js +++ b/packages/modeling/src/maths/vec3/copy.js @@ -1,9 +1,9 @@ /** * Create a copy of the given vector. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to copy - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to copy + * @returns {Vec3} out * @alias module:modeling/maths/vec3.copy */ export const copy = (out, vector) => { diff --git a/packages/modeling/src/maths/vec3/create.d.ts b/packages/modeling/src/maths/vec3/create.d.ts index feb42984b..01981e187 100644 --- a/packages/modeling/src/maths/vec3/create.d.ts +++ b/packages/modeling/src/maths/vec3/create.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function create(): Vec3 diff --git a/packages/modeling/src/maths/vec3/create.js b/packages/modeling/src/maths/vec3/create.js index 714d062de..5fd596008 100644 --- a/packages/modeling/src/maths/vec3/create.js +++ b/packages/modeling/src/maths/vec3/create.js @@ -1,13 +1,12 @@ /** * Represents a three dimensional vector. * See fromValues(). - * @typedef {Array} vec3 */ /** * Creates a new vector initialized to [0,0,0]. * - * @returns {vec3} a new vector + * @returns {Vec3} a new vector * @alias module:modeling/maths/vec3.create */ export const create = () => [0, 0, 0] diff --git a/packages/modeling/src/maths/vec3/cross.d.ts b/packages/modeling/src/maths/vec3/cross.d.ts index 85741ca93..41f8fd9c5 100644 --- a/packages/modeling/src/maths/vec3/cross.d.ts +++ b/packages/modeling/src/maths/vec3/cross.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function cross(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/cross.js b/packages/modeling/src/maths/vec3/cross.js index f79182d84..736e0ace5 100644 --- a/packages/modeling/src/maths/vec3/cross.js +++ b/packages/modeling/src/maths/vec3/cross.js @@ -1,10 +1,10 @@ /** * Computes the cross product of the given vectors (AxB). * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec3.cross */ export const cross = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/distance.d.ts b/packages/modeling/src/maths/vec3/distance.d.ts index fee0dc168..0adeff36f 100644 --- a/packages/modeling/src/maths/vec3/distance.d.ts +++ b/packages/modeling/src/maths/vec3/distance.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function distance(a: Vec3, b: Vec3): number diff --git a/packages/modeling/src/maths/vec3/distance.js b/packages/modeling/src/maths/vec3/distance.js index 96e4a4286..5de5b287e 100644 --- a/packages/modeling/src/maths/vec3/distance.js +++ b/packages/modeling/src/maths/vec3/distance.js @@ -1,9 +1,9 @@ /** * Calculates the Euclidian distance between the given vectors. * - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {Number} distance + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {number} distance * @alias module:modeling/maths/vec3.distance */ export const distance = (a, b) => { diff --git a/packages/modeling/src/maths/vec3/divide.d.ts b/packages/modeling/src/maths/vec3/divide.d.ts index 1bdd3c0b7..ea4b8d682 100644 --- a/packages/modeling/src/maths/vec3/divide.d.ts +++ b/packages/modeling/src/maths/vec3/divide.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function divide(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/divide.js b/packages/modeling/src/maths/vec3/divide.js index 876e43686..e7a55ab2d 100644 --- a/packages/modeling/src/maths/vec3/divide.js +++ b/packages/modeling/src/maths/vec3/divide.js @@ -1,10 +1,10 @@ /** * Divides the coordinates of two vectors (A/B). * - * @param {vec3} out - receiving vector - * @param {vec3} a - dividend vector - * @param {vec3} b - divisor vector - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - dividend vector + * @param {Vec3} b - divisor vector + * @returns {Vec3} out * @alias module:modeling/maths/vec3.divide */ export const divide = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/dot.d.ts b/packages/modeling/src/maths/vec3/dot.d.ts index 34bf9caa6..edc83ea91 100644 --- a/packages/modeling/src/maths/vec3/dot.d.ts +++ b/packages/modeling/src/maths/vec3/dot.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function dot(a: Vec3, b: Vec3): number diff --git a/packages/modeling/src/maths/vec3/dot.js b/packages/modeling/src/maths/vec3/dot.js index 1cf8419df..410abc222 100644 --- a/packages/modeling/src/maths/vec3/dot.js +++ b/packages/modeling/src/maths/vec3/dot.js @@ -1,9 +1,9 @@ /** * Calculates the dot product of two vectors. * - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {Number} dot product + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {number} dot product * @alias module:modeling/maths/vec3.dot */ export const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2] diff --git a/packages/modeling/src/maths/vec3/equals.d.ts b/packages/modeling/src/maths/vec3/equals.d.ts index d352e581f..35f2f7562 100644 --- a/packages/modeling/src/maths/vec3/equals.d.ts +++ b/packages/modeling/src/maths/vec3/equals.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function equals(a: Vec3, b: Vec3): boolean diff --git a/packages/modeling/src/maths/vec3/equals.js b/packages/modeling/src/maths/vec3/equals.js index 82343958b..5675fb143 100644 --- a/packages/modeling/src/maths/vec3/equals.js +++ b/packages/modeling/src/maths/vec3/equals.js @@ -1,8 +1,8 @@ /** * Compare the given vectors for equality. * - * @param {vec3} a - first operand - * @param {vec3} b - second operand + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand * @returns {Boolean} true if a and b are equal * @alias module:modeling/maths/vec3.equals */ diff --git a/packages/modeling/src/maths/vec3/fromScalar.d.ts b/packages/modeling/src/maths/vec3/fromScalar.d.ts index dc4772ce3..8cb22f34b 100644 --- a/packages/modeling/src/maths/vec3/fromScalar.d.ts +++ b/packages/modeling/src/maths/vec3/fromScalar.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function fromScalar(out: Vec3, scalar: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/fromScalar.js b/packages/modeling/src/maths/vec3/fromScalar.js index faf3eb580..c5799cc3b 100644 --- a/packages/modeling/src/maths/vec3/fromScalar.js +++ b/packages/modeling/src/maths/vec3/fromScalar.js @@ -2,9 +2,9 @@ * Creates a vector from a single scalar value. * All components of the resulting vector have the given value. * - * @param {vec3} out - receiving vector - * @param {Number} scalar - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {number} scalar + * @returns {Vec3} out * @alias module:modeling/maths/vec3.fromScalar */ export const fromScalar = (out, scalar) => { diff --git a/packages/modeling/src/maths/vec3/fromValues.d.ts b/packages/modeling/src/maths/vec3/fromValues.d.ts index 623ef574c..61ce112ff 100644 --- a/packages/modeling/src/maths/vec3/fromValues.d.ts +++ b/packages/modeling/src/maths/vec3/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function fromValues(x: number, y: number, z: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/fromValues.js b/packages/modeling/src/maths/vec3/fromValues.js index bf37b8be5..4fc846e57 100644 --- a/packages/modeling/src/maths/vec3/fromValues.js +++ b/packages/modeling/src/maths/vec3/fromValues.js @@ -3,10 +3,10 @@ import { create } from './create.js' /** * Creates a new vector initialized with the given values. * - * @param {Number} x - X component - * @param {Number} y - Y component - * @param {Number} z - Z component - * @returns {vec3} a new vector + * @param {number} x - X component + * @param {number} y - Y component + * @param {number} z - Z component + * @returns {Vec3} a new vector * @alias module:modeling/maths/vec3.fromValues */ export const fromValues = (x, y, z) => { diff --git a/packages/modeling/src/maths/vec3/fromVec2.d.ts b/packages/modeling/src/maths/vec3/fromVec2.d.ts index 0b60317c6..40c513200 100644 --- a/packages/modeling/src/maths/vec3/fromVec2.d.ts +++ b/packages/modeling/src/maths/vec3/fromVec2.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from './type' -import { Vec2 } from '../vec2/type' +import type { Vec3 } from './type.d.ts' +import type { Vec2 } from '../vec2/type.d.ts' export function fromVec2(out: Vec3, vector: Vec2, z?: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/fromVec2.js b/packages/modeling/src/maths/vec3/fromVec2.js index d7bd37c39..c84c2b9e6 100644 --- a/packages/modeling/src/maths/vec3/fromVec2.js +++ b/packages/modeling/src/maths/vec3/fromVec2.js @@ -1,10 +1,10 @@ /** * Create a new vector by extending a 2D vector with a Z value. * - * @param {vec3} out - receiving vector + * @param {Vec3} out - receiving vector * @param {Array} vector - 2D vector of values - * @param {Number} [z=0] - Z value - * @returns {vec3} out + * @param {number} [z=0] - Z value + * @returns {Vec3} out * @alias module:modeling/maths/vec3.fromVec2 */ export const fromVec2 = (out, vector, z = 0) => { diff --git a/packages/modeling/src/maths/vec3/index.d.ts b/packages/modeling/src/maths/vec3/index.d.ts index f90701ad5..c0b1e45a8 100644 --- a/packages/modeling/src/maths/vec3/index.d.ts +++ b/packages/modeling/src/maths/vec3/index.d.ts @@ -1,35 +1,34 @@ -export { abs } from './abs' -export { add } from './add' -export { angle } from './angle' -export { clone } from './clone' -export { copy } from './copy' -export { create } from './create' -export { cross } from './cross' -export { distance } from './distance' -export { divide } from './divide' -export { dot } from './dot' -export { equals } from './equals' -export { fromScalar } from './fromScalar' -export { fromValues } from './fromValues' -export { fromVec2 } from './fromVec2' -export { length } from './length' -export { lerp } from './lerp' -export { max } from './max' -export { min } from './min' -export { multiply } from './multiply' -export { negate } from './negate' -export { normalize } from './normalize' -export { orthogonal } from './orthogonal' -export { rotateX } from './rotateX' -export { rotateY } from './rotateY' -export { rotateZ } from './rotateZ' -export { scale } from './scale' -export { snap } from './snap' -export { squaredDistance } from './squaredDistance' -export { squaredLength } from './squaredLength' -export { subtract } from './subtract' -export { toString } from './toString' -export { transform } from './transform' +export { abs } from './abs.js' +export { add } from './add.js' +export { angle } from './angle.js' +export { clone } from './clone.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { cross } from './cross.js' +export { distance } from './distance.js' +export { divide } from './divide.js' +export { dot } from './dot.js' +export { equals } from './equals.js' +export { fromScalar } from './fromScalar.js' +export { fromValues } from './fromValues.js' +export { fromVec2 } from './fromVec2.js' +export { length } from './length.js' +export { lerp } from './lerp.js' +export { max } from './max.js' +export { min } from './min.js' +export { multiply } from './multiply.js' +export { negate } from './negate.js' +export { normalize } from './normalize.js' +export { orthogonal } from './orthogonal.js' +export { rotateX } from './rotateX.js' +export { rotateY } from './rotateY.js' +export { rotateZ } from './rotateZ.js' +export { scale } from './scale.js' +export { snap } from './snap.js' +export { squaredDistance } from './squaredDistance.js' +export { squaredLength } from './squaredLength.js' +export { subtract } from './subtract.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Vec3 } from './type' -export as namespace vec3 +export type { Vec3 } from './type.d.ts' diff --git a/packages/modeling/src/maths/vec3/length.d.ts b/packages/modeling/src/maths/vec3/length.d.ts index f62a38508..0f5f6a2dd 100644 --- a/packages/modeling/src/maths/vec3/length.d.ts +++ b/packages/modeling/src/maths/vec3/length.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function length(vector: Vec3): number diff --git a/packages/modeling/src/maths/vec3/length.js b/packages/modeling/src/maths/vec3/length.js index a95a0d4a7..12f84b5ff 100644 --- a/packages/modeling/src/maths/vec3/length.js +++ b/packages/modeling/src/maths/vec3/length.js @@ -1,8 +1,8 @@ /** * Calculates the length of a vector. * - * @param {vec3} vector - vector to calculate length of - * @returns {Number} length + * @param {Vec3} vector - vector to calculate length of + * @returns {number} length * @alias module:modeling/maths/vec3.length */ export const length = (vector) => { diff --git a/packages/modeling/src/maths/vec3/lerp.d.ts b/packages/modeling/src/maths/vec3/lerp.d.ts index 483f50263..544ea23ef 100644 --- a/packages/modeling/src/maths/vec3/lerp.d.ts +++ b/packages/modeling/src/maths/vec3/lerp.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function lerp(out: Vec3, a: Vec3, b: Vec3, t: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/lerp.js b/packages/modeling/src/maths/vec3/lerp.js index d1b896c67..f15eceae5 100644 --- a/packages/modeling/src/maths/vec3/lerp.js +++ b/packages/modeling/src/maths/vec3/lerp.js @@ -1,11 +1,11 @@ /** * Performs a linear interpolation between two vectors. * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @param {Number} t - interpolant (0.0 to 1.0) applied between the two inputs - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @param {number} t - interpolant (0.0 to 1.0) applied between the two inputs + * @returns {Vec3} out * @alias module:modeling/maths/vec3.lerp */ export const lerp = (out, a, b, t) => { diff --git a/packages/modeling/src/maths/vec3/max.d.ts b/packages/modeling/src/maths/vec3/max.d.ts index cab75cc56..1863ab6bb 100644 --- a/packages/modeling/src/maths/vec3/max.d.ts +++ b/packages/modeling/src/maths/vec3/max.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function max(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/max.js b/packages/modeling/src/maths/vec3/max.js index 164fa07f7..b0751b82c 100644 --- a/packages/modeling/src/maths/vec3/max.js +++ b/packages/modeling/src/maths/vec3/max.js @@ -1,10 +1,10 @@ /** * Returns the maximum coordinates of the given vectors. * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec3.max */ export const max = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/min.d.ts b/packages/modeling/src/maths/vec3/min.d.ts index 1e5fe0685..c7e06fb0b 100644 --- a/packages/modeling/src/maths/vec3/min.d.ts +++ b/packages/modeling/src/maths/vec3/min.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function min(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/min.js b/packages/modeling/src/maths/vec3/min.js index 0f4734dc7..d4797f78b 100644 --- a/packages/modeling/src/maths/vec3/min.js +++ b/packages/modeling/src/maths/vec3/min.js @@ -1,10 +1,10 @@ /** * Returns the minimum coordinates of the given vectors. * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec3.min */ export const min = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/multiply.d.ts b/packages/modeling/src/maths/vec3/multiply.d.ts index 766bc946b..ad6505fe5 100644 --- a/packages/modeling/src/maths/vec3/multiply.d.ts +++ b/packages/modeling/src/maths/vec3/multiply.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function multiply(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/multiply.js b/packages/modeling/src/maths/vec3/multiply.js index 1ca9c46fc..45d32a0d7 100644 --- a/packages/modeling/src/maths/vec3/multiply.js +++ b/packages/modeling/src/maths/vec3/multiply.js @@ -1,10 +1,10 @@ /** * Multiply the coordinates of the given vectors (A*B). * - * @param {vec3} out - receiving vector - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {Vec3} out * @alias module:modeling/maths/vec3.multiply */ export const multiply = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/negate.d.ts b/packages/modeling/src/maths/vec3/negate.d.ts index 42d635d99..41ab9fc22 100644 --- a/packages/modeling/src/maths/vec3/negate.d.ts +++ b/packages/modeling/src/maths/vec3/negate.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function negate(out: Vec3, vector: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/negate.js b/packages/modeling/src/maths/vec3/negate.js index e3b6fa04c..e67f2390f 100644 --- a/packages/modeling/src/maths/vec3/negate.js +++ b/packages/modeling/src/maths/vec3/negate.js @@ -1,9 +1,9 @@ /** * Negates the coordinates of the given vector. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to negate - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to negate + * @returns {Vec3} out * @alias module:modeling/maths/vec3.negate */ export const negate = (out, vector) => { diff --git a/packages/modeling/src/maths/vec3/normalize.d.ts b/packages/modeling/src/maths/vec3/normalize.d.ts index 7cc795cfc..e956ffa13 100644 --- a/packages/modeling/src/maths/vec3/normalize.d.ts +++ b/packages/modeling/src/maths/vec3/normalize.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function normalize(out: Vec3, vector: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/normalize.js b/packages/modeling/src/maths/vec3/normalize.js index 701819b01..f3f6c6972 100644 --- a/packages/modeling/src/maths/vec3/normalize.js +++ b/packages/modeling/src/maths/vec3/normalize.js @@ -1,9 +1,9 @@ /** * Normalize the given vector. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to normalize - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to normalize + * @returns {Vec3} out * @alias module:modeling/maths/vec3.normalize */ export const normalize = (out, vector) => { diff --git a/packages/modeling/src/maths/vec3/orthogonal.d.ts b/packages/modeling/src/maths/vec3/orthogonal.d.ts index e1e19d6b2..53bee065e 100644 --- a/packages/modeling/src/maths/vec3/orthogonal.d.ts +++ b/packages/modeling/src/maths/vec3/orthogonal.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function orthogonal(out: Vec3, vec: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/orthogonal.js b/packages/modeling/src/maths/vec3/orthogonal.js index 5e0fe5750..f93c9718d 100644 --- a/packages/modeling/src/maths/vec3/orthogonal.js +++ b/packages/modeling/src/maths/vec3/orthogonal.js @@ -5,9 +5,9 @@ import { cross } from './cross.js' /** * Create a new vector that is orthogonal to the given vector. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector of reference - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector of reference + * @returns {Vec3} out * @alias module:modeling/maths/vec3.orthogonal */ export const orthogonal = (out, vector) => { diff --git a/packages/modeling/src/maths/vec3/rotateX.d.ts b/packages/modeling/src/maths/vec3/rotateX.d.ts index 3c9ae7ba3..11c3b16eb 100644 --- a/packages/modeling/src/maths/vec3/rotateX.d.ts +++ b/packages/modeling/src/maths/vec3/rotateX.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function rotateX(out: Vec3, vector: Vec3, origin: Vec3, angle: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/rotateX.js b/packages/modeling/src/maths/vec3/rotateX.js index 4b7846c09..c24fa16e5 100644 --- a/packages/modeling/src/maths/vec3/rotateX.js +++ b/packages/modeling/src/maths/vec3/rotateX.js @@ -1,11 +1,11 @@ /** * Rotate the given vector around the given origin, X axis only. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to rotate - * @param {vec3} origin - origin of the rotation - * @param {Number} radians - angle of rotation - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to rotate + * @param {Vec3} origin - origin of the rotation + * @param {number} radians - angle of rotation + * @returns {Vec3} out * @alias module:modeling/maths/vec3.rotateX */ export const rotateX = (out, vector, origin, radians) => { diff --git a/packages/modeling/src/maths/vec3/rotateY.d.ts b/packages/modeling/src/maths/vec3/rotateY.d.ts index 2605110c6..12559949d 100644 --- a/packages/modeling/src/maths/vec3/rotateY.d.ts +++ b/packages/modeling/src/maths/vec3/rotateY.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function rotateY(out: Vec3, vector: Vec3, origin: Vec3, angle: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/rotateY.js b/packages/modeling/src/maths/vec3/rotateY.js index b563cba76..ef7ff61d4 100644 --- a/packages/modeling/src/maths/vec3/rotateY.js +++ b/packages/modeling/src/maths/vec3/rotateY.js @@ -1,11 +1,11 @@ /** * Rotate the given vector around the given origin, Y axis only. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to rotate - * @param {vec3} origin - origin of the rotation - * @param {Number} radians - angle of rotation - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to rotate + * @param {Vec3} origin - origin of the rotation + * @param {number} radians - angle of rotation + * @returns {Vec3} out * @alias module:modeling/maths/vec3.rotateY */ export const rotateY = (out, vector, origin, radians) => { diff --git a/packages/modeling/src/maths/vec3/rotateZ.d.ts b/packages/modeling/src/maths/vec3/rotateZ.d.ts index 76585c46e..6e9311e4e 100644 --- a/packages/modeling/src/maths/vec3/rotateZ.d.ts +++ b/packages/modeling/src/maths/vec3/rotateZ.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function rotateZ(out: Vec3, vector: Vec3, origin: Vec3, angle: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/rotateZ.js b/packages/modeling/src/maths/vec3/rotateZ.js index 10f63b8a8..750381315 100644 --- a/packages/modeling/src/maths/vec3/rotateZ.js +++ b/packages/modeling/src/maths/vec3/rotateZ.js @@ -1,11 +1,11 @@ /** * Rotate the given vector around the given origin, Z axis only. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to rotate - * @param {vec3} origin - origin of the rotation - * @param {Number} radians - angle of rotation in radians - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to rotate + * @param {Vec3} origin - origin of the rotation + * @param {number} radians - angle of rotation in radians + * @returns {Vec3} out * @alias module:modeling/maths/vec3.rotateZ */ export const rotateZ = (out, vector, origin, radians) => { diff --git a/packages/modeling/src/maths/vec3/scale.d.ts b/packages/modeling/src/maths/vec3/scale.d.ts index 3a3d1b03f..250f390cf 100644 --- a/packages/modeling/src/maths/vec3/scale.d.ts +++ b/packages/modeling/src/maths/vec3/scale.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function scale(out: Vec3, vector: Vec3, amount: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/scale.js b/packages/modeling/src/maths/vec3/scale.js index 211d3d92e..fc7bf1293 100644 --- a/packages/modeling/src/maths/vec3/scale.js +++ b/packages/modeling/src/maths/vec3/scale.js @@ -1,10 +1,10 @@ /** * Scales the coordinates of the given vector by a scalar number. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to scale - * @param {Number} amount - amount to scale the vector by - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to scale + * @param {number} amount - amount to scale the vector by + * @returns {Vec3} out * @alias module:modeling/maths/vec3.scale */ export const scale = (out, vector, amount) => { diff --git a/packages/modeling/src/maths/vec3/snap.d.ts b/packages/modeling/src/maths/vec3/snap.d.ts index b68c809d8..674dc960f 100644 --- a/packages/modeling/src/maths/vec3/snap.d.ts +++ b/packages/modeling/src/maths/vec3/snap.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function snap(out: Vec3, vector: Vec3, epsilon: number): Vec3 diff --git a/packages/modeling/src/maths/vec3/snap.js b/packages/modeling/src/maths/vec3/snap.js index 57ef41971..ab074db75 100644 --- a/packages/modeling/src/maths/vec3/snap.js +++ b/packages/modeling/src/maths/vec3/snap.js @@ -1,10 +1,10 @@ /** * Snaps the coordinates of the given vector to the given epsilon. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to snap - * @param {Number} epsilon - epsilon of precision, less than 0 - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to snap + * @param {number} epsilon - epsilon of precision, less than 0 + * @returns {Vec3} out * @alias module:modeling/maths/vec3.snap */ export const snap = (out, vector, epsilon) => { diff --git a/packages/modeling/src/maths/vec3/squaredDistance.d.ts b/packages/modeling/src/maths/vec3/squaredDistance.d.ts index f8358649e..00573b9dd 100644 --- a/packages/modeling/src/maths/vec3/squaredDistance.d.ts +++ b/packages/modeling/src/maths/vec3/squaredDistance.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function squaredDistance(a: Vec3, b: Vec3): number diff --git a/packages/modeling/src/maths/vec3/squaredDistance.js b/packages/modeling/src/maths/vec3/squaredDistance.js index 462bc21c4..3c4008f41 100644 --- a/packages/modeling/src/maths/vec3/squaredDistance.js +++ b/packages/modeling/src/maths/vec3/squaredDistance.js @@ -1,9 +1,9 @@ /** * Calculates the squared distance between two vectors. * - * @param {vec3} a - first operand - * @param {vec3} b - second operand - * @returns {Number} squared distance + * @param {Vec3} a - first operand + * @param {Vec3} b - second operand + * @returns {number} squared distance * @alias module:modeling/maths/vec3.squaredDistance */ export const squaredDistance = (a, b) => { diff --git a/packages/modeling/src/maths/vec3/squaredLength.d.ts b/packages/modeling/src/maths/vec3/squaredLength.d.ts index 3be8ccd3a..72b3017c6 100644 --- a/packages/modeling/src/maths/vec3/squaredLength.d.ts +++ b/packages/modeling/src/maths/vec3/squaredLength.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function squaredLength(vector: Vec3): number diff --git a/packages/modeling/src/maths/vec3/squaredLength.js b/packages/modeling/src/maths/vec3/squaredLength.js index 09a1df3ac..8ee524e03 100644 --- a/packages/modeling/src/maths/vec3/squaredLength.js +++ b/packages/modeling/src/maths/vec3/squaredLength.js @@ -1,8 +1,8 @@ /** * Calculates the squared length of the given vector. * - * @param {vec3} vector - vector to calculate squared length of - * @returns {Number} squared length + * @param {Vec3} vector - vector to calculate squared length of + * @returns {number} squared length * @alias module:modeling/maths/vec3.squaredLength */ export const squaredLength = (vector) => { diff --git a/packages/modeling/src/maths/vec3/subtract.d.ts b/packages/modeling/src/maths/vec3/subtract.d.ts index 732b478d9..c54b343c0 100644 --- a/packages/modeling/src/maths/vec3/subtract.d.ts +++ b/packages/modeling/src/maths/vec3/subtract.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function subtract(out: Vec3, a: Vec3, b: Vec3): Vec3 diff --git a/packages/modeling/src/maths/vec3/subtract.js b/packages/modeling/src/maths/vec3/subtract.js index f5bb333cd..5aee6b74f 100644 --- a/packages/modeling/src/maths/vec3/subtract.js +++ b/packages/modeling/src/maths/vec3/subtract.js @@ -1,10 +1,10 @@ /** * Subtracts the coordinates of two vectors (A-B). * - * @param {vec3} out - receiving vector - * @param {vec3} a - minuend vector - * @param {vec3} b - subtrahend vector - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} a - minuend vector + * @param {Vec3} b - subtrahend vector + * @returns {Vec3} out * @alias module:modeling/maths/vec3.subtract */ export const subtract = (out, a, b) => { diff --git a/packages/modeling/src/maths/vec3/toString.d.ts b/packages/modeling/src/maths/vec3/toString.d.ts index 4b0c73b86..cfc63eda9 100644 --- a/packages/modeling/src/maths/vec3/toString.d.ts +++ b/packages/modeling/src/maths/vec3/toString.d.ts @@ -1,3 +1,3 @@ -import { Vec3 } from './type' +import type { Vec3 } from './type.d.ts' export function toString(vec: Vec3): string diff --git a/packages/modeling/src/maths/vec3/toString.js b/packages/modeling/src/maths/vec3/toString.js index 6a1ae6ac6..fc33d3caf 100644 --- a/packages/modeling/src/maths/vec3/toString.js +++ b/packages/modeling/src/maths/vec3/toString.js @@ -1,7 +1,7 @@ /** * Convert the given vector to a representative string. - * @param {vec3} vec - vector of reference - * @returns {String} string representation + * @param {Vec3} vec - vector of reference + * @returns {string} string representation * @alias module:modeling/maths/vec3.toString */ export const toString = (vec) => `[${vec[0].toFixed(7)}, ${vec[1].toFixed(7)}, ${vec[2].toFixed(7)}]` diff --git a/packages/modeling/src/maths/vec3/transform.d.ts b/packages/modeling/src/maths/vec3/transform.d.ts index ac69d9634..486e07da6 100644 --- a/packages/modeling/src/maths/vec3/transform.d.ts +++ b/packages/modeling/src/maths/vec3/transform.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from './type' -import { Mat4 } from '../mat4/type' +import type { Vec3 } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Vec3, vector: Vec3, matrix: Mat4): Vec3 diff --git a/packages/modeling/src/maths/vec3/transform.js b/packages/modeling/src/maths/vec3/transform.js index 2dc14af4e..e473dc08f 100644 --- a/packages/modeling/src/maths/vec3/transform.js +++ b/packages/modeling/src/maths/vec3/transform.js @@ -1,10 +1,10 @@ /** * Transforms the given vector using the given matrix. * - * @param {vec3} out - receiving vector - * @param {vec3} vector - vector to transform - * @param {mat4} matrix - transform matrix - * @returns {vec3} out + * @param {Vec3} out - receiving vector + * @param {Vec3} vector - vector to transform + * @param {Mat4} matrix - transform matrix + * @returns {Vec3} out * @alias module:modeling/maths/vec3.transform */ export const transform = (out, vector, matrix) => { diff --git a/packages/modeling/src/maths/vec3/transform.test.js b/packages/modeling/src/maths/vec3/transform.test.js index 4b8426999..eee3717e0 100644 --- a/packages/modeling/src/maths/vec3/transform.test.js +++ b/packages/modeling/src/maths/vec3/transform.test.js @@ -1,16 +1,12 @@ import test from 'ava' +import * as mat4 from '../mat4/index.js' import { transform, fromValues } from './index.js' import { compareVectors } from '../../../test/helpers/index.js' test('vec3: transform() called with three parameters should update a vec3 with correct values', (t) => { - const identityMatrix = [ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ] + const identityMatrix = mat4.create() const obs1 = fromValues(0, 0, 0) const ret1 = transform(obs1, [0, 0, 0], identityMatrix) @@ -25,12 +21,12 @@ test('vec3: transform() called with three parameters should update a vec3 with c const x = 1 const y = 5 const z = 7 - const translationMatrix = [ + const translationMatrix = mat4.fromValues( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 - ] + ) const obs3 = fromValues(0, 0, 0) const ret3 = transform(obs3, [-1, -2, -3], translationMatrix) @@ -40,12 +36,12 @@ test('vec3: transform() called with three parameters should update a vec3 with c const w = 1 const h = 3 const d = 5 - const scaleMatrix = [ + const scaleMatrix = mat4.fromValues( w, 0, 0, 0, 0, h, 0, 0, 0, 0, d, 0, 0, 0, 0, 1 - ] + ) const obs4 = fromValues(0, 0, 0) const ret4 = transform(obs4, [1, 2, 3], scaleMatrix) @@ -53,12 +49,12 @@ test('vec3: transform() called with three parameters should update a vec3 with c t.true(compareVectors(ret4, [1, 6, 15])) const r = (90 * 0.017453292519943295) - const rotateZMatrix = [ + const rotateZMatrix = mat4.fromValues( Math.cos(r), -Math.sin(r), 0, 0, Math.sin(r), Math.cos(r), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 - ] + ) const obs5 = fromValues(0, 0, 0) const ret5 = transform(obs5, [1, 2, 3], rotateZMatrix) diff --git a/packages/modeling/src/maths/vec4/clone.d.ts b/packages/modeling/src/maths/vec4/clone.d.ts index 6ff9c32b9..1ae1b12f6 100644 --- a/packages/modeling/src/maths/vec4/clone.d.ts +++ b/packages/modeling/src/maths/vec4/clone.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function clone(vec: Vec4): Vec4 diff --git a/packages/modeling/src/maths/vec4/clone.js b/packages/modeling/src/maths/vec4/clone.js index a58068f65..24870bac2 100644 --- a/packages/modeling/src/maths/vec4/clone.js +++ b/packages/modeling/src/maths/vec4/clone.js @@ -3,8 +3,8 @@ import { create } from './create.js' /** * Create a clone of the given vector. * - * @param {vec4} vector - source vector - * @returns {vec4} a new vector + * @param {Vec4} vector - source vector + * @returns {Vec4} a new vector * @alias module:modeling/maths/vec4.clone */ export const clone = (vector) => { diff --git a/packages/modeling/src/maths/vec4/copy.d.ts b/packages/modeling/src/maths/vec4/copy.d.ts index 889c01c72..6f5a79244 100644 --- a/packages/modeling/src/maths/vec4/copy.d.ts +++ b/packages/modeling/src/maths/vec4/copy.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function copy(out: Vec4, vector: Vec4): Vec4 diff --git a/packages/modeling/src/maths/vec4/copy.js b/packages/modeling/src/maths/vec4/copy.js index 2ceafd4f3..fc22ac8d3 100644 --- a/packages/modeling/src/maths/vec4/copy.js +++ b/packages/modeling/src/maths/vec4/copy.js @@ -1,9 +1,9 @@ /** * Create a copy of the given vector. * - * @param {vec4} out - receiving vector - * @param {vec4} vector - source vector - * @returns {vec4} out + * @param {Vec4} out - receiving vector + * @param {Vec4} vector - source vector + * @returns {Vec4} out * @alias module:modeling/maths/vec4.copy */ export const copy = (out, vector) => { diff --git a/packages/modeling/src/maths/vec4/create.d.ts b/packages/modeling/src/maths/vec4/create.d.ts index 00d5da36a..58a6ec84d 100644 --- a/packages/modeling/src/maths/vec4/create.d.ts +++ b/packages/modeling/src/maths/vec4/create.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function create(): Vec4 diff --git a/packages/modeling/src/maths/vec4/create.js b/packages/modeling/src/maths/vec4/create.js index 3b18f07d0..84715f570 100644 --- a/packages/modeling/src/maths/vec4/create.js +++ b/packages/modeling/src/maths/vec4/create.js @@ -1,13 +1,12 @@ /** * Represents a four dimensional vector. * See fromValues(). - * @typedef {Array} vec4 */ /** * Creates a new vector initialized to [0,0,0,0]. * - * @returns {vec4} a new vector + * @returns {Vec4} a new vector * @alias module:modeling/maths/vec4.create */ export const create = () => [0, 0, 0, 0] diff --git a/packages/modeling/src/maths/vec4/dot.d.ts b/packages/modeling/src/maths/vec4/dot.d.ts index 2b6092986..88dbef687 100644 --- a/packages/modeling/src/maths/vec4/dot.d.ts +++ b/packages/modeling/src/maths/vec4/dot.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function dot(a: Vec4, b: Vec4): number diff --git a/packages/modeling/src/maths/vec4/dot.js b/packages/modeling/src/maths/vec4/dot.js index 8b429fe7e..541da05f5 100644 --- a/packages/modeling/src/maths/vec4/dot.js +++ b/packages/modeling/src/maths/vec4/dot.js @@ -1,9 +1,9 @@ /** * Calculates the dot product of the given vectors. * - * @param {vec4} a - first vector - * @param {vec4} b - second vector - * @returns {Number} dot product + * @param {Vec4} a - first vector + * @param {Vec4} b - second vector + * @returns {number} dot product * @alias module:modeling/maths/vec4.dot */ export const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] diff --git a/packages/modeling/src/maths/vec4/equals.d.ts b/packages/modeling/src/maths/vec4/equals.d.ts index fae55cfd1..3e464b1ec 100644 --- a/packages/modeling/src/maths/vec4/equals.d.ts +++ b/packages/modeling/src/maths/vec4/equals.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function equals(a: Vec4, b: Vec4): boolean diff --git a/packages/modeling/src/maths/vec4/equals.js b/packages/modeling/src/maths/vec4/equals.js index 43a260896..a49752214 100644 --- a/packages/modeling/src/maths/vec4/equals.js +++ b/packages/modeling/src/maths/vec4/equals.js @@ -1,8 +1,8 @@ /** * Compare the given vectors for equality. * - * @param {vec4} a - first vector - * @param {vec4} b - second vector + * @param {Vec4} a - first vector + * @param {Vec4} b - second vector * @return {Boolean} true if vectors are equal * @alias module:modeling/maths/vec4.equals */ diff --git a/packages/modeling/src/maths/vec4/fromScalar.d.ts b/packages/modeling/src/maths/vec4/fromScalar.d.ts index c9c825910..fd6114327 100644 --- a/packages/modeling/src/maths/vec4/fromScalar.d.ts +++ b/packages/modeling/src/maths/vec4/fromScalar.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function fromScalar(out: Vec4, scalar: number): Vec4 diff --git a/packages/modeling/src/maths/vec4/fromScalar.js b/packages/modeling/src/maths/vec4/fromScalar.js index a407d2439..3ee679b41 100644 --- a/packages/modeling/src/maths/vec4/fromScalar.js +++ b/packages/modeling/src/maths/vec4/fromScalar.js @@ -1,9 +1,9 @@ /** * Create a new vector from the given scalar value. * - * @param {vec4} out - receiving vector + * @param {Vec4} out - receiving vector * @param {Number} scalar - * @returns {vec4} out + * @returns {Vec4} out * @alias module:modeling/maths/vec4.fromScalar */ export const fromScalar = (out, scalar) => { diff --git a/packages/modeling/src/maths/vec4/fromValues.d.ts b/packages/modeling/src/maths/vec4/fromValues.d.ts index 962b41c87..5db2ec100 100644 --- a/packages/modeling/src/maths/vec4/fromValues.d.ts +++ b/packages/modeling/src/maths/vec4/fromValues.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function fromValues(x: number, y: number, z: number, w: number): Vec4 diff --git a/packages/modeling/src/maths/vec4/fromValues.js b/packages/modeling/src/maths/vec4/fromValues.js index 3f3d8285b..6b02760bc 100644 --- a/packages/modeling/src/maths/vec4/fromValues.js +++ b/packages/modeling/src/maths/vec4/fromValues.js @@ -3,11 +3,11 @@ import { create } from './create.js' /** * Creates a new vector with the given values. * - * @param {Number} x - X component - * @param {Number} y - Y component - * @param {Number} z - Z component - * @param {Number} w - W component - * @returns {vec4} a new vector + * @param {number} x - X component + * @param {number} y - Y component + * @param {number} z - Z component + * @param {number} w - W component + * @returns {Vec4} a new vector * @alias module:modeling/maths/vec4.fromValues */ export const fromValues = (x, y, z, w) => { diff --git a/packages/modeling/src/maths/vec4/index.d.ts b/packages/modeling/src/maths/vec4/index.d.ts index dd53cc62a..b5d5dc1cb 100644 --- a/packages/modeling/src/maths/vec4/index.d.ts +++ b/packages/modeling/src/maths/vec4/index.d.ts @@ -1,12 +1,11 @@ -export { clone } from './clone' -export { copy } from './copy' -export { create } from './create' -export { dot } from './dot' -export { equals } from './equals' -export { fromScalar } from './fromScalar' -export { fromValues } from './fromValues' -export { toString } from './toString' -export { transform } from './transform' +export { clone } from './clone.js' +export { copy } from './copy.js' +export { create } from './create.js' +export { dot } from './dot.js' +export { equals } from './equals.js' +export { fromScalar } from './fromScalar.js' +export { fromValues } from './fromValues.js' +export { toString } from './toString.js' +export { transform } from './transform.js' -export { Vec4 } from './type' -export as namespace vec4 +export type { Vec4 } from './type.d.ts' diff --git a/packages/modeling/src/maths/vec4/toString.d.ts b/packages/modeling/src/maths/vec4/toString.d.ts index ad201606b..025f59c5a 100644 --- a/packages/modeling/src/maths/vec4/toString.d.ts +++ b/packages/modeling/src/maths/vec4/toString.d.ts @@ -1,3 +1,3 @@ -import { Vec4 } from './type' +import type { Vec4 } from './type.d.ts' export function toString(vec: Vec4): string diff --git a/packages/modeling/src/maths/vec4/toString.js b/packages/modeling/src/maths/vec4/toString.js index 556e1c568..3134cd0b9 100644 --- a/packages/modeling/src/maths/vec4/toString.js +++ b/packages/modeling/src/maths/vec4/toString.js @@ -1,8 +1,8 @@ /** * Convert the given vector to a representative string. * - * @param {vec4} vec - vector to convert - * @returns {String} representative string + * @param {Vec4} vec - vector to convert + * @returns {string} representative string * @alias module:modeling/maths/vec4.toString */ export const toString = (vec) => `(${vec[0].toFixed(9)}, ${vec[1].toFixed(9)}, ${vec[2].toFixed(9)}, ${vec[3].toFixed(9)})` diff --git a/packages/modeling/src/maths/vec4/transform.d.ts b/packages/modeling/src/maths/vec4/transform.d.ts index a58397ce0..32d3b9a6b 100644 --- a/packages/modeling/src/maths/vec4/transform.d.ts +++ b/packages/modeling/src/maths/vec4/transform.d.ts @@ -1,4 +1,4 @@ -import { Vec4 } from './type' -import { Mat4 } from '../mat4/type' +import type { Vec4 } from './type.d.ts' +import type { Mat4 } from '../mat4/type.d.ts' export function transform(out: Vec4, vector: Vec4, matrix: Mat4): Vec4 diff --git a/packages/modeling/src/maths/vec4/transform.js b/packages/modeling/src/maths/vec4/transform.js index 9de26aaf0..05359fffd 100644 --- a/packages/modeling/src/maths/vec4/transform.js +++ b/packages/modeling/src/maths/vec4/transform.js @@ -1,10 +1,11 @@ + /** * Transform the given vector using the given matrix. * - * @param {vec4} out - receiving vector - * @param {vec4} vector - vector to transform - * @param {mat4} matrix - matrix to transform with - * @returns {vec4} out + * @param {Vec4} out - receiving vector + * @param {Vec4} vector - vector to transform + * @param {Mat4} matrix - matrix to transform with + * @returns {Vec4} out * @alias module:modeling/maths/vec4.transform */ export const transform = (out, vector, matrix) => { diff --git a/packages/modeling/src/measurements/index.d.ts b/packages/modeling/src/measurements/index.d.ts index 91eb6a1c9..3511f741d 100644 --- a/packages/modeling/src/measurements/index.d.ts +++ b/packages/modeling/src/measurements/index.d.ts @@ -1,15 +1,14 @@ -export { measureAggregateArea } from './measureAggregateArea' -export { measureAggregateBoundingBox } from './measureAggregateBoundingBox' -export { measureAggregateEpsilon } from './measureAggregateEpsilon' -export { measureAggregateVolume } from './measureAggregateVolume' -export { measureArea } from './measureArea' -export { measureBoundingBox } from './measureBoundingBox' -export { measureBoundingSphere } from './measureBoundingSphere' -export { measureCenter } from './measureCenter' -export { measureCenterOfMass } from './measureCenterOfMass' -export { measureDimensions } from './measureDimensions' -export { measureEpsilon } from './measureEpsilon' -export { measureVolume } from './measureVolume' +export { measureAggregateArea } from './measureAggregateArea.js' +export { measureAggregateBoundingBox } from './measureAggregateBoundingBox.js' +export { measureAggregateEpsilon } from './measureAggregateEpsilon.js' +export { measureAggregateVolume } from './measureAggregateVolume.js' +export { measureArea } from './measureArea.js' +export { measureBoundingBox } from './measureBoundingBox.js' +export { measureBoundingSphere } from './measureBoundingSphere.js' +export { measureCenter } from './measureCenter.js' +export { measureCenterOfMass } from './measureCenterOfMass.js' +export { measureDimensions } from './measureDimensions.js' +export { measureEpsilon } from './measureEpsilon.js' +export { measureVolume } from './measureVolume.js' -export * from './types' -export as namespace measurements +export type * from './types.d.ts' diff --git a/packages/modeling/src/measurements/measureAggregateArea.d.ts b/packages/modeling/src/measurements/measureAggregateArea.d.ts index 835d63905..13b2cfc0f 100644 --- a/packages/modeling/src/measurements/measureAggregateArea.d.ts +++ b/packages/modeling/src/measurements/measureAggregateArea.d.ts @@ -1,4 +1,4 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureAggregateArea(...geometries: RecursiveArray): number diff --git a/packages/modeling/src/measurements/measureAggregateArea.js b/packages/modeling/src/measurements/measureAggregateArea.js index b58b083d9..17bf63c68 100644 --- a/packages/modeling/src/measurements/measureAggregateArea.js +++ b/packages/modeling/src/measurements/measureAggregateArea.js @@ -6,7 +6,7 @@ import { measureArea } from './measureArea.js' * Measure the total (aggregate) area for the given geometries. * Note: This measurement will not account for overlapping geometry * @param {...Object} geometries - the geometries to measure. - * @return {Number} the total surface area for the group of geometry. + * @return {number} the total surface area for the group of geometry. * @alias module:modeling/measurements.measureAggregateArea * * @example diff --git a/packages/modeling/src/measurements/measureAggregateBoundingBox.d.ts b/packages/modeling/src/measurements/measureAggregateBoundingBox.d.ts index cfb9d0289..63daf44ad 100644 --- a/packages/modeling/src/measurements/measureAggregateBoundingBox.d.ts +++ b/packages/modeling/src/measurements/measureAggregateBoundingBox.d.ts @@ -1,6 +1,6 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' -import { BoundingBox } from './types' +import type { BoundingBox } from './types.d.ts' export function measureAggregateBoundingBox(...geometries: RecursiveArray): BoundingBox diff --git a/packages/modeling/src/measurements/measureAggregateEpsilon.d.ts b/packages/modeling/src/measurements/measureAggregateEpsilon.d.ts index 413c73c5a..1199af09a 100644 --- a/packages/modeling/src/measurements/measureAggregateEpsilon.d.ts +++ b/packages/modeling/src/measurements/measureAggregateEpsilon.d.ts @@ -1,4 +1,4 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureAggregateEpsilon(...geometries: RecursiveArray): number diff --git a/packages/modeling/src/measurements/measureAggregateEpsilon.js b/packages/modeling/src/measurements/measureAggregateEpsilon.js index 68c4486eb..f95123487 100644 --- a/packages/modeling/src/measurements/measureAggregateEpsilon.js +++ b/packages/modeling/src/measurements/measureAggregateEpsilon.js @@ -10,7 +10,7 @@ import { calculateEpsilonFromBounds } from './calculateEpsilonFromBounds.js' /** * Measure the aggregated Epsilon for the given geometries. * @param {...Object} geometries - the geometries to measure - * @return {Number} the aggregated Epsilon for the whole group of geometries + * @return {number} the aggregated Epsilon for the whole group of geometries * @alias module:modeling/measurements.measureAggregateEpsilon * * @example diff --git a/packages/modeling/src/measurements/measureAggregateVolume.d.ts b/packages/modeling/src/measurements/measureAggregateVolume.d.ts index db215107b..78cc5f53e 100644 --- a/packages/modeling/src/measurements/measureAggregateVolume.d.ts +++ b/packages/modeling/src/measurements/measureAggregateVolume.d.ts @@ -1,4 +1,4 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureAggregateVolume(...geometries: RecursiveArray): number diff --git a/packages/modeling/src/measurements/measureAggregateVolume.js b/packages/modeling/src/measurements/measureAggregateVolume.js index 4284b63be..87a55bd34 100644 --- a/packages/modeling/src/measurements/measureAggregateVolume.js +++ b/packages/modeling/src/measurements/measureAggregateVolume.js @@ -6,7 +6,7 @@ import { measureVolume } from './measureVolume.js' * Measure the total (aggregate) volume for the given geometries. * Note: This measurement will not account for overlapping geometry * @param {...Object} geometries - the geometries to measure. - * @return {Number} the volume for the group of geometry. + * @return {number} the volume for the group of geometry. * @alias module:modeling/measurements.measureAggregateVolume * * @example diff --git a/packages/modeling/src/measurements/measureArea.d.ts b/packages/modeling/src/measurements/measureArea.d.ts index 677e84eb7..445227932 100644 --- a/packages/modeling/src/measurements/measureArea.d.ts +++ b/packages/modeling/src/measurements/measureArea.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureArea(geometry: Geometry): number export function measureArea(geometry: any): 0 diff --git a/packages/modeling/src/measurements/measureArea.js b/packages/modeling/src/measurements/measureArea.js index 1b91970f2..80204bb78 100644 --- a/packages/modeling/src/measurements/measureArea.js +++ b/packages/modeling/src/measurements/measureArea.js @@ -11,8 +11,8 @@ const cache = new WeakMap() * Measure the area of the given geometry. * NOTE: paths are infinitely narrow and do not have an area * - * @param {path2} geometry - geometry to measure - * @returns {Number} area of the geometry + * @param {Path2} geometry - geometry to measure + * @returns {number} area of the geometry */ const measureAreaOfPath2 = () => 0 @@ -21,8 +21,8 @@ const measureAreaOfPath2 = () => 0 * For a counterclockwise rotating geometry (about Z) the area is positive, otherwise negative. * * @see http://paulbourke.net/geometry/polygonmesh/ - * @param {geom2} geometry - 2D geometry to measure - * @returns {Number} area of the geometry + * @param {Geom2} geometry - 2D geometry to measure + * @returns {number} area of the geometry */ const measureAreaOfGeom2 = (geometry) => { let area = cache.get(geometry) @@ -40,8 +40,8 @@ const measureAreaOfGeom2 = (geometry) => { /* * Measure the area of the given geometry. * - * @param {geom3} geometry - 3D geometry to measure - * @returns {Number} area of the geometry + * @param {Geom3} geometry - 3D geometry to measure + * @returns {number} area of the geometry */ const measureAreaOfGeom3 = (geometry) => { let area = cache.get(geometry) @@ -58,7 +58,7 @@ const measureAreaOfGeom3 = (geometry) => { /** * Measure the area of the given geometries. * @param {...Objects} geometries - the geometries to measure - * @return {Number|Array} the area, or a list of areas for each geometry + * @return {number|Array} the area, or a list of areas for each geometry * @alias module:modeling/measurements.measureArea * * @example diff --git a/packages/modeling/src/measurements/measureBoundingBox.d.ts b/packages/modeling/src/measurements/measureBoundingBox.d.ts index 67cabee41..466f24994 100644 --- a/packages/modeling/src/measurements/measureBoundingBox.d.ts +++ b/packages/modeling/src/measurements/measureBoundingBox.d.ts @@ -1,7 +1,7 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' -import { BoundingBox } from './types' +import type { BoundingBox } from './types.d.ts' export function measureBoundingBox(geometry: Geometry): BoundingBox export function measureBoundingBox(geometry: any): [[0, 0, 0], [0, 0, 0]] diff --git a/packages/modeling/src/measurements/measureBoundingSphere.d.ts b/packages/modeling/src/measurements/measureBoundingSphere.d.ts index 20a6587b2..9d1b83826 100644 --- a/packages/modeling/src/measurements/measureBoundingSphere.d.ts +++ b/packages/modeling/src/measurements/measureBoundingSphere.d.ts @@ -1,6 +1,6 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' -import { BoundingSphere } from './types' +import type { BoundingSphere } from './types.d.ts' export function measureBoundingSphere(...geometries: RecursiveArray): BoundingSphere diff --git a/packages/modeling/src/measurements/measureCenter.d.ts b/packages/modeling/src/measurements/measureCenter.d.ts index 236714a13..ed0ae9208 100644 --- a/packages/modeling/src/measurements/measureCenter.d.ts +++ b/packages/modeling/src/measurements/measureCenter.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureCenter(geometry: Geometry): [number, number, number] export function measureCenter(...geometries: RecursiveArray): [number, number, number][] diff --git a/packages/modeling/src/measurements/measureCenterOfMass.d.ts b/packages/modeling/src/measurements/measureCenterOfMass.d.ts index ec273886f..36f3efaae 100644 --- a/packages/modeling/src/measurements/measureCenterOfMass.d.ts +++ b/packages/modeling/src/measurements/measureCenterOfMass.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureCenterOfMass(geometry: Geometry): [number, number, number] export function measureCenterOfMass(...geometries: RecursiveArray): [number, number, number][] diff --git a/packages/modeling/src/measurements/measureDimensions.d.ts b/packages/modeling/src/measurements/measureDimensions.d.ts index 9dfba1261..f7df7580b 100644 --- a/packages/modeling/src/measurements/measureDimensions.d.ts +++ b/packages/modeling/src/measurements/measureDimensions.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureDimensions(geometry: Geometry): [number, number, number] export function measureDimensions(...geometries: RecursiveArray): [number, number, number][] diff --git a/packages/modeling/src/measurements/measureEpsilon.d.ts b/packages/modeling/src/measurements/measureEpsilon.d.ts index 58cb95e86..261dba365 100644 --- a/packages/modeling/src/measurements/measureEpsilon.d.ts +++ b/packages/modeling/src/measurements/measureEpsilon.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureEpsilon(geometry: Geometry): number export function measureEpsilon(geometry: any): 0 diff --git a/packages/modeling/src/measurements/measureEpsilon.js b/packages/modeling/src/measurements/measureEpsilon.js index b67a81153..1f9756b01 100644 --- a/packages/modeling/src/measurements/measureEpsilon.js +++ b/packages/modeling/src/measurements/measureEpsilon.js @@ -9,13 +9,13 @@ import { measureBoundingBox } from './measureBoundingBox.js' /* * Measure the epsilon of the given (path2) geometry. - * @return {Number} the epsilon (precision) of the geometry + * @return {number} the epsilon (precision) of the geometry */ const measureEpsilonOfPath2 = (geometry) => calculateEpsilonFromBounds(measureBoundingBox(geometry), 2) /* * Measure the epsilon of the given (geom2) geometry. - * @return {Number} the epsilon (precision) of the geometry + * @return {number} the epsilon (precision) of the geometry */ const measureEpsilonOfGeom2 = (geometry) => calculateEpsilonFromBounds(measureBoundingBox(geometry), 2) @@ -29,7 +29,7 @@ const measureEpsilonOfGeom3 = (geometry) => calculateEpsilonFromBounds(measureBo * Measure the epsilon of the given geometries. * Epsilon values are used in various functions to determine minimum distances between vertices, planes, etc. * @param {...Object} geometries - the geometries to measure - * @return {Number|Array} the epsilon, or a list of epsilons for each geometry + * @return {number|Array} the epsilon, or a list of epsilons for each geometry * @alias module:modeling/measurements.measureEpsilon * * @example diff --git a/packages/modeling/src/measurements/measureVolume.d.ts b/packages/modeling/src/measurements/measureVolume.d.ts index 296bb95d3..b0f20deae 100644 --- a/packages/modeling/src/measurements/measureVolume.d.ts +++ b/packages/modeling/src/measurements/measureVolume.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../geometries/types' -import RecursiveArray from '../utils/recursiveArray' +import type { Geometry } from '../geometries/types.d.ts' +import type { RecursiveArray } from '../utils/recursiveArray.d.ts' export function measureVolume(geometry: Geometry): number export function measureVolume(geometry: any): 0 diff --git a/packages/modeling/src/measurements/measureVolume.js b/packages/modeling/src/measurements/measureVolume.js index c602a9a1c..bc4f598f2 100644 --- a/packages/modeling/src/measurements/measureVolume.js +++ b/packages/modeling/src/measurements/measureVolume.js @@ -12,7 +12,7 @@ const cache = new WeakMap() * NOTE: paths are infinitely narrow and do not have a volume * * @param {Path2} geometry - geometry to measure - * @returns {Number} volume of the geometry + * @returns {number} volume of the geometry */ const measureVolumeOfPath2 = () => 0 @@ -21,7 +21,7 @@ const measureVolumeOfPath2 = () => 0 * NOTE: 2D geometry are infinitely thin and do not have a volume * * @param {Geom2} geometry - 2D geometry to measure - * @returns {Number} volume of the geometry + * @returns {number} volume of the geometry */ const measureVolumeOfGeom2 = () => 0 @@ -29,7 +29,7 @@ const measureVolumeOfGeom2 = () => 0 * Measure the volume of the given geometry. * * @param {Geom3} geometry - 3D geometry to measure - * @returns {Number} volume of the geometry + * @returns {number} volume of the geometry */ const measureVolumeOfGeom3 = (geometry) => { let volume = cache.get(geometry) @@ -46,7 +46,7 @@ const measureVolumeOfGeom3 = (geometry) => { /** * Measure the volume of the given geometries. * @param {...Object} geometries - the geometries to measure - * @return {Number|Array} the volume, or a list of volumes for each geometry + * @return {number|Array} the volume, or a list of volumes for each geometry * @alias module:modeling/measurements.measureVolume * * @example diff --git a/packages/modeling/src/measurements/types.d.ts b/packages/modeling/src/measurements/types.d.ts index e18957dbe..956e2a977 100644 --- a/packages/modeling/src/measurements/types.d.ts +++ b/packages/modeling/src/measurements/types.d.ts @@ -1,4 +1,4 @@ -import { Vec3 } from '../maths/vec3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' export type BoundingBox = [Vec3, Vec3] export type BoundingSphere = [Vec3, number] diff --git a/packages/modeling/src/operations/booleans/index.d.ts b/packages/modeling/src/operations/booleans/index.d.ts index aa9db6602..e389ffebd 100644 --- a/packages/modeling/src/operations/booleans/index.d.ts +++ b/packages/modeling/src/operations/booleans/index.d.ts @@ -1,5 +1,3 @@ -export { intersect } from './intersect' -export { subtract } from './subtract' -export { union } from './union' - -export as namespace booleans +export { intersect } from './intersect.js' +export { subtract } from './subtract.js' +export { union } from './union.js' diff --git a/packages/modeling/src/operations/booleans/intersect.d.ts b/packages/modeling/src/operations/booleans/intersect.d.ts index 9fd426ab5..4a623e637 100644 --- a/packages/modeling/src/operations/booleans/intersect.d.ts +++ b/packages/modeling/src/operations/booleans/intersect.d.ts @@ -1,5 +1,6 @@ -import { Geom2, Geom3 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2 } from '../../geometries/geom2/type.d.ts' +import type { Geom3 } from '../../geometries/geom3/type.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function intersect(...geometries: RecursiveArray): Geom2 export function intersect(...geometries: RecursiveArray): Geom3 diff --git a/packages/modeling/src/operations/booleans/intersect.js b/packages/modeling/src/operations/booleans/intersect.js index 3c4f5ca3c..7a864ad25 100644 --- a/packages/modeling/src/operations/booleans/intersect.js +++ b/packages/modeling/src/operations/booleans/intersect.js @@ -13,7 +13,7 @@ import { intersectGeom3 } from './intersectGeom3.js' * The given geometries should be of the same type, either geom2 or geom3. * * @param {...Object} geometries - list of geometries - * @returns {geom2|geom3} a new geometry + * @returns {Geom2|geom3} a new geometry * @alias module:modeling/booleans.intersect * * @example diff --git a/packages/modeling/src/operations/booleans/intersectGeom2.js b/packages/modeling/src/operations/booleans/intersectGeom2.js index 5eedca386..77ae80d5a 100644 --- a/packages/modeling/src/operations/booleans/intersectGeom2.js +++ b/packages/modeling/src/operations/booleans/intersectGeom2.js @@ -7,7 +7,7 @@ import { boolean } from './martinez/index.js' * Return a new 2D geometry representing space in both the first geometry and * in the subsequent geometries. None of the given geometries are modified. * @param {...geom2} geometries - list of 2D geometries - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry */ export const intersectGeom2 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/intersectGeom3.js b/packages/modeling/src/operations/booleans/intersectGeom3.js index 6bcc63f1a..18adcd594 100644 --- a/packages/modeling/src/operations/booleans/intersectGeom3.js +++ b/packages/modeling/src/operations/booleans/intersectGeom3.js @@ -8,7 +8,7 @@ import { intersectGeom3Sub } from './intersectGeom3Sub.js' * Return a new 3D geometry representing space in both the first geometry and * in the subsequent geometries. None of the given geometries are modified. * @param {...geom3} geometries - list of 3D geometries - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry */ export const intersectGeom3 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/intersectGeom3Sub.js b/packages/modeling/src/operations/booleans/intersectGeom3Sub.js index 233f2939b..e8c81fcf0 100644 --- a/packages/modeling/src/operations/booleans/intersectGeom3Sub.js +++ b/packages/modeling/src/operations/booleans/intersectGeom3Sub.js @@ -7,9 +7,9 @@ import { mayOverlap } from './mayOverlap.js' /* * Return a new 3D geometry representing the space in both the first geometry and * the second geometry. None of the given geometries are modified. - * @param {geom3} geometry1 - a geometry - * @param {geom3} geometry2 - a geometry - * @returns {geom3} new 3D geometry + * @param {Geom3} geometry1 - a geometry + * @param {Geom3} geometry2 - a geometry + * @returns {Geom3} new 3D geometry */ export const intersectGeom3Sub = (geometry1, geometry2) => { if (!mayOverlap(geometry1, geometry2)) { diff --git a/packages/modeling/src/operations/booleans/martinez/compareEvents.js b/packages/modeling/src/operations/booleans/martinez/compareEvents.js index 1661b009a..09f7a411b 100644 --- a/packages/modeling/src/operations/booleans/martinez/compareEvents.js +++ b/packages/modeling/src/operations/booleans/martinez/compareEvents.js @@ -9,7 +9,7 @@ import { signedArea } from './signedArea.js' /** * @param {SweepEvent} e1 * @param {SweepEvent} e2 - * @return {Number} + * @return {number} */ export const compareEvents = (e1, e2) => { const p1 = e1.point diff --git a/packages/modeling/src/operations/booleans/martinez/compareSegments.js b/packages/modeling/src/operations/booleans/martinez/compareSegments.js index 35ba67463..46e4a7c5f 100644 --- a/packages/modeling/src/operations/booleans/martinez/compareSegments.js +++ b/packages/modeling/src/operations/booleans/martinez/compareSegments.js @@ -11,7 +11,7 @@ import { signedArea } from './signedArea.js' /** * @param {SweepEvent} le1 * @param {SweepEvent} le2 - * @return {Number} + * @return {number} */ export const compareSegments = (le1, le2) => { if (le1 === le2) return 0 diff --git a/packages/modeling/src/operations/booleans/martinez/connectEdges.js b/packages/modeling/src/operations/booleans/martinez/connectEdges.js index e9772db5f..7466025d4 100644 --- a/packages/modeling/src/operations/booleans/martinez/connectEdges.js +++ b/packages/modeling/src/operations/booleans/martinez/connectEdges.js @@ -8,8 +8,8 @@ import { compareEvents } from './compareEvents.js' import { Contour } from './contour.js' /** - * @param {Array.} sortedEvents - * @return {Array.} + * @param {SweepEvent[]} sortedEvents + * @return {SweepEvent[]} */ const orderEvents = (sortedEvents) => { let event, i, len, tmp @@ -56,10 +56,10 @@ const orderEvents = (sortedEvents) => { } /** - * @param {Number} pos - * @param {Array.} resultEvents - * @param {Object>} processed - * @return {Number} + * @param {number} pos + * @param {SweepEvent[]} resultEvents + * @param {object} processed + * @return {number} */ const nextPos = (pos, resultEvents, processed, origPos) => { let newPos = pos + 1 diff --git a/packages/modeling/src/operations/booleans/martinez/possibleIntersection.js b/packages/modeling/src/operations/booleans/martinez/possibleIntersection.js index a2101f0ad..3e72b7f11 100644 --- a/packages/modeling/src/operations/booleans/martinez/possibleIntersection.js +++ b/packages/modeling/src/operations/booleans/martinez/possibleIntersection.js @@ -18,7 +18,7 @@ import { * @param {SweepEvent} se1 * @param {SweepEvent} se2 * @param {Queue} queue - * @return {Number} + * @return {number} */ export const possibleIntersection = (se1, se2, queue) => { // that disallows self-intersecting polygons, diff --git a/packages/modeling/src/operations/booleans/martinez/segmentIntersection.js b/packages/modeling/src/operations/booleans/martinez/segmentIntersection.js index a7b3c3d37..0001fb35b 100644 --- a/packages/modeling/src/operations/booleans/martinez/segmentIntersection.js +++ b/packages/modeling/src/operations/booleans/martinez/segmentIntersection.js @@ -10,10 +10,10 @@ import { dot as dotProduct } from '../../../maths/vec2/index.js' * Finds the magnitude of the cross product of two vectors (if we pretend * they're in three dimensions) * - * @param {Object} a First vector - * @param {Object} b Second vector + * @param {object} a First vector + * @param {object} b Second vector * @private - * @returns {Number} The magnitude of the cross product + * @returns {number} The magnitude of the cross product */ const crossProduct = (a, b) => (a[0] * b[1]) - (a[1] * b[0]) @@ -29,7 +29,7 @@ const crossProduct = (a, b) => (a[0] * b[1]) - (a[1] * b[0]) * @param {Array.} a2 point of first line * @param {Array.} b1 point of second line * @param {Array.} b2 point of second line - * @param {Boolean=} noEndpointTouch whether to skip single touchpoints (meaning connected segments) as intersections + * @param {boolean=} noEndpointTouch whether to skip single touchpoints (meaning connected segments) as intersections * @returns {Array.>|Null} If the lines intersect, the point of * intersection. If they overlap, the two end points of the overlapping segment. * Otherwise, null. diff --git a/packages/modeling/src/operations/booleans/martinez/signedArea.js b/packages/modeling/src/operations/booleans/martinez/signedArea.js index 97e6fd8d6..d3bc83558 100644 --- a/packages/modeling/src/operations/booleans/martinez/signedArea.js +++ b/packages/modeling/src/operations/booleans/martinez/signedArea.js @@ -6,7 +6,7 @@ const orient2d = (ax, ay, bx, by, cx, cy) => (ay - cy) * (bx - cx) - (ax - cx) * * @param {Array.} p0 * @param {Array.} p1 * @param {Array.} p2 - * @return {Number} + * @return {number} */ export const signedArea = (p0, p1, p2) => { const res = orient2d(p0[0], p0[1], p1[0], p1[1], p2[0], p2[1]) diff --git a/packages/modeling/src/operations/booleans/martinez/sweepEvent.js b/packages/modeling/src/operations/booleans/martinez/sweepEvent.js index 23041e0d4..eb7df3c6e 100644 --- a/packages/modeling/src/operations/booleans/martinez/sweepEvent.js +++ b/packages/modeling/src/operations/booleans/martinez/sweepEvent.js @@ -6,10 +6,10 @@ export class SweepEvent { * * @class {SweepEvent} * @param {Array.} point - * @param {Boolean} left + * @param {boolean} left * @param {SweepEvent=} otherEvent - * @param {Boolean} isSubject - * @param {Number} edgeType + * @param {boolean} isSubject + * @param {number} edgeType */ constructor (point, left, otherEvent, isSubject, edgeType) { /** diff --git a/packages/modeling/src/operations/booleans/mayOverlap.js b/packages/modeling/src/operations/booleans/mayOverlap.js index 209fa0d70..64e82fba5 100644 --- a/packages/modeling/src/operations/booleans/mayOverlap.js +++ b/packages/modeling/src/operations/booleans/mayOverlap.js @@ -6,8 +6,8 @@ import { measureBoundingBox } from '../../measurements/measureBoundingBox.js' /* * Determine if the given geometries overlap by comparing min and max bounds. * NOTE: This is used in union for performance gains. - * @param {geom3} geometry1 - geometry for comparison - * @param {geom3} geometry2 - geometry for comparison + * @param {Geom3} geometry1 - geometry for comparison + * @param {Geom3} geometry2 - geometry for comparison * @returns {boolean} true if the geometries overlap */ export const mayOverlap = (geometry1, geometry2) => { diff --git a/packages/modeling/src/operations/booleans/subtract.d.ts b/packages/modeling/src/operations/booleans/subtract.d.ts index bf662c6b1..0f50e9158 100644 --- a/packages/modeling/src/operations/booleans/subtract.d.ts +++ b/packages/modeling/src/operations/booleans/subtract.d.ts @@ -1,5 +1,6 @@ -import { Geom2, Geom3 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2 } from '../../geometries/geom2/type.d.ts' +import type { Geom3 } from '../../geometries/geom3/type.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function subtract(...geometries: RecursiveArray): Geom2 export function subtract(...geometries: RecursiveArray): Geom3 diff --git a/packages/modeling/src/operations/booleans/subtract.js b/packages/modeling/src/operations/booleans/subtract.js index f9f2caed2..a39287fff 100644 --- a/packages/modeling/src/operations/booleans/subtract.js +++ b/packages/modeling/src/operations/booleans/subtract.js @@ -13,7 +13,7 @@ import { subtractGeom3 } from './subtractGeom3.js' * The given geometries should be of the same type, either geom2 or geom3. * * @param {...Object} geometries - list of geometries - * @returns {geom2|geom3} a new geometry + * @returns {Geom2|geom3} a new geometry * @alias module:modeling/booleans.subtract * * @example diff --git a/packages/modeling/src/operations/booleans/subtractGeom2.js b/packages/modeling/src/operations/booleans/subtractGeom2.js index 8e6d6c569..03f997cd1 100644 --- a/packages/modeling/src/operations/booleans/subtractGeom2.js +++ b/packages/modeling/src/operations/booleans/subtractGeom2.js @@ -7,7 +7,7 @@ import { boolean } from './martinez/index.js' * Return a new 2D geometry representing space in the first geometry but * not in the subsequent geometries. None of the given geometries are modified. * @param {...geom2} geometries - list of geometries - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry */ export const subtractGeom2 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/subtractGeom3.js b/packages/modeling/src/operations/booleans/subtractGeom3.js index 0e35f1174..465a765c2 100644 --- a/packages/modeling/src/operations/booleans/subtractGeom3.js +++ b/packages/modeling/src/operations/booleans/subtractGeom3.js @@ -8,7 +8,7 @@ import { subtractGeom3Sub } from './subtractGeom3Sub.js' * Return a new 3D geometry representing space in this geometry but not in the given geometries. * Neither this geometry nor the given geometries are modified. * @param {...geom3} geometries - list of geometries - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry */ export const subtractGeom3 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/subtractGeom3Sub.js b/packages/modeling/src/operations/booleans/subtractGeom3Sub.js index 44fdccc03..09c8e68e0 100644 --- a/packages/modeling/src/operations/booleans/subtractGeom3Sub.js +++ b/packages/modeling/src/operations/booleans/subtractGeom3Sub.js @@ -7,9 +7,9 @@ import { mayOverlap } from './mayOverlap.js' /* * Return a new 3D geometry representing the space in the first geometry but not * in the second geometry. None of the given geometries are modified. - * @param {geom3} geometry1 - a geometry - * @param {geom3} geometry2 - a geometry - * @returns {geom3} new 3D geometry + * @param {Geom3} geometry1 - a geometry + * @param {Geom3} geometry2 - a geometry + * @returns {Geom3} new 3D geometry */ export const subtractGeom3Sub = (geometry1, geometry2) => { if (!mayOverlap(geometry1, geometry2)) { diff --git a/packages/modeling/src/operations/booleans/union.d.ts b/packages/modeling/src/operations/booleans/union.d.ts index 31f94c34b..63d6a51cc 100644 --- a/packages/modeling/src/operations/booleans/union.d.ts +++ b/packages/modeling/src/operations/booleans/union.d.ts @@ -1,5 +1,6 @@ -import { Geom2, Geom3 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2 } from '../../geometries/geom2/type.d.ts' +import type { Geom3 } from '../../geometries/geom3/type.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function union(...geometries: RecursiveArray): Geom2 export function union(...geometries: RecursiveArray): Geom3 diff --git a/packages/modeling/src/operations/booleans/union.js b/packages/modeling/src/operations/booleans/union.js index 553503543..0ed634e4f 100644 --- a/packages/modeling/src/operations/booleans/union.js +++ b/packages/modeling/src/operations/booleans/union.js @@ -12,7 +12,7 @@ import { unionGeom3 } from './unionGeom3.js' * The given geometries should be of the same type, either geom2 or geom3. * * @param {...Object} geometries - list of geometries - * @returns {geom2|geom3} a new geometry + * @returns {Geom2|geom3} a new geometry * @alias module:modeling/booleans.union * * @example diff --git a/packages/modeling/src/operations/booleans/unionGeom2.js b/packages/modeling/src/operations/booleans/unionGeom2.js index 47179075a..e434247d5 100644 --- a/packages/modeling/src/operations/booleans/unionGeom2.js +++ b/packages/modeling/src/operations/booleans/unionGeom2.js @@ -6,7 +6,7 @@ import { boolean } from './martinez/index.js' /* * Return a new 2D geometry representing the total space in the given 2D geometries. * @param {...geom2} geometries - list of 2D geometries to union - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry */ export const unionGeom2 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/unionGeom3.js b/packages/modeling/src/operations/booleans/unionGeom3.js index 1c4810352..7ce2c98ee 100644 --- a/packages/modeling/src/operations/booleans/unionGeom3.js +++ b/packages/modeling/src/operations/booleans/unionGeom3.js @@ -7,7 +7,7 @@ import { unionGeom3Sub } from './unionGeom3Sub.js' /* * Return a new 3D geometry representing the space in the given 3D geometries. * @param {...objects} geometries - list of geometries to union - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry */ export const unionGeom3 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/booleans/unionGeom3Sub.js b/packages/modeling/src/operations/booleans/unionGeom3Sub.js index 213d32513..5bb20c95f 100644 --- a/packages/modeling/src/operations/booleans/unionGeom3Sub.js +++ b/packages/modeling/src/operations/booleans/unionGeom3Sub.js @@ -6,9 +6,9 @@ import { mayOverlap } from './mayOverlap.js' /* * Return a new 3D geometry representing the space in the given geometries. - * @param {geom3} geometry1 - geometry to union - * @param {geom3} geometry2 - geometry to union - * @returns {geom3} new 3D geometry + * @param {Geom3} geometry1 - geometry to union + * @param {Geom3} geometry2 - geometry to union + * @returns {Geom3} new 3D geometry */ export const unionGeom3Sub = (geometry1, geometry2) => { if (!mayOverlap(geometry1, geometry2)) { diff --git a/packages/modeling/src/operations/extrusions/extrudeFromSlices.d.ts b/packages/modeling/src/operations/extrusions/extrudeFromSlices.d.ts index 3fbfe3a14..963d987eb 100644 --- a/packages/modeling/src/operations/extrusions/extrudeFromSlices.d.ts +++ b/packages/modeling/src/operations/extrusions/extrudeFromSlices.d.ts @@ -1,6 +1,5 @@ -import { Geom3 } from '../../geometries/geom3/type' - -import { Slice } from '../../geometries/slice/type' +import type { Geom3 } from '../../geometries/geom3/type.d.ts' +import type { Slice } from '../../geometries/slice/type.d.ts' export interface ExtrudeFromSlicesOptions { numberOfSlices?: number diff --git a/packages/modeling/src/operations/extrusions/extrudeFromSlices.js b/packages/modeling/src/operations/extrusions/extrudeFromSlices.js index e1d7b7edc..ef849eb8f 100644 --- a/packages/modeling/src/operations/extrusions/extrudeFromSlices.js +++ b/packages/modeling/src/operations/extrusions/extrudeFromSlices.js @@ -19,15 +19,15 @@ const defaultCallback = (progress, index, base) => { * Extrude a solid from the slices as returned by the callback function. * @see slice * - * @param {Object} options - options for extrude - * @param {Integer} [options.numberOfSlices=2] the number of slices to be generated by the callback - * @param {Boolean} [options.capStart=true] the solid should have a cap at the start - * @param {Boolean} [options.capEnd=true] the solid should have a cap at the end - * @param {Boolean} [options.close=false] the solid should have a closing section between start and end - * @param {Boolean} [options.repair=true] - repair gaps in the geometry + * @param {object} options - options for extrude + * @param {number} [options.numberOfSlices=2] the number of slices to be generated by the callback + * @param {boolean} [options.capStart=true] the solid should have a cap at the start + * @param {boolean} [options.capEnd=true] the solid should have a cap at the end + * @param {boolean} [options.close=false] the solid should have a closing section between start and end + * @param {boolean} [options.repair=true] - repair gaps in the geometry * @param {Function} [options.callback] the callback function that generates each slice - * @param {Object} base - the base object which is used to create slices (see the example for callback information) - * @return {geom3} the extruded shape + * @param {object} base - the base object which is used to create slices (see the example for callback information) + * @return {Geom3} the extruded shape * @alias module:modeling/extrusions.extrudeFromSlices * * @example diff --git a/packages/modeling/src/operations/extrusions/extrudeHelical.d.ts b/packages/modeling/src/operations/extrusions/extrudeHelical.d.ts index 18ddd3b55..85162bf1e 100644 --- a/packages/modeling/src/operations/extrusions/extrudeHelical.d.ts +++ b/packages/modeling/src/operations/extrusions/extrudeHelical.d.ts @@ -1,4 +1,4 @@ -import { Geom2, Geom3 } from '../../geometries/types' +import type { Geom2, Geom3 } from '../../geometries/types.d.ts' export interface ExtrudeHelicalOptions { angle?: number diff --git a/packages/modeling/src/operations/extrusions/extrudeHelical.js b/packages/modeling/src/operations/extrusions/extrudeHelical.js index 7dbc0f04b..20dadbd01 100644 --- a/packages/modeling/src/operations/extrusions/extrudeHelical.js +++ b/packages/modeling/src/operations/extrusions/extrudeHelical.js @@ -8,15 +8,15 @@ import { extrudeFromSlices } from './extrudeFromSlices.js' /** * Perform a helical extrude of the geometry, using the given options. * - * @param {Object} options - options for extrusion - * @param {Number} [options.angle=TAU] - angle of the extrusion (RADIANS) positive for right-hand rotation, negative for left-hand - * @param {Number} [options.startAngle=0] - start angle of the extrusion (RADIANS) - * @param {Number} [options.pitch=10] - elevation gain for each turn - * @param {Number} [options.height] - total height of the helix path. Ignored if pitch is set. - * @param {Number} [options.endOffset=0] - offset the final radius of the extrusion, allowing for tapered helix, and or spiral - * @param {Number} [options.segmentsPerRotation=32] - number of segments per full rotation of the extrusion - * @param {geom2} geometry - the geometry to extrude - * @returns {geom3} the extruded geometry + * @param {object} options - options for extrusion + * @param {number} [options.angle=TAU] - angle of the extrusion (RADIANS) positive for right-hand rotation, negative for left-hand + * @param {number} [options.startAngle=0] - start angle of the extrusion (RADIANS) + * @param {number} [options.pitch=10] - elevation gain for each turn + * @param {number} [options.height] - total height of the helix path. Ignored if pitch is set. + * @param {number} [options.endOffset=0] - offset the final radius of the extrusion, allowing for tapered helix, and or spiral + * @param {number} [options.segmentsPerRotation=32] - number of segments per full rotation of the extrusion + * @param {Geom2} geometry - the geometry to extrude + * @returns {Geom3} the extruded geometry * @alias module:modeling/extrusions.extrudeHelical * * @example diff --git a/packages/modeling/src/operations/extrusions/extrudeLinear.d.ts b/packages/modeling/src/operations/extrusions/extrudeLinear.d.ts index 061ad97fc..f5b05b928 100644 --- a/packages/modeling/src/operations/extrusions/extrudeLinear.d.ts +++ b/packages/modeling/src/operations/extrusions/extrudeLinear.d.ts @@ -1,5 +1,5 @@ -import { Path2, Geom2, Geom3 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Path2, Geom2, Geom3 } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface ExtrudeLinearOptions { height?: number diff --git a/packages/modeling/src/operations/extrusions/extrudeLinear.js b/packages/modeling/src/operations/extrusions/extrudeLinear.js index ddc409612..6fa9e250c 100644 --- a/packages/modeling/src/operations/extrusions/extrudeLinear.js +++ b/packages/modeling/src/operations/extrusions/extrudeLinear.js @@ -10,10 +10,10 @@ import { extrudeLinearPath2 } from './extrudeLinearPath2.js' * Extrude the given geometry in an upward linear direction using the given options. * Accepts path2 or geom2 objects as input. Paths must be closed. * - * @param {Object} options - options for extrude - * @param {Number} [options.height=1] the height of the extrusion - * @param {Number} [options.twistAngle=0] the final rotation (RADIANS) about the origin of the shape (if any) - * @param {Integer} [options.twistSteps=1] the resolution of the twist about the axis (if any) + * @param {object} options - options for extrude + * @param {number} [options.height=1] the height of the extrusion + * @param {number} [options.twistAngle=0] the final rotation (RADIANS) about the origin of the shape (if any) + * @param {number} [options.twistSteps=1] the resolution of the twist about the axis (if any) * @param {...Object} objects - the geometries to extrude * @return {Object|Array} the extruded geometry, or a list of extruded geometry * @alias module:modeling/extrusions.extrudeLinear diff --git a/packages/modeling/src/operations/extrusions/extrudeLinearGeom2.js b/packages/modeling/src/operations/extrusions/extrudeLinearGeom2.js index fa3590f3e..bd753a550 100644 --- a/packages/modeling/src/operations/extrusions/extrudeLinearGeom2.js +++ b/packages/modeling/src/operations/extrusions/extrudeLinearGeom2.js @@ -8,13 +8,13 @@ import { extrudeFromSlices } from './extrudeFromSlices.js' /* * Extrude the given geometry using the given options. * - * @param {Object} [options] - options for extrude + * @param {object} [options] - options for extrude * @param {Array} [options.offset] - the direction of the extrusion as a 3D vector - * @param {Number} [options.twistAngle] - the final rotation (RADIANS) about the origin - * @param {Integer} [options.twistSteps] - the number of steps created to produce the twist (if any) - * @param {Boolean} [options.repair] - repair gaps in the geometry - * @param {geom2} geometry - the geometry to extrude - * @returns {geom3} the extruded 3D geometry + * @param {number} [options.twistAngle] - the final rotation (RADIANS) about the origin + * @param {number} [options.twistSteps] - the number of steps created to produce the twist (if any) + * @param {boolean} [options.repair] - repair gaps in the geometry + * @param {Geom2} geometry - the geometry to extrude + * @returns {Geom3} the extruded 3D geometry */ export const extrudeLinearGeom2 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/extrusions/extrudeLinearPath2.js b/packages/modeling/src/operations/extrusions/extrudeLinearPath2.js index d648a4b3d..bfbf7acd3 100644 --- a/packages/modeling/src/operations/extrusions/extrudeLinearPath2.js +++ b/packages/modeling/src/operations/extrusions/extrudeLinearPath2.js @@ -6,12 +6,12 @@ import { extrudeLinearGeom2 } from './extrudeLinearGeom2.js' /* * Extrude the given geometry using the given options. * - * @param {Object} [options] - options for extrude + * @param {object} [options] - options for extrude * @param {Array} [options.offset] - the direction of the extrusion as a 3D vector - * @param {Number} [options.twistAngle] - the final rotation (RADIANS) about the origin - * @param {Integer} [options.twistSteps] - the number of steps created to produce the twist (if any) - * @param {path2} geometry - the geometry to extrude - * @returns {geom3} the extruded 3D geometry + * @param {number} [options.twistAngle] - the final rotation (RADIANS) about the origin + * @param {number} [options.twistSteps] - the number of steps created to produce the twist (if any) + * @param {Path2} geometry - the geometry to extrude + * @returns {Geom3} the extruded 3D geometry */ export const extrudeLinearPath2 = (options, geometry) => { if (!geometry.isClosed) throw new Error('extruded path must be closed') diff --git a/packages/modeling/src/operations/extrusions/extrudeRectangular.d.ts b/packages/modeling/src/operations/extrusions/extrudeRectangular.d.ts index 7f503eb05..cdb698baf 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRectangular.d.ts +++ b/packages/modeling/src/operations/extrusions/extrudeRectangular.d.ts @@ -1,6 +1,6 @@ -import { Path2, Geom2, Geom3 } from '../../geometries/types' -import { Corners } from '../../utils/corners' -import RecursiveArray from '../../utils/recursiveArray' +import type { Path2, Geom2, Geom3 } from '../../geometries/types.d.ts' +import type { Corners } from '../../utils/corners.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface ExtrudeRectangularOptions { size?: number diff --git a/packages/modeling/src/operations/extrusions/extrudeRectangular.js b/packages/modeling/src/operations/extrusions/extrudeRectangular.js index ccacaba39..325e76bdc 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRectangular.js +++ b/packages/modeling/src/operations/extrusions/extrudeRectangular.js @@ -9,9 +9,9 @@ import { extrudeRectangularGeom2 } from './extrudeRectangularGeom2.js' /** * Extrude the given geometry by following the outline(s) with a rectangle. * @See expand for addition options - * @param {Object} options - options for extrusion, if any - * @param {Number} [options.size=1] - size of the rectangle - * @param {Number} [options.height=1] - height of the extrusion + * @param {object} options - options for extrusion, if any + * @param {number} [options.size=1] - size of the rectangle + * @param {number} [options.height=1] - height of the extrusion * @param {...Object} objects - the geometries to extrude * @return {Object|Array} the extruded object, or a list of extruded objects * @alias module:modeling/extrusions.extrudeRectangular diff --git a/packages/modeling/src/operations/extrusions/extrudeRectangularGeom2.js b/packages/modeling/src/operations/extrusions/extrudeRectangularGeom2.js index 302bcea72..9f6fd7710 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRectangularGeom2.js +++ b/packages/modeling/src/operations/extrusions/extrudeRectangularGeom2.js @@ -10,11 +10,11 @@ import { extrudeLinearGeom2 } from './extrudeLinearGeom2.js' /* * Expand and extrude the given geometry (geom2). * @see offset for additional options - * @param {Object} options - options for extrusion, if any - * @param {Number} [options.size=1] - size of the rectangle - * @param {Number} [options.height=1] - height of the extrusion - * @param {geom2} geometry - the geometry to extrude - * @return {geom3} the extruded geometry + * @param {object} options - options for extrusion, if any + * @param {number} [options.size=1] - size of the rectangle + * @param {number} [options.height=1] - height of the extrusion + * @param {Geom2} geometry - the geometry to extrude + * @return {Geom3} the extruded geometry */ export const extrudeRectangularGeom2 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/extrusions/extrudeRectangularPath2.js b/packages/modeling/src/operations/extrusions/extrudeRectangularPath2.js index 479ac10d7..cc0baac49 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRectangularPath2.js +++ b/packages/modeling/src/operations/extrusions/extrudeRectangularPath2.js @@ -7,11 +7,11 @@ import { extrudeLinearGeom2 } from './extrudeLinearGeom2.js' /* * Expand and extrude the given geometry (path2). * @See expand for addition options - * @param {Object} options - options for extrusion, if any - * @param {Number} [options.size=1] - size of the rectangle - * @param {Number} [options.height=1] - height of the extrusion - * @param {path2} geometry - the geometry to extrude - * @return {geom3} the extruded geometry + * @param {object} options - options for extrusion, if any + * @param {number} [options.size=1] - size of the rectangle + * @param {number} [options.height=1] - height of the extrusion + * @param {Path2} geometry - the geometry to extrude + * @return {Geom3} the extruded geometry */ export const extrudeRectangularPath2 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/extrusions/extrudeRotate.d.ts b/packages/modeling/src/operations/extrusions/extrudeRotate.d.ts index efe9dcf9c..92410cb48 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRotate.d.ts +++ b/packages/modeling/src/operations/extrusions/extrudeRotate.d.ts @@ -1,4 +1,4 @@ -import { Geom2, Geom3 } from '../../geometries/types' +import type { Geom2, Geom3 } from '../../geometries/types.d.ts' export interface ExtrudeRotateOptions { angle?: number diff --git a/packages/modeling/src/operations/extrusions/extrudeRotate.js b/packages/modeling/src/operations/extrusions/extrudeRotate.js index c5bbcb986..f1d69f9c7 100644 --- a/packages/modeling/src/operations/extrusions/extrudeRotate.js +++ b/packages/modeling/src/operations/extrusions/extrudeRotate.js @@ -11,14 +11,14 @@ import { extrudeFromSlices } from './extrudeFromSlices.js' /** * Rotate extrude the given geometry using the given options. * - * @param {Object} options - options for extrusion - * @param {Number} [options.angle=TAU] - angle of the extrusion (RADIANS) - * @param {Number} [options.startAngle=0] - start angle of the extrusion (RADIANS) - * @param {String} [options.overflow='cap'] - what to do with points outside of bounds (+ / - x) : + * @param {object} options - options for extrusion + * @param {number} [options.angle=TAU] - angle of the extrusion (RADIANS) + * @param {number} [options.startAngle=0] - start angle of the extrusion (RADIANS) + * @param {string} [options.overflow='cap'] - what to do with points outside of bounds (+ / - x) : * defaults to capping those points to 0 (only supported behaviour for now) - * @param {Number} [options.segments=12] - number of segments of the extrusion - * @param {geom2} geometry - the geometry to extrude - * @returns {geom3} the extruded geometry + * @param {number} [options.segments=12] - number of segments of the extrusion + * @param {Geom2} geometry - the geometry to extrude + * @returns {Geom3} the extruded geometry * @alias module:modeling/extrusions.extrudeRotate * * @example diff --git a/packages/modeling/src/operations/extrusions/index.d.ts b/packages/modeling/src/operations/extrusions/index.d.ts index 4868db248..67079129f 100644 --- a/packages/modeling/src/operations/extrusions/index.d.ts +++ b/packages/modeling/src/operations/extrusions/index.d.ts @@ -1,8 +1,6 @@ -export { extrudeFromSlices, ExtrudeFromSlicesOptions } from './extrudeFromSlices' -export { extrudeLinear, ExtrudeLinearOptions } from './extrudeLinear' -export { extrudeRectangular, ExtrudeRectangularOptions } from './extrudeRectangular' -export { extrudeRotate, ExtrudeRotateOptions } from './extrudeRotate' -export { extrudeHelical, ExtrudeHelicalOptions } from './extrudeHelical' -export { project, ProjectOptions } from './project' - -export as namespace extrusions +export { extrudeFromSlices, ExtrudeFromSlicesOptions } from './extrudeFromSlices.js' +export { extrudeLinear, ExtrudeLinearOptions } from './extrudeLinear.js' +export { extrudeRectangular, ExtrudeRectangularOptions } from './extrudeRectangular.js' +export { extrudeRotate, ExtrudeRotateOptions } from './extrudeRotate.js' +export { extrudeHelical, ExtrudeHelicalOptions } from './extrudeHelical.js' +export { project, ProjectOptions } from './project.js' diff --git a/packages/modeling/src/operations/extrusions/project.d.ts b/packages/modeling/src/operations/extrusions/project.d.ts index e0716eb5e..8989f1cac 100644 --- a/packages/modeling/src/operations/extrusions/project.d.ts +++ b/packages/modeling/src/operations/extrusions/project.d.ts @@ -1,6 +1,6 @@ -import { Geom2, Geom3 } from '../../geometries/types' -import { Vec3 } from '../../maths/vec3' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2, Geom3 } from '../../geometries/types.d.ts' +import type { Vec3 } from '../../maths/vec3/index.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface ProjectOptions { axis?: Vec3 diff --git a/packages/modeling/src/operations/extrusions/project.js b/packages/modeling/src/operations/extrusions/project.js index 9c40ec7fd..169ee3df4 100644 --- a/packages/modeling/src/operations/extrusions/project.js +++ b/packages/modeling/src/operations/extrusions/project.js @@ -63,11 +63,11 @@ const projectGeom3 = (options, geometry) => { /** * Project the given 3D geometry on to the given plane. - * @param {Object} options - options for project + * @param {object} options - options for project * @param {Array} [options.axis=[0,0,1]] the axis of the plane (default is Z axis) * @param {Array} [options.origin=[0,0,0]] the origin of the plane * @param {...Object} objects - the list of 3D geometry to project - * @return {geom2|Array} the projected 2D geometry, or a list of 2D projected geometry + * @return {Geom2|Array} the projected 2D geometry, or a list of 2D projected geometry * @alias module:modeling/extrusions.project * * @example diff --git a/packages/modeling/src/operations/hulls/hull.d.ts b/packages/modeling/src/operations/hulls/hull.d.ts index 0610d906a..ce7b3d538 100644 --- a/packages/modeling/src/operations/hulls/hull.d.ts +++ b/packages/modeling/src/operations/hulls/hull.d.ts @@ -1,5 +1,5 @@ -import { Geom2, Geom3, Path2 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2, Geom3, Path2 } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function hull(...geometries: RecursiveArray): Geom2 export function hull(...geometries: RecursiveArray): Geom3 diff --git a/packages/modeling/src/operations/hulls/hull.js b/packages/modeling/src/operations/hulls/hull.js index 12ad594f8..78deb2083 100644 --- a/packages/modeling/src/operations/hulls/hull.js +++ b/packages/modeling/src/operations/hulls/hull.js @@ -13,7 +13,7 @@ import { hullGeom3 } from './hullGeom3.js' * Create a convex hull of the given geometries. * The given geometries should be of the same type, either geom2 or geom3 or path2. * @param {...Objects} geometries - list of geometries from which to create a hull - * @returns {geom2|geom3} new geometry + * @returns {Geom2|Geom3} new geometry * @alias module:modeling/hulls.hull * * @example diff --git a/packages/modeling/src/operations/hulls/hullChain.d.ts b/packages/modeling/src/operations/hulls/hullChain.d.ts index 115fd59f4..a2186cbd8 100644 --- a/packages/modeling/src/operations/hulls/hullChain.d.ts +++ b/packages/modeling/src/operations/hulls/hullChain.d.ts @@ -1,5 +1,5 @@ -import { Geom2, Geom3, Path2 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geom2, Geom3, Path2 } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function hullChain(...geometries: RecursiveArray): Geom2 export function hullChain(...geometries: RecursiveArray): Geom3 diff --git a/packages/modeling/src/operations/hulls/hullChain.js b/packages/modeling/src/operations/hulls/hullChain.js index 80d679b6c..4df3a2cdf 100644 --- a/packages/modeling/src/operations/hulls/hullChain.js +++ b/packages/modeling/src/operations/hulls/hullChain.js @@ -10,7 +10,7 @@ import { hull } from './hull.js' * The given geometries should be of the same type, either geom2 or geom3 or path2. * * @param {...Objects} geometries - list of geometries from which to create a hull - * @returns {geom2|geom3} new geometry + * @returns {Geom2|Geom3} new geometry * @alias module:modeling/hulls.hullChain * * @example diff --git a/packages/modeling/src/operations/hulls/hullGeom2.js b/packages/modeling/src/operations/hulls/hullGeom2.js index 3edfcca0d..cb6710a68 100644 --- a/packages/modeling/src/operations/hulls/hullGeom2.js +++ b/packages/modeling/src/operations/hulls/hullGeom2.js @@ -8,7 +8,7 @@ import { toUniquePoints } from './toUniquePoints.js' /* * Create a convex hull of the given geom2 geometries. * @param {...geometries} geometries - list of geom2 geometries - * @returns {geom2} new geometry + * @returns {Geom2} new geometry */ export const hullGeom2 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/hulls/hullGeom3.js b/packages/modeling/src/operations/hulls/hullGeom3.js index 62939c4bd..6d74f8f50 100644 --- a/packages/modeling/src/operations/hulls/hullGeom3.js +++ b/packages/modeling/src/operations/hulls/hullGeom3.js @@ -9,7 +9,7 @@ import { toUniquePoints } from './toUniquePoints.js' /* * Create a convex hull of the given geometries (geom3). * @param {...geometries} geometries - list of geom3 geometries - * @returns {geom3} new geometry + * @returns {Geom3} new geometry */ export const hullGeom3 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/hulls/hullPath2.js b/packages/modeling/src/operations/hulls/hullPath2.js index ed4b8304f..f964274d0 100644 --- a/packages/modeling/src/operations/hulls/hullPath2.js +++ b/packages/modeling/src/operations/hulls/hullPath2.js @@ -8,7 +8,7 @@ import { toUniquePoints } from './toUniquePoints.js' /* * Create a convex hull of the given geometries (path2). * @param {...geometries} geometries - list of path2 geometries - * @returns {path2} new geometry + * @returns {Path2} new geometry */ export const hullPath2 = (...geometries) => { geometries = flatten(geometries) diff --git a/packages/modeling/src/operations/hulls/index.d.ts b/packages/modeling/src/operations/hulls/index.d.ts index 58aed98c3..7d87025e6 100644 --- a/packages/modeling/src/operations/hulls/index.d.ts +++ b/packages/modeling/src/operations/hulls/index.d.ts @@ -1,4 +1,2 @@ -export { hull } from './hull' -export { hullChain } from './hullChain' - -export as namespace hulls +export { hull } from './hull.js' +export { hullChain } from './hullChain.js' diff --git a/packages/modeling/src/operations/modifiers/generalize.d.ts b/packages/modeling/src/operations/modifiers/generalize.d.ts index 5ab0a4432..e61bcadcd 100644 --- a/packages/modeling/src/operations/modifiers/generalize.d.ts +++ b/packages/modeling/src/operations/modifiers/generalize.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface GeneralizeOptions { snap?: boolean diff --git a/packages/modeling/src/operations/modifiers/generalize.js b/packages/modeling/src/operations/modifiers/generalize.js index 3e994387c..3eaafdac9 100644 --- a/packages/modeling/src/operations/modifiers/generalize.js +++ b/packages/modeling/src/operations/modifiers/generalize.js @@ -58,10 +58,10 @@ const generalizeGeom3 = (options, geometry) => { /** * Apply various modifications in proper order to produce a generalized geometry. - * @param {Object} options - options for modifications - * @param {Boolean} [options.snap=false] the geometries should be snapped to epsilons - * @param {Boolean} [options.simplify=false] the geometries should be simplified - * @param {Boolean} [options.triangulate=false] the geometries should be triangulated + * @param {object} options - options for modifications + * @param {boolean} [options.snap=false] the geometries should be snapped to epsilons + * @param {boolean} [options.simplify=false] the geometries should be simplified + * @param {boolean} [options.triangulate=false] the geometries should be triangulated * @param {...Object} geometries - the geometries to generalize * @return {Object|Array} the modified geometry, or a list of modified geometries * @alias module:modeling/modifiers.generalize diff --git a/packages/modeling/src/operations/modifiers/index.d.ts b/packages/modeling/src/operations/modifiers/index.d.ts index 73666d2f5..2c8b3b14a 100644 --- a/packages/modeling/src/operations/modifiers/index.d.ts +++ b/packages/modeling/src/operations/modifiers/index.d.ts @@ -1,3 +1,3 @@ -export { generalize } from './generalize' -export { snap } from './snap' -export { retessellate } from './retessellate' +export { generalize } from './generalize.js' +export { snap } from './snap.js' +export { retessellate } from './retessellate.js' diff --git a/packages/modeling/src/operations/modifiers/mergePolygons.js b/packages/modeling/src/operations/modifiers/mergePolygons.js index 6ca3ce188..a499aefd8 100644 --- a/packages/modeling/src/operations/modifiers/mergePolygons.js +++ b/packages/modeling/src/operations/modifiers/mergePolygons.js @@ -87,8 +87,8 @@ const createPolygonAnd = (edge) => { /* * Merge COPLANAR polygons that share common edges. - * @param {poly3[]} sourcePolygons - list of polygons - * @returns {poly3[]} new set of polygons + * @param {Poly3[]} sourcePolygons - list of polygons + * @returns {Poly3[]} new set of polygons */ export const mergeCoplanarPolygons = (sourcePolygons) => { if (sourcePolygons.length < 2) return sourcePolygons diff --git a/packages/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js b/packages/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js index 30431210b..ce4232558 100644 --- a/packages/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js +++ b/packages/modeling/src/operations/modifiers/reTesselateCoplanarPolygons.js @@ -11,8 +11,8 @@ import * as poly3 from '../../geometries/poly3/index.js' /* * Retesselation for a set of COPLANAR polygons. - * @param {poly3[]} sourcePolygons - list of polygons - * @returns {poly3[]} new set of polygons + * @param {Poly3[]} sourcePolygons - list of polygons + * @returns {Poly3[]} new set of polygons */ export const reTesselateCoplanarPolygons = (sourcePolygons) => { if (sourcePolygons.length < 2) return sourcePolygons diff --git a/packages/modeling/src/operations/modifiers/retessellate.d.ts b/packages/modeling/src/operations/modifiers/retessellate.d.ts index b7543a558..7d2b15800 100644 --- a/packages/modeling/src/operations/modifiers/retessellate.d.ts +++ b/packages/modeling/src/operations/modifiers/retessellate.d.ts @@ -1,3 +1,3 @@ -import { Geom3 } from '../../geometries/types' +import type { Geom3 } from '../../geometries/geom3/type.d.ts' export function retessellate(geometry: Geom3): Geom3 diff --git a/packages/modeling/src/operations/modifiers/snap.d.ts b/packages/modeling/src/operations/modifiers/snap.d.ts index 98c01c401..e414e66a5 100644 --- a/packages/modeling/src/operations/modifiers/snap.d.ts +++ b/packages/modeling/src/operations/modifiers/snap.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function snap(geometry: T): T export function snap(...geometries: RecursiveArray): Array diff --git a/packages/modeling/src/operations/offsets/index.d.ts b/packages/modeling/src/operations/offsets/index.d.ts index d0c540ccb..862943468 100644 --- a/packages/modeling/src/operations/offsets/index.d.ts +++ b/packages/modeling/src/operations/offsets/index.d.ts @@ -1,4 +1,2 @@ -export { offset, OffsetOptions } from './offset' -export { offsetFromPoints } from './offset' - -export as namespace offsets +export { offset, OffsetOptions } from './offset.js' +export { offsetFromPoints } from './offset.js' diff --git a/packages/modeling/src/operations/offsets/offset.d.ts b/packages/modeling/src/operations/offsets/offset.d.ts index 4f51566a6..033b04035 100644 --- a/packages/modeling/src/operations/offsets/offset.d.ts +++ b/packages/modeling/src/operations/offsets/offset.d.ts @@ -1,5 +1,5 @@ -import { Path2, Geom2 } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Path2, Geom2 } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' type Geometry = Path2 | Geom2 | Geom3 diff --git a/packages/modeling/src/operations/offsets/offset.js b/packages/modeling/src/operations/offsets/offset.js index 8ad340158..110b631ee 100644 --- a/packages/modeling/src/operations/offsets/offset.js +++ b/packages/modeling/src/operations/offsets/offset.js @@ -11,10 +11,10 @@ import { offsetPath2 } from './offsetPath2.js' /** * Create offset geometry from the given geometry using the given options. * Offsets from internal and external space are created. - * @param {Object} options - options for offset + * @param {object} options - options for offset * @param {Float} [options.delta=1] - delta of offset (+ to exterior, - from interior) - * @param {String} [options.corners='edge'] - type of corner to create after offseting; edge, chamfer, round - * @param {Integer} [options.segments=16] - number of segments when creating round corners + * @param {string} [options.corners='edge'] - type of corner to create after offseting; edge, chamfer, round + * @param {number} [options.segments=16] - number of segments when creating round corners * @param {...Object} objects - the geometries to offset * @return {Object|Array} new geometry, or list of new geometries * @alias module:modeling/offsets.offset diff --git a/packages/modeling/src/operations/offsets/offsetFromPoints.d.ts b/packages/modeling/src/operations/offsets/offsetFromPoints.d.ts index 5bb49f04a..ed48a5f60 100644 --- a/packages/modeling/src/operations/offsets/offsetFromPoints.d.ts +++ b/packages/modeling/src/operations/offsets/offsetFromPoints.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from '../../maths/vec2/type' +import type { Vec2 } from '../../maths/vec2/type.d.ts' export interface OffsetFromPointsOptions { delta?: number diff --git a/packages/modeling/src/operations/offsets/offsetFromPoints.js b/packages/modeling/src/operations/offsets/offsetFromPoints.js index 03826b918..74198ceff 100644 --- a/packages/modeling/src/operations/offsets/offsetFromPoints.js +++ b/packages/modeling/src/operations/offsets/offsetFromPoints.js @@ -8,11 +8,11 @@ import * as vec2 from '../../maths/vec2/index.js' /** * Create a set of offset points from the given points using the given options (if any). - * @param {Object} options - options for offset + * @param {object} options - options for offset * @param {Float} [options.delta=1] - delta of offset (+ to exterior, - from interior) - * @param {String} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round - * @param {Integer} [options.segments=16] - number of segments when creating round corners - * @param {Integer} [options.closed=false] - is the last point connected back to the first point? + * @param {string} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round + * @param {number} [options.segments=16] - number of segments when creating round corners + * @param {number} [options.closed=false] - is the last point connected back to the first point? * @param {Array} points - array of 2D points * @returns {Array} new set of offset points, plus points for each rounded corner * @alias module:modeling/offsets.offsetFromPoints diff --git a/packages/modeling/src/operations/offsets/offsetGeom2.js b/packages/modeling/src/operations/offsets/offsetGeom2.js index 95ab845c2..b6370b90d 100644 --- a/packages/modeling/src/operations/offsets/offsetGeom2.js +++ b/packages/modeling/src/operations/offsets/offsetGeom2.js @@ -5,12 +5,12 @@ import { offsetFromPoints } from './offsetFromPoints.js' /* * Create an offset geometry from the given geom2 using the given options (if any). - * @param {Object} options - options for offset + * @param {object} options - options for offset * @param {Float} [options.delta=1] - delta of offset (+ to exterior, - from interior) - * @param {String} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round - * @param {Integer} [options.segments=16] - number of segments when creating round corners - * @param {geom2} geometry - geometry from which to create the offset - * @returns {geom2} offset geometry, plus rounded corners + * @param {string} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round + * @param {number} [options.segments=16] - number of segments when creating round corners + * @param {Geom2} geometry - geometry from which to create the offset + * @returns {Geom2} offset geometry, plus rounded corners */ export const offsetGeom2 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/offsets/offsetGeom3.js b/packages/modeling/src/operations/offsets/offsetGeom3.js index b8f53d4b3..9c9a44115 100644 --- a/packages/modeling/src/operations/offsets/offsetGeom3.js +++ b/packages/modeling/src/operations/offsets/offsetGeom3.js @@ -6,12 +6,12 @@ import { offsetShell } from './offsetShell.js' /* * Expand the given geometry (geom3) using the given options (if any). - * @param {Object} options - options for expand - * @param {Number} [options.delta=1] - delta (+/-) of expansion - * @param {String} [options.corners='round'] - type corner to create during of expansion; round - * @param {Integer} [options.segments=12] - number of segments when creating round corners - * @param {geom3} geometry - the geometry to expand - * @returns {geom3} expanded geometry + * @param {object} options - options for expand + * @param {number} [options.delta=1] - delta (+/-) of expansion + * @param {string} [options.corners='round'] - type corner to create during of expansion; round + * @param {number} [options.segments=12] - number of segments when creating round corners + * @param {Geom3} geometry - the geometry to expand + * @returns {Geom3} expanded geometry */ export const offsetGeom3 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/offsets/offsetPath2.js b/packages/modeling/src/operations/offsets/offsetPath2.js index f4148ed11..1e51e6027 100644 --- a/packages/modeling/src/operations/offsets/offsetPath2.js +++ b/packages/modeling/src/operations/offsets/offsetPath2.js @@ -54,12 +54,12 @@ const createGeometryFromOpenPath = (paths, segments, corners, delta) => { /* * Expand the given geometry (path2) using the given options (if any). - * @param {Object} options - options for offset - * @param {Number} [options.delta=1] - delta (+) of expansion - * @param {String} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round - * @param {Integer} [options.segments=16] - number of segments when creating round corners - * @param {path2} geometry - the geometry to offset - * @returns {geom2} offset geometry + * @param {object} options - options for offset + * @param {number} [options.delta=1] - delta (+) of expansion + * @param {string} [options.corners='edge'] - type corner to create during of expansion; edge, chamfer, round + * @param {number} [options.segments=16] - number of segments when creating round corners + * @param {Path2} geometry - the geometry to offset + * @returns {Geom2} offset geometry */ export const offsetPath2 = (options, geometry) => { const defaults = { diff --git a/packages/modeling/src/operations/transforms/align.d.ts b/packages/modeling/src/operations/transforms/align.d.ts index 8b8209104..9e78ffffe 100644 --- a/packages/modeling/src/operations/transforms/align.d.ts +++ b/packages/modeling/src/operations/transforms/align.d.ts @@ -1,5 +1,5 @@ -import { Geometry } from '../../geometries/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' type NullableNumber = null | number diff --git a/packages/modeling/src/operations/transforms/align.js b/packages/modeling/src/operations/transforms/align.js index 997d7fa5e..8015eaa2d 100644 --- a/packages/modeling/src/operations/transforms/align.js +++ b/packages/modeling/src/operations/transforms/align.js @@ -52,10 +52,10 @@ const alignGeometries = (geometry, modes, relativeTo) => { /** * Align the boundaries of the given geometries using the given options. - * @param {Object} options - options for aligning + * @param {object} options - options for aligning * @param {Array} [options.modes = ['center', 'center', 'min']] - the point on the geometries to align to for each axis. Valid options are "center", "max", "min", and "none". * @param {Array} [options.relativeTo = [0,0,0]] - The point one each axis on which to align the geometries upon. If the value is null, then the corresponding value from the group's bounding box is used. - * @param {Boolean} [options.grouped = false] - if true, transform all geometries by the same amount, maintaining the relative positions to each other. + * @param {boolean} [options.grouped = false] - if true, transform all geometries by the same amount, maintaining the relative positions to each other. * @param {...Object} geometries - the geometries to align * @return {Object|Array} the aligned geometry, or a list of aligned geometries * @alias module:modeling/transforms.align diff --git a/packages/modeling/src/operations/transforms/center.d.ts b/packages/modeling/src/operations/transforms/center.d.ts index ffb6f1082..c54ae3ee7 100644 --- a/packages/modeling/src/operations/transforms/center.d.ts +++ b/packages/modeling/src/operations/transforms/center.d.ts @@ -1,6 +1,6 @@ -import { Geometry } from '../../geometries/types' -import { Vec3 } from '../../maths/vec3/type' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { Vec3 } from '../../maths/vec3/type.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface CenterOptions { axes?: [boolean, boolean, boolean] diff --git a/packages/modeling/src/operations/transforms/center.js b/packages/modeling/src/operations/transforms/center.js index 6f653e7e5..de7d297a0 100644 --- a/packages/modeling/src/operations/transforms/center.js +++ b/packages/modeling/src/operations/transforms/center.js @@ -25,7 +25,7 @@ const centerGeometry = (options, object) => { /** * Center the given objects using the given options. - * @param {Object} options - options for centering + * @param {object} options - options for centering * @param {Array} [options.axes=[true,true,true]] - axis of which to center, true or false * @param {Array} [options.relativeTo=[0,0,0]] - relative point of which to center the objects * @param {...Object} objects - the objects to center diff --git a/packages/modeling/src/operations/transforms/index.d.ts b/packages/modeling/src/operations/transforms/index.d.ts index 1391c6264..e4f99909b 100644 --- a/packages/modeling/src/operations/transforms/index.d.ts +++ b/packages/modeling/src/operations/transforms/index.d.ts @@ -1,9 +1,7 @@ -export { align, AlignOptions } from './align' -export * from './center' -export * from './mirror' -export * from './rotate' -export * from './scale' -export * from './transform' -export * from './translate' - -export as namespace transforms +export { align, AlignOptions } from './align.js' +export * from './center.js' +export * from './mirror.js' +export * from './rotate.js' +export * from './scale.js' +export * from './transform.js' +export * from './translate.js' diff --git a/packages/modeling/src/operations/transforms/mirror.d.ts b/packages/modeling/src/operations/transforms/mirror.d.ts index e67095f52..a198273fb 100644 --- a/packages/modeling/src/operations/transforms/mirror.d.ts +++ b/packages/modeling/src/operations/transforms/mirror.d.ts @@ -1,6 +1,6 @@ -import { Geometry } from '../../geometries/types' -import { Vec3 } from '../../maths/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { Vec3 } from '../../maths/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export interface MirrorOptions { origin?: Vec3 diff --git a/packages/modeling/src/operations/transforms/mirror.js b/packages/modeling/src/operations/transforms/mirror.js index 507af51f5..9a1a6d1f6 100644 --- a/packages/modeling/src/operations/transforms/mirror.js +++ b/packages/modeling/src/operations/transforms/mirror.js @@ -9,7 +9,7 @@ import * as path2 from '../../geometries/path2/index.js' /** * Mirror the given objects using the given options. - * @param {Object} options - options for mirror + * @param {object} options - options for mirror * @param {Array} [options.origin=[0,0,0]] - the origin of the plane * @param {Array} [options.normal=[0,0,1]] - the normal vector of the plane * @param {...Object} objects - the objects to mirror diff --git a/packages/modeling/src/operations/transforms/rotate.d.ts b/packages/modeling/src/operations/transforms/rotate.d.ts index 9e91de354..32284b14a 100644 --- a/packages/modeling/src/operations/transforms/rotate.d.ts +++ b/packages/modeling/src/operations/transforms/rotate.d.ts @@ -1,10 +1,10 @@ -import { Geometry } from '../../geometries/types' -import { Vec1, Vec2, Vec3 } from '../../maths/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { Vec } from '../../maths/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' -export function rotate(angles: Vec1 | Vec2 | Vec3, geometry: T): T -export function rotate(angles: Vec1 | Vec2 | Vec3, ...geometries: RecursiveArray): Array -export function rotate(angles: Vec1 | Vec2 | Vec3, ...geometries: RecursiveArray): Array +export function rotate(angles: Vec, geometry: T): T +export function rotate(angles: Vec, ...geometries: RecursiveArray): Array +export function rotate(angles: Vec, ...geometries: RecursiveArray): Array export function rotateX(angle: number, geometry: T): T export function rotateX(angle: number, ...geometries: RecursiveArray): Array diff --git a/packages/modeling/src/operations/transforms/rotate.js b/packages/modeling/src/operations/transforms/rotate.js index 92e36da4c..ff9fc638a 100644 --- a/packages/modeling/src/operations/transforms/rotate.js +++ b/packages/modeling/src/operations/transforms/rotate.js @@ -43,7 +43,7 @@ export const rotate = (angles, ...objects) => { /** * Rotate the given objects about the X axis, using the given options. - * @param {Number} angle - angle (RADIANS) of rotations about X + * @param {number} angle - angle (RADIANS) of rotations about X * @param {...Object} objects - the objects to rotate * @return {Object|Array} the rotated object, or a list of rotated objects * @alias module:modeling/transforms.rotateX @@ -52,7 +52,7 @@ export const rotateX = (angle, ...objects) => rotate([angle, 0, 0], objects) /** * Rotate the given objects about the Y axis, using the given options. - * @param {Number} angle - angle (RADIANS) of rotations about Y + * @param {number} angle - angle (RADIANS) of rotations about Y * @param {...Object} objects - the objects to rotate * @return {Object|Array} the rotated object, or a list of rotated objects * @alias module:modeling/transforms.rotateY @@ -61,7 +61,7 @@ export const rotateY = (angle, ...objects) => rotate([0, angle, 0], objects) /** * Rotate the given objects about the Z axis, using the given options. - * @param {Number} angle - angle (RADIANS) of rotations about Z + * @param {number} angle - angle (RADIANS) of rotations about Z * @param {...Object} objects - the objects to rotate * @return {Object|Array} the rotated object, or a list of rotated objects * @alias module:modeling/transforms.rotateZ diff --git a/packages/modeling/src/operations/transforms/scale.d.ts b/packages/modeling/src/operations/transforms/scale.d.ts index d357830ce..697f38e85 100644 --- a/packages/modeling/src/operations/transforms/scale.d.ts +++ b/packages/modeling/src/operations/transforms/scale.d.ts @@ -1,10 +1,10 @@ -import { Geometry } from '../../geometries/types' -import { Vec1, Vec2, Vec3 } from '../../maths/types' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { Vec } from '../../maths/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' -export function scale(factors: Vec1 | Vec2 | Vec3, geometry: T): T -export function scale(factors: Vec1 | Vec2 | Vec3, ...geometries: RecursiveArray): Array -export function scale(factors: Vec1 | Vec2 | Vec3, ...geometries: RecursiveArray): Array +export function scale(factors: Vec, geometry: T): T +export function scale(factors: Vec, ...geometries: RecursiveArray): Array +export function scale(factors: Vec, ...geometries: RecursiveArray): Array export function scaleX(factor: number, geometry: T): T export function scaleX(factor: number, ...geometries: RecursiveArray): Array diff --git a/packages/modeling/src/operations/transforms/scale.js b/packages/modeling/src/operations/transforms/scale.js index c0dcebe33..bb396752d 100644 --- a/packages/modeling/src/operations/transforms/scale.js +++ b/packages/modeling/src/operations/transforms/scale.js @@ -41,7 +41,7 @@ export const scale = (factors, ...objects) => { /** * Scale the given objects about the X axis using the given options. - * @param {Number} factor - X factor by which to scale the objects + * @param {number} factor - X factor by which to scale the objects * @param {...Object} objects - the objects to scale * @return {Object|Array} the scaled object, or a list of scaled objects * @alias module:modeling/transforms.scaleX @@ -50,7 +50,7 @@ export const scaleX = (factor, ...objects) => scale([factor, 1, 1], objects) /** * Scale the given objects about the Y axis using the given options. - * @param {Number} factor - Y factor by which to scale the objects + * @param {number} factor - Y factor by which to scale the objects * @param {...Object} objects - the objects to scale * @return {Object|Array} the scaled object, or a list of scaled objects * @alias module:modeling/transforms.scaleY @@ -59,7 +59,7 @@ export const scaleY = (factor, ...objects) => scale([1, factor, 1], objects) /** * Scale the given objects about the Z axis using the given options. - * @param {Number} factor - Z factor by which to scale the objects + * @param {number} factor - Z factor by which to scale the objects * @param {...Object} objects - the objects to scale * @return {Object|Array} the scaled object, or a list of scaled objects * @alias module:modeling/transforms.scaleZ diff --git a/packages/modeling/src/operations/transforms/transform.d.ts b/packages/modeling/src/operations/transforms/transform.d.ts index ffa680fb8..6267fb35f 100644 --- a/packages/modeling/src/operations/transforms/transform.d.ts +++ b/packages/modeling/src/operations/transforms/transform.d.ts @@ -1,6 +1,6 @@ -import { Geometry } from '../../geometries/types' -import { Mat4 } from '../../maths/mat4/type' -import RecursiveArray from '../../utils/recursiveArray' +import type { Geometry } from '../../geometries/types.d.ts' +import type { Mat4 } from '../../maths/mat4/type.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function transform(matrix: Mat4, geometry: T): T export function transform(matrix: Mat4, ...geometries: RecursiveArray): Array diff --git a/packages/modeling/src/operations/transforms/transform.js b/packages/modeling/src/operations/transforms/transform.js index 5144ceb7e..a8c54d8a8 100644 --- a/packages/modeling/src/operations/transforms/transform.js +++ b/packages/modeling/src/operations/transforms/transform.js @@ -6,7 +6,7 @@ import * as path2 from '../../geometries/path2/index.js' /** * Transform the given objects using the given matrix. - * @param {mat4} matrix - a transformation matrix + * @param {Mat4} matrix - a transformation matrix * @param {...Object} objects - the objects to transform * @return {Object|Array} the transformed object, or a list of transformed objects * @alias module:modeling/transforms.transform diff --git a/packages/modeling/src/operations/transforms/translate.d.ts b/packages/modeling/src/operations/transforms/translate.d.ts index 2c0b8173a..612c8273d 100644 --- a/packages/modeling/src/operations/transforms/translate.d.ts +++ b/packages/modeling/src/operations/transforms/translate.d.ts @@ -1,8 +1,6 @@ -import { Geometry } from '../../geometries/types' -import { Vec1, Vec2, Vec3 } from '../../maths/types' -import RecursiveArray from '../../utils/recursiveArray' - -type Vec = Vec1 | Vec2 | Vec3 +import type { Geometry } from '../../geometries/types.d.ts' +import type { Vec } from '../../maths/types.d.ts' +import type { RecursiveArray } from '../../utils/recursiveArray.d.ts' export function translate(offset: Vec, geometry: T): T export function translate(offset: Vec, ...geometries: RecursiveArray): Array diff --git a/packages/modeling/src/operations/transforms/translate.js b/packages/modeling/src/operations/transforms/translate.js index 4165a5766..628c33dbc 100644 --- a/packages/modeling/src/operations/transforms/translate.js +++ b/packages/modeling/src/operations/transforms/translate.js @@ -39,7 +39,7 @@ export const translate = (offset, ...objects) => { /** * Translate the given objects along the X axis using the given options. - * @param {Number} offset - X offset of which to translate the objects + * @param {number} offset - X offset of which to translate the objects * @param {...Object} objects - the objects to translate * @return {Object|Array} the translated object, or a list of translated objects * @alias module:modeling/transforms.translateX @@ -48,7 +48,7 @@ export const translateX = (offset, ...objects) => translate([offset, 0, 0], obje /** * Translate the given objects along the Y axis using the given options. - * @param {Number} offset - Y offset of which to translate the geometries + * @param {number} offset - Y offset of which to translate the geometries * @param {...Object} objects - the objects to translate * @return {Object|Array} the translated object, or a list of translated objects * @alias module:modeling/transforms.translateY @@ -57,7 +57,7 @@ export const translateY = (offset, ...objects) => translate([0, offset, 0], obje /** * Translate the given objects along the Z axis using the given options. - * @param {Number} offset - Z offset of which to translate the geometries + * @param {number} offset - Z offset of which to translate the geometries * @param {...Object} objects - the objects to translate * @return {Object|Array} the translated object, or a list of translated objects * @alias module:modeling/transforms.translateZ diff --git a/packages/modeling/src/primitives/arc.d.ts b/packages/modeling/src/primitives/arc.d.ts index 8e0b320a9..f3209e793 100644 --- a/packages/modeling/src/primitives/arc.d.ts +++ b/packages/modeling/src/primitives/arc.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Path2 } from '../geometries/path2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Path2 } from '../geometries/path2/type.d.ts' export interface ArcOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/arc.js b/packages/modeling/src/primitives/arc.js index a303ddd5c..0017dc865 100644 --- a/packages/modeling/src/primitives/arc.js +++ b/packages/modeling/src/primitives/arc.js @@ -8,14 +8,14 @@ import { isGT, isGTE, isNumberArray } from './commonChecks.js' /** * Construct an arc in two dimensional space where all points are at the same distance from the center. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of arc - * @param {Number} [options.radius=1] - radius of arc - * @param {Number} [options.startAngle=0] - starting angle of the arc, in radians - * @param {Number} [options.endAngle=TAU] - ending angle of the arc, in radians - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @param {Boolean} [options.makeTangent=false] - adds line segments at both ends of the arc to ensure that the gradients at the edges are tangent - * @returns {path2} new 2D path + * @param {number} [options.radius=1] - radius of arc + * @param {number} [options.startAngle=0] - starting angle of the arc, in radians + * @param {number} [options.endAngle=TAU] - ending angle of the arc, in radians + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @param {boolean} [options.makeTangent=false] - adds line segments at both ends of the arc to ensure that the gradients at the edges are tangent + * @returns {Path2} new 2D path * @alias module:modeling/primitives.arc */ export const arc = (options) => { diff --git a/packages/modeling/src/primitives/circle.d.ts b/packages/modeling/src/primitives/circle.d.ts index c824ba143..deb912a90 100644 --- a/packages/modeling/src/primitives/circle.d.ts +++ b/packages/modeling/src/primitives/circle.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface CircleOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/circle.js b/packages/modeling/src/primitives/circle.js index 6175e2d69..c3124b0fb 100644 --- a/packages/modeling/src/primitives/circle.js +++ b/packages/modeling/src/primitives/circle.js @@ -7,13 +7,13 @@ import { isGTE } from './commonChecks.js' /** * Construct a circle in two dimensional space where all points are at the same distance from the center. * @see [ellipse]{@link module:modeling/primitives.ellipse} for more options - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of circle - * @param {Number} [options.radius=1] - radius of circle - * @param {Number} [options.startAngle=0] - start angle of circle, in radians - * @param {Number} [options.endAngle=TAU] - end angle of circle, in radians - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom2} new 2D geometry + * @param {number} [options.radius=1] - radius of circle + * @param {number} [options.startAngle=0] - start angle of circle, in radians + * @param {number} [options.endAngle=TAU] - end angle of circle, in radians + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.circle * @example * let myshape = circle({radius: 10}) diff --git a/packages/modeling/src/primitives/cube.d.ts b/packages/modeling/src/primitives/cube.d.ts index 235155988..8c3e3482d 100644 --- a/packages/modeling/src/primitives/cube.d.ts +++ b/packages/modeling/src/primitives/cube.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface CubeOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/cube.js b/packages/modeling/src/primitives/cube.js index d0ce7b152..f0d09b850 100644 --- a/packages/modeling/src/primitives/cube.js +++ b/packages/modeling/src/primitives/cube.js @@ -4,10 +4,10 @@ import { isGTE } from './commonChecks.js' /** * Construct an axis-aligned solid cube in three dimensional space with six square faces. * @see [cuboid]{@link module:modeling/primitives.cuboid} for more options - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of cube - * @param {Number} [options.size=2] - dimension of cube - * @returns {geom3} new 3D geometry + * @param {number} [options.size=2] - dimension of cube + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.cube * @example * let myshape = cube({size: 10}) diff --git a/packages/modeling/src/primitives/cuboid.d.ts b/packages/modeling/src/primitives/cuboid.d.ts index 42c4fadd9..f397df2d4 100644 --- a/packages/modeling/src/primitives/cuboid.d.ts +++ b/packages/modeling/src/primitives/cuboid.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface CuboidOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/cuboid.js b/packages/modeling/src/primitives/cuboid.js index 12fd15235..1e412380e 100644 --- a/packages/modeling/src/primitives/cuboid.js +++ b/packages/modeling/src/primitives/cuboid.js @@ -5,10 +5,10 @@ import { isNumberArray } from './commonChecks.js' /** * Construct an axis-aligned solid cuboid in three dimensional space. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of cuboid * @param {Array} [options.size=[2,2,2]] - dimensions of cuboid; width, depth, height - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.cuboid * * @example diff --git a/packages/modeling/src/primitives/cylinder.d.ts b/packages/modeling/src/primitives/cylinder.d.ts index 2586fb6a1..b90fa0113 100644 --- a/packages/modeling/src/primitives/cylinder.d.ts +++ b/packages/modeling/src/primitives/cylinder.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface CylinderOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/cylinder.js b/packages/modeling/src/primitives/cylinder.js index 561f7d250..8096b8291 100644 --- a/packages/modeling/src/primitives/cylinder.js +++ b/packages/modeling/src/primitives/cylinder.js @@ -5,12 +5,12 @@ import * as geom3 from '../geometries/geom3/index.js' /** * Construct a Z axis-aligned cylinder in three dimensional space. * @see [cylinderElliptic]{@link module:modeling/primitives.cylinderElliptic} for more options - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of cylinder - * @param {Number} [options.height=2] - height of cylinder - * @param {Number} [options.radius=1] - radius of cylinder (at both start and end) - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom3} new geometry + * @param {number} [options.height=2] - height of cylinder + * @param {number} [options.radius=1] - radius of cylinder (at both start and end) + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom3} new geometry * @alias module:modeling/primitives.cylinder * * @example diff --git a/packages/modeling/src/primitives/cylinderElliptic.d.ts b/packages/modeling/src/primitives/cylinderElliptic.d.ts index 1e9e3dc1b..e4e73c177 100644 --- a/packages/modeling/src/primitives/cylinderElliptic.d.ts +++ b/packages/modeling/src/primitives/cylinderElliptic.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface CylinderEllipticOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/cylinderElliptic.js b/packages/modeling/src/primitives/cylinderElliptic.js index ceb6920cf..5625770f6 100644 --- a/packages/modeling/src/primitives/cylinderElliptic.js +++ b/packages/modeling/src/primitives/cylinderElliptic.js @@ -11,15 +11,15 @@ import { isGT, isGTE, isNumberArray } from './commonChecks.js' /** * Construct a Z axis-aligned elliptic cylinder in three dimensional space. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of cylinder - * @param {Number} [options.height=2] - height of cylinder + * @param {number} [options.height=2] - height of cylinder * @param {Array} [options.startRadius=[1,1]] - radius of rounded start, must be two dimensional array - * @param {Number} [options.startAngle=0] - start angle of cylinder, in radians + * @param {number} [options.startAngle=0] - start angle of cylinder, in radians * @param {Array} [options.endRadius=[1,1]] - radius of rounded end, must be two dimensional array - * @param {Number} [options.endAngle=TAU] - end angle of cylinder, in radians - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom3} new geometry + * @param {number} [options.endAngle=TAU] - end angle of cylinder, in radians + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom3} new geometry * @alias module:modeling/primitives.cylinderElliptic * * @example diff --git a/packages/modeling/src/primitives/ellipse.d.ts b/packages/modeling/src/primitives/ellipse.d.ts index 7dad7a4d4..59e9d1b2c 100644 --- a/packages/modeling/src/primitives/ellipse.d.ts +++ b/packages/modeling/src/primitives/ellipse.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface EllipseOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/ellipse.js b/packages/modeling/src/primitives/ellipse.js index da0568cb2..af0dd4b8f 100644 --- a/packages/modeling/src/primitives/ellipse.js +++ b/packages/modeling/src/primitives/ellipse.js @@ -11,13 +11,13 @@ import { isGTE, isNumberArray } from './commonChecks.js' /** * Construct an axis-aligned ellipse in two dimensional space. * @see https://en.wikipedia.org/wiki/Ellipse - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of ellipse * @param {Array} [options.radius=[1,1]] - radius of ellipse, along X and Y - * @param {Number} [options.startAngle=0] - start angle of ellipse, in radians - * @param {Number} [options.endAngle=TAU] - end angle of ellipse, in radians - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom2} new 2D geometry + * @param {number} [options.startAngle=0] - start angle of ellipse, in radians + * @param {number} [options.endAngle=TAU] - end angle of ellipse, in radians + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.ellipse * @example * let myshape = ellipse({radius: [5,10]}) diff --git a/packages/modeling/src/primitives/ellipsoid.d.ts b/packages/modeling/src/primitives/ellipsoid.d.ts index ead497a9e..83160c7b9 100644 --- a/packages/modeling/src/primitives/ellipsoid.d.ts +++ b/packages/modeling/src/primitives/ellipsoid.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface EllipsoidOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/ellipsoid.js b/packages/modeling/src/primitives/ellipsoid.js index cf46b3188..86e0e6d4e 100644 --- a/packages/modeling/src/primitives/ellipsoid.js +++ b/packages/modeling/src/primitives/ellipsoid.js @@ -9,12 +9,12 @@ import { isGTE, isNumberArray } from './commonChecks.js' /** * Construct an axis-aligned ellipsoid in three dimensional space. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of ellipsoid * @param {Array} [options.radius=[1,1,1]] - radius of ellipsoid, along X, Y and Z - * @param {Number} [options.segments=32] - number of segments to create per full rotation + * @param {number} [options.segments=32] - number of segments to create per full rotation * @param {Array} [options.axes] - an array with three vectors for the x, y and z base vectors - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.ellipsoid * * @example diff --git a/packages/modeling/src/primitives/geodesicSphere.d.ts b/packages/modeling/src/primitives/geodesicSphere.d.ts index b1f07dd42..8bf2b855b 100644 --- a/packages/modeling/src/primitives/geodesicSphere.d.ts +++ b/packages/modeling/src/primitives/geodesicSphere.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from '../geometries/geom3/type' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface GeodesicSphereOptions { radius?: number diff --git a/packages/modeling/src/primitives/geodesicSphere.js b/packages/modeling/src/primitives/geodesicSphere.js index b5aa04456..8f9c81b15 100644 --- a/packages/modeling/src/primitives/geodesicSphere.js +++ b/packages/modeling/src/primitives/geodesicSphere.js @@ -8,10 +8,10 @@ import { isGTE } from './commonChecks.js' /** * Construct a geodesic sphere based on icosahedron symmetry. - * @param {Object} [options] - options for construction - * @param {Number} [options.radius=1] - target radius of sphere - * @param {Number} [options.frequency=6] - subdivision frequency per face, multiples of 6 - * @returns {geom3} new 3D geometry + * @param {object} [options] - options for construction + * @param {number} [options.radius=1] - target radius of sphere + * @param {number} [options.frequency=6] - subdivision frequency per face, multiples of 6 + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.geodesicSphere * * @example diff --git a/packages/modeling/src/primitives/index.d.ts b/packages/modeling/src/primitives/index.d.ts index c4670e3d0..8993d62a3 100644 --- a/packages/modeling/src/primitives/index.d.ts +++ b/packages/modeling/src/primitives/index.d.ts @@ -1,23 +1,21 @@ -export { arc, ArcOptions } from './arc' -export { circle, CircleOptions } from './circle' -export { cube, CubeOptions } from './cube' -export { cuboid, CuboidOptions } from './cuboid' -export { cylinder, CylinderOptions } from './cylinder' -export { cylinderElliptic, CylinderEllipticOptions } from './cylinderElliptic' -export { ellipse, EllipseOptions } from './ellipse' -export { ellipsoid, EllipsoidOptions } from './ellipsoid' -export { geodesicSphere, GeodesicSphereOptions } from './geodesicSphere' -export { line } from './line' -export { polygon, PolygonOptions } from './polygon' -export { polyhedron, PolyhedronOptions } from './polyhedron' -export { rectangle, RectangleOptions } from './rectangle' -export { roundedCuboid, RoundedCuboidOptions } from './roundedCuboid' -export { roundedCylinder, RoundedCylinderOptions } from './roundedCylinder' -export { roundedRectangle, RoundedRectangleOptions } from './roundedRectangle' -export { sphere, SphereOptions } from './sphere' -export { square, SquareOptions } from './square' -export { star, StarOptions } from './star' -export { torus, TorusOptions } from './torus' -export { triangle, TriangleOptions } from './triangle' - -export as namespace primitives +export { arc, ArcOptions } from './arc.js' +export { circle, CircleOptions } from './circle.js' +export { cube, CubeOptions } from './cube.js' +export { cuboid, CuboidOptions } from './cuboid.js' +export { cylinder, CylinderOptions } from './cylinder.js' +export { cylinderElliptic, CylinderEllipticOptions } from './cylinderElliptic.js' +export { ellipse, EllipseOptions } from './ellipse.js' +export { ellipsoid, EllipsoidOptions } from './ellipsoid.js' +export { geodesicSphere, GeodesicSphereOptions } from './geodesicSphere.js' +export { line } from './line.js' +export { polygon, PolygonOptions } from './polygon.js' +export { polyhedron, PolyhedronOptions } from './polyhedron.js' +export { rectangle, RectangleOptions } from './rectangle.js' +export { roundedCuboid, RoundedCuboidOptions } from './roundedCuboid.js' +export { roundedCylinder, RoundedCylinderOptions } from './roundedCylinder.js' +export { roundedRectangle, RoundedRectangleOptions } from './roundedRectangle.js' +export { sphere, SphereOptions } from './sphere.js' +export { square, SquareOptions } from './square.js' +export { star, StarOptions } from './star.js' +export { torus, TorusOptions } from './torus.js' +export { triangle, TriangleOptions } from './triangle.js' diff --git a/packages/modeling/src/primitives/line.d.ts b/packages/modeling/src/primitives/line.d.ts index 041374c9c..91ce4af8a 100644 --- a/packages/modeling/src/primitives/line.d.ts +++ b/packages/modeling/src/primitives/line.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from '../maths/vec2/type' -import { Path2 } from '../geometries/path2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Path2 } from '../geometries/path2/type.d.ts' export function line(points: Array): Path2 diff --git a/packages/modeling/src/primitives/line.js b/packages/modeling/src/primitives/line.js index d69884c70..dc0c0314d 100644 --- a/packages/modeling/src/primitives/line.js +++ b/packages/modeling/src/primitives/line.js @@ -4,7 +4,7 @@ import * as path2 from '../geometries/path2/index.js' * Construct a new line in two dimensional space from the given points. * The points must be provided as an array, where each element is a 2D point. * @param {Array} points - array of points from which to create the path - * @returns {path2} new 2D path + * @returns {Path2} new 2D path * @alias module:modeling/primitives.line * * @example diff --git a/packages/modeling/src/primitives/polygon.d.ts b/packages/modeling/src/primitives/polygon.d.ts index 83fd1b745..801b54eb6 100644 --- a/packages/modeling/src/primitives/polygon.d.ts +++ b/packages/modeling/src/primitives/polygon.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface PolygonOptions { points: Array | Array> diff --git a/packages/modeling/src/primitives/polygon.js b/packages/modeling/src/primitives/polygon.js index 6851021fc..5fd4c07ba 100644 --- a/packages/modeling/src/primitives/polygon.js +++ b/packages/modeling/src/primitives/polygon.js @@ -3,10 +3,10 @@ import * as geom2 from '../geometries/geom2/index.js' /** * Construct a polygon in two dimensional space from a list of points, or a list of points and paths. * NOTE: The ordering of points is VERY IMPORTANT. - * @param {Object} options - options for construction + * @param {object} options - options for construction * @param {Array} options.points - points of the polygon : either flat or nested array of 2D points * @param {Array} [options.paths] - paths of the polygon : either flat or nested array of point indexes - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.polygon * * @example diff --git a/packages/modeling/src/primitives/polyhedron.d.ts b/packages/modeling/src/primitives/polyhedron.d.ts index 38e045f25..b5757da79 100644 --- a/packages/modeling/src/primitives/polyhedron.d.ts +++ b/packages/modeling/src/primitives/polyhedron.d.ts @@ -1,6 +1,6 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' -import { RGB, RGBA } from '../colors/types' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' +import type { RGB, RGBA } from '../colors/types.d.ts' export interface PolyhedronOptions { points: Array diff --git a/packages/modeling/src/primitives/polyhedron.js b/packages/modeling/src/primitives/polyhedron.js index f17b07664..669c87e24 100644 --- a/packages/modeling/src/primitives/polyhedron.js +++ b/packages/modeling/src/primitives/polyhedron.js @@ -7,12 +7,12 @@ import { isNumberArray } from './commonChecks.js' * Construct a polyhedron in three dimensional space from the given set of 3D vertices and faces. * The faces can define outward or inward facing polygons (orientation). * However, each face must define a counterclockwise rotation of vertices which follows the right hand rule. - * @param {Object} options - options for construction + * @param {object} options - options for construction * @param {Array} options.points - list of points in 3D space * @param {Array} options.faces - list of faces, where each face is a set of indexes into the points * @param {Array} [options.colors=undefined] - list of RGBA colors to apply to each face - * @param {String} [options.orientation='outward'] - orientation of faces - * @returns {geom3} new 3D geometry + * @param {string} [options.orientation='outward'] - orientation of faces + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.polyhedron * * @example diff --git a/packages/modeling/src/primitives/rectangle.d.ts b/packages/modeling/src/primitives/rectangle.d.ts index 866ee0c4d..d99aa9b3d 100644 --- a/packages/modeling/src/primitives/rectangle.d.ts +++ b/packages/modeling/src/primitives/rectangle.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface RectangleOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/rectangle.js b/packages/modeling/src/primitives/rectangle.js index 3816758f9..6b45a2771 100644 --- a/packages/modeling/src/primitives/rectangle.js +++ b/packages/modeling/src/primitives/rectangle.js @@ -6,10 +6,10 @@ import { isNumberArray } from './commonChecks.js' /** * Construct an axis-aligned rectangle in two dimensional space with four sides at right angles. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of rectangle * @param {Array} [options.size=[2,2]] - dimension of rectangle, width and length - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.rectangle * * @example diff --git a/packages/modeling/src/primitives/roundedCuboid.d.ts b/packages/modeling/src/primitives/roundedCuboid.d.ts index f7eedfc1d..4ea16eda9 100644 --- a/packages/modeling/src/primitives/roundedCuboid.d.ts +++ b/packages/modeling/src/primitives/roundedCuboid.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface RoundedCuboidOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/roundedCuboid.js b/packages/modeling/src/primitives/roundedCuboid.js index 90641dd75..ba8fbb192 100644 --- a/packages/modeling/src/primitives/roundedCuboid.js +++ b/packages/modeling/src/primitives/roundedCuboid.js @@ -115,12 +115,12 @@ const stitchSides = (bottomCorners, topCorners) => { /** * Construct an axis-aligned solid cuboid in three dimensional space with rounded corners. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of rounded cube * @param {Array} [options.size=[2,2,2]] - dimension of rounded cube; width, depth, height - * @param {Number} [options.roundRadius=0.2] - radius of rounded edges - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom3} new 3D geometry + * @param {number} [options.roundRadius=0.2] - radius of rounded edges + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.roundedCuboid * * @example diff --git a/packages/modeling/src/primitives/roundedCylinder.d.ts b/packages/modeling/src/primitives/roundedCylinder.d.ts index 6d911a942..e34f22de0 100644 --- a/packages/modeling/src/primitives/roundedCylinder.d.ts +++ b/packages/modeling/src/primitives/roundedCylinder.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface RoundedCylinderOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/roundedCylinder.js b/packages/modeling/src/primitives/roundedCylinder.js index 57bf65c84..44aa90805 100644 --- a/packages/modeling/src/primitives/roundedCylinder.js +++ b/packages/modeling/src/primitives/roundedCylinder.js @@ -12,13 +12,13 @@ import { cylinder } from './cylinder.js' /** * Construct a Z axis-aligned solid cylinder in three dimensional space with rounded ends. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of cylinder - * @param {Number} [options.height=2] - height of cylinder - * @param {Number} [options.radius=1] - radius of cylinder - * @param {Number} [options.roundRadius=0.2] - radius of rounded edges - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom3} new 3D geometry + * @param {number} [options.height=2] - height of cylinder + * @param {number} [options.radius=1] - radius of cylinder + * @param {number} [options.roundRadius=0.2] - radius of rounded edges + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.roundedCylinder * * @example diff --git a/packages/modeling/src/primitives/roundedRectangle.d.ts b/packages/modeling/src/primitives/roundedRectangle.d.ts index b3017942a..84ff11e94 100644 --- a/packages/modeling/src/primitives/roundedRectangle.d.ts +++ b/packages/modeling/src/primitives/roundedRectangle.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface RoundedRectangleOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/roundedRectangle.js b/packages/modeling/src/primitives/roundedRectangle.js index f479fbb64..46a712774 100644 --- a/packages/modeling/src/primitives/roundedRectangle.js +++ b/packages/modeling/src/primitives/roundedRectangle.js @@ -10,12 +10,12 @@ import { rectangle } from './rectangle.js' /** * Construct an axis-aligned rectangle in two dimensional space with rounded corners. - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of rounded rectangle * @param {Array} [options.size=[2,2]] - dimension of rounded rectangle; width and length - * @param {Number} [options.roundRadius=0.2] - round radius of corners - * @param {Number} [options.segments=32] - number of segments to create per full rotation - * @returns {geom2} new 2D geometry + * @param {number} [options.roundRadius=0.2] - round radius of corners + * @param {number} [options.segments=32] - number of segments to create per full rotation + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.roundedRectangle * * @example diff --git a/packages/modeling/src/primitives/sphere.d.ts b/packages/modeling/src/primitives/sphere.d.ts index a4d49a02c..c146c133a 100644 --- a/packages/modeling/src/primitives/sphere.d.ts +++ b/packages/modeling/src/primitives/sphere.d.ts @@ -1,5 +1,5 @@ -import { Vec3 } from '../maths/vec3/type' -import { Geom3 } from '../geometries/geom3/type' +import type { Vec3 } from '../maths/vec3/type.d.ts' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface SphereOptions { center?: Vec3 diff --git a/packages/modeling/src/primitives/sphere.js b/packages/modeling/src/primitives/sphere.js index 517222eb1..915552309 100644 --- a/packages/modeling/src/primitives/sphere.js +++ b/packages/modeling/src/primitives/sphere.js @@ -4,12 +4,12 @@ import { isGTE } from './commonChecks.js' /** * Construct a sphere in three dimensional space where all vertices are at the same distance from the center. * @see [ellipsoid]{@link module:modeling/primitives.ellipsoid} for more options - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0,0]] - center of sphere - * @param {Number} [options.radius=1] - radius of sphere - * @param {Number} [options.segments=32] - number of segments to create per full rotation + * @param {number} [options.radius=1] - radius of sphere + * @param {number} [options.segments=32] - number of segments to create per full rotation * @param {Array} [options.axes] - an array with three vectors for the x, y and z base vectors - * @returns {geom3} new 3D geometry + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.sphere * * @example diff --git a/packages/modeling/src/primitives/square.d.ts b/packages/modeling/src/primitives/square.d.ts index a298c09a5..44f9bb2cf 100644 --- a/packages/modeling/src/primitives/square.d.ts +++ b/packages/modeling/src/primitives/square.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface SquareOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/square.js b/packages/modeling/src/primitives/square.js index 09dee45f7..f667eb3be 100644 --- a/packages/modeling/src/primitives/square.js +++ b/packages/modeling/src/primitives/square.js @@ -4,10 +4,10 @@ import { isGTE } from './commonChecks.js' /** * Construct an axis-aligned square in two dimensional space with four equal sides at right angles. * @see [rectangle]{@link module:modeling/primitives.rectangle} for more options - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of square - * @param {Number} [options.size=2] - dimension of square - * @returns {geom2} new 2D geometry + * @param {number} [options.size=2] - dimension of square + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.square * * @example diff --git a/packages/modeling/src/primitives/star.d.ts b/packages/modeling/src/primitives/star.d.ts index d6a5d25d9..133e56ecb 100644 --- a/packages/modeling/src/primitives/star.d.ts +++ b/packages/modeling/src/primitives/star.d.ts @@ -1,5 +1,5 @@ -import { Vec2 } from '../maths/vec2/type' -import { Geom2 } from '../geometries/geom2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface StarOptions { center?: Vec2 diff --git a/packages/modeling/src/primitives/star.js b/packages/modeling/src/primitives/star.js index c2c00d9a9..2551fdc60 100644 --- a/packages/modeling/src/primitives/star.js +++ b/packages/modeling/src/primitives/star.js @@ -29,14 +29,14 @@ const getPoints = (vertices, radius, startAngle, center) => { /** * Construct a star in two dimensional space. * @see https://en.wikipedia.org/wiki/Star_polygon - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {Array} [options.center=[0,0]] - center of star - * @param {Number} [options.vertices=5] - number of vertices (P) on the star - * @param {Number} [options.density=2] - density (Q) of star - * @param {Number} [options.outerRadius=1] - outer radius of vertices - * @param {Number} [options.innerRadius=0] - inner radius of vertices, or zero to calculate - * @param {Number} [options.startAngle=0] - starting angle for first vertex, in radians - * @returns {geom2} new 2D geometry + * @param {number} [options.vertices=5] - number of vertices (P) on the star + * @param {number} [options.density=2] - density (Q) of star + * @param {number} [options.outerRadius=1] - outer radius of vertices + * @param {number} [options.innerRadius=0] - inner radius of vertices, or zero to calculate + * @param {number} [options.startAngle=0] - starting angle for first vertex, in radians + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.star * * @example diff --git a/packages/modeling/src/primitives/torus.d.ts b/packages/modeling/src/primitives/torus.d.ts index 4ad72eead..d4d7da7fe 100644 --- a/packages/modeling/src/primitives/torus.d.ts +++ b/packages/modeling/src/primitives/torus.d.ts @@ -1,4 +1,4 @@ -import { Geom3 } from '../geometries/geom3/type' +import type { Geom3 } from '../geometries/geom3/type.d.ts' export interface TorusOptions { innerRadius?: number diff --git a/packages/modeling/src/primitives/torus.js b/packages/modeling/src/primitives/torus.js index d2fd73999..c323cd6c6 100644 --- a/packages/modeling/src/primitives/torus.js +++ b/packages/modeling/src/primitives/torus.js @@ -10,15 +10,15 @@ import { isGT, isGTE } from './commonChecks.js' /** * Construct a torus by revolving a small circle (inner) about the circumference of a large (outer) circle. - * @param {Object} [options] - options for construction - * @param {Number} [options.innerRadius=1] - radius of small (inner) circle - * @param {Number} [options.outerRadius=4] - radius of large (outer) circle - * @param {Integer} [options.innerSegments=32] - number of segments to create per rotation - * @param {Integer} [options.outerSegments=32] - number of segments to create per rotation - * @param {Integer} [options.innerRotation=0] - rotation of small (inner) circle in radians - * @param {Number} [options.outerRotation=TAU] - rotation (outer) of the torus (RADIANS) - * @param {Number} [options.startAngle=0] - start angle of the torus (RADIANS) - * @returns {geom3} new 3D geometry + * @param {object} [options] - options for construction + * @param {number} [options.innerRadius=1] - radius of small (inner) circle + * @param {number} [options.outerRadius=4] - radius of large (outer) circle + * @param {number} [options.innerSegments=32] - number of segments to create per rotation + * @param {number} [options.outerSegments=32] - number of segments to create per rotation + * @param {number} [options.innerRotation=0] - rotation of small (inner) circle in radians + * @param {number} [options.outerRotation=TAU] - rotation (outer) of the torus (RADIANS) + * @param {number} [options.startAngle=0] - start angle of the torus (RADIANS) + * @returns {Geom3} new 3D geometry * @alias module:modeling/primitives.torus * * @example diff --git a/packages/modeling/src/primitives/triangle.d.ts b/packages/modeling/src/primitives/triangle.d.ts index fe5b6c6aa..be9228f8e 100644 --- a/packages/modeling/src/primitives/triangle.d.ts +++ b/packages/modeling/src/primitives/triangle.d.ts @@ -1,4 +1,4 @@ -import { Geom2 } from '../geometries/geom2/type' +import type { Geom2 } from '../geometries/geom2/type.d.ts' export interface TriangleOptions { type?: 'AAA' | 'AAS' | 'ASA' | 'SAS' | 'SSA' | 'SSS' diff --git a/packages/modeling/src/primitives/triangle.js b/packages/modeling/src/primitives/triangle.js index 593a0a7a2..d779b1156 100644 --- a/packages/modeling/src/primitives/triangle.js +++ b/packages/modeling/src/primitives/triangle.js @@ -117,10 +117,10 @@ const createTriangle = (A, B, C, a, b, c) => { * Construct a triangle in two dimensional space from the given options. * The triangle is always constructed CCW from the origin, [0, 0, 0]. * @see https://www.mathsisfun.com/algebra/trig-solving-triangles.html - * @param {Object} [options] - options for construction - * @param {String} [options.type='SSS'] - type of triangle to construct; A ~ angle, S ~ side + * @param {object} [options] - options for construction + * @param {string} [options.type='SSS'] - type of triangle to construct; A ~ angle, S ~ side * @param {Array} [options.values=[1,1,1]] - angle (radians) of corners or length of sides - * @returns {geom2} new 2D geometry + * @returns {Geom2} new 2D geometry * @alias module:modeling/primitives.triangle * * @example diff --git a/packages/modeling/src/text/index.d.ts b/packages/modeling/src/text/index.d.ts index 3ab14bb46..1c23f1c08 100644 --- a/packages/modeling/src/text/index.d.ts +++ b/packages/modeling/src/text/index.d.ts @@ -1,4 +1,2 @@ -export { vectorChar, VectorChar, VectorCharOptions } from './vectorChar' -export { vectorText, VectorText, VectorTextOptions } from './vectorText' - -export as namespace text +export { vectorChar, VectorChar, VectorCharOptions } from './vectorChar.js' +export { vectorText, VectorText, VectorTextOptions } from './vectorText.js' diff --git a/packages/modeling/src/text/vectorChar.d.ts b/packages/modeling/src/text/vectorChar.d.ts index 9cd7204d7..ab71d2fe9 100644 --- a/packages/modeling/src/text/vectorChar.d.ts +++ b/packages/modeling/src/text/vectorChar.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from '../maths/vec2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' export interface VectorChar { width: number diff --git a/packages/modeling/src/text/vectorChar.js b/packages/modeling/src/text/vectorChar.js index 891b2556c..eac57005c 100644 --- a/packages/modeling/src/text/vectorChar.js +++ b/packages/modeling/src/text/vectorChar.js @@ -14,13 +14,13 @@ import { vectorParams } from './vectorParams.js' * Construct a {@link VectorChar} from an ASCII character whose code is between 31 and 127. * If the character is not supported it is replaced by a question mark. * - * @param {Object} [options] - options for construction + * @param {object} [options] - options for construction * @param {number} [options.xOffset=0] - x offset * @param {number} [options.yOffset=0] - y offset * @param {number} [options.height=21] - font size/character height (uppercase height) * @param {number} [options.extrudeOffset=0] - width of the extrusion that will be applied (manually) after the creation of the character - * @param {String} [options.input='?'] - ascii character (ignored/overwritten if provided as second parameter) - * @param {String} [character='?'] - ascii character + * @param {string} [options.input='?'] - ascii character (ignored/overwritten if provided as second parameter) + * @param {string} [character='?'] - ascii character * @returns {VectorChar} a new vertor char object * @alias module:modeling/text.vectorChar * diff --git a/packages/modeling/src/text/vectorText.d.ts b/packages/modeling/src/text/vectorText.d.ts index 86e4da729..20b690f77 100644 --- a/packages/modeling/src/text/vectorText.d.ts +++ b/packages/modeling/src/text/vectorText.d.ts @@ -1,4 +1,4 @@ -import { Vec2 } from '../maths/vec2/type' +import type { Vec2 } from '../maths/vec2/type.d.ts' export interface VectorText extends Array> {} diff --git a/packages/modeling/src/text/vectorText.js b/packages/modeling/src/text/vectorText.js index 5dbd50910..e9021bf13 100644 --- a/packages/modeling/src/text/vectorText.js +++ b/packages/modeling/src/text/vectorText.js @@ -32,16 +32,16 @@ const translateLine = (options, line) => { /** * Construct an array of character segments from an ascii string whose characters code is between 31 and 127, * if one character is not supported it is replaced by a question mark. - * @param {Object|String} [options] - options for construction or ascii string - * @param {Float} [options.xOffset=0] - x offset - * @param {Float} [options.yOffset=0] - y offset - * @param {Float} [options.height=14] - height of requested characters (uppercase height), i.e. font height in points - * @param {Float} [options.lineSpacing=30/14] - line spacing expressed as a percentage of height - * @param {Float} [options.letterSpacing=0] - extra letter spacing, expressed as a proportion of height, i.e. like CSS em - * @param {String} [options.align='left'] - multi-line text alignment: left, center, right - * @param {Float} [options.extrudeOffset=0] - width of the extrusion that will be applied (manually) after the creation of the character - * @param {String} [options.input='?'] - ascii string (ignored/overwrited if provided as seconds parameter) - * @param {String} [text='?'] - ascii string + * @param {object|string} [options] - options for construction or ascii string + * @param {number} [options.xOffset=0] - x offset + * @param {number} [options.yOffset=0] - y offset + * @param {number} [options.height=14] - height of requested characters (uppercase height), i.e. font height in points + * @param {number} [options.lineSpacing=30/14] - line spacing expressed as a percentage of height + * @param {number} [options.letterSpacing=0] - extra letter spacing, expressed as a proportion of height, i.e. like CSS em + * @param {string} [options.align='left'] - multi-line text alignment: left, center, right + * @param {number} [options.extrudeOffset=0] - width of the extrusion that will be applied (manually) after the creation of the character + * @param {string} [options.input='?'] - ascii string (ignored/overwrited if provided as seconds parameter) + * @param {string} [text='?'] - ascii string * @returns {Array} list of vector line objects, where each line contains a list of vector character objects * @alias module:modeling/text.vectorText * diff --git a/packages/modeling/src/utils/areAllShapesTheSameType.d.ts b/packages/modeling/src/utils/areAllShapesTheSameType.d.ts index 7e69b0578..2d5905f67 100644 --- a/packages/modeling/src/utils/areAllShapesTheSameType.d.ts +++ b/packages/modeling/src/utils/areAllShapesTheSameType.d.ts @@ -1,3 +1,3 @@ -import { Geometry } from '../geometries/types' +import type { Geometry } from '../geometries/types.d.ts' export function areAllShapesTheSameType(shapes: Array): boolean diff --git a/packages/modeling/src/utils/degToRad.js b/packages/modeling/src/utils/degToRad.js index 4948a316a..cff86134a 100644 --- a/packages/modeling/src/utils/degToRad.js +++ b/packages/modeling/src/utils/degToRad.js @@ -1,7 +1,7 @@ /** * Convert the given angle (degrees) to radians. - * @param {Number} degrees - angle in degrees - * @returns {Number} angle in radians + * @param {number} degrees - angle in degrees + * @returns {number} angle in radians * @alias module:modeling/utils.degToRad */ export const degToRad = (degrees) => degrees * 0.017453292519943295 diff --git a/packages/modeling/src/utils/flatten.d.ts b/packages/modeling/src/utils/flatten.d.ts index c05746d2d..8b21c88ce 100644 --- a/packages/modeling/src/utils/flatten.d.ts +++ b/packages/modeling/src/utils/flatten.d.ts @@ -1,3 +1,3 @@ -import RecursiveArray from './recursiveArray' +import type { RecursiveArray } from './recursiveArray.d.ts' export function flatten(arr: RecursiveArray): Array diff --git a/packages/modeling/src/utils/index.d.ts b/packages/modeling/src/utils/index.d.ts index d366d0ff7..9b3ce9dde 100644 --- a/packages/modeling/src/utils/index.d.ts +++ b/packages/modeling/src/utils/index.d.ts @@ -1,10 +1,8 @@ -export { areAllShapesTheSameType } from './areAllShapesTheSameType' -export { degToRad } from './degToRad' -export { flatten } from './flatten' -export { fnNumberSort } from './fnNumberSort' -export { insertSorted } from './insertSorted' -export { padArrayToLength } from './padArrayToLength' -export { radiusToSegments } from './radiusToSegments' -export { radToDeg } from './radToDeg' - -export as namespace utils +export { areAllShapesTheSameType } from './areAllShapesTheSameType.js' +export { degToRad } from './degToRad.js' +export { flatten } from './flatten.js' +export { fnNumberSort } from './fnNumberSort.js' +export { insertSorted } from './insertSorted.js' +export { padArrayToLength } from './padArrayToLength.js' +export { radiusToSegments } from './radiusToSegments.js' +export { radToDeg } from './radToDeg.js' diff --git a/packages/modeling/src/utils/padArrayToLength.js b/packages/modeling/src/utils/padArrayToLength.js index 3e09ba8a4..9492e5d6f 100644 --- a/packages/modeling/src/utils/padArrayToLength.js +++ b/packages/modeling/src/utils/padArrayToLength.js @@ -2,7 +2,7 @@ * Build an array of at minimum a specified length from an existing array and a padding value. IF the array is already larger than the target length, it will not be shortened. * @param {Array} anArray - the source array to copy into the result. * @param {*} padding - the value to add to the new array to reach the desired length. - * @param {Number} targetLength - The desired length of the return array. + * @param {number} targetLength - The desired length of the return array. * @returns {Array} an array of at least 'targetLength' length * @alias module:modeling/utils.padArrayToLength */ diff --git a/packages/modeling/src/utils/radToDeg.js b/packages/modeling/src/utils/radToDeg.js index a8031f5c7..b3b23279c 100644 --- a/packages/modeling/src/utils/radToDeg.js +++ b/packages/modeling/src/utils/radToDeg.js @@ -1,7 +1,7 @@ /** * Convert the given angle (radians) to degrees. - * @param {Number} radians - angle in radians - * @returns {Number} angle in degrees + * @param {number} radians - angle in radians + * @returns {number} angle in degrees * @alias module:modeling/utils.radToDeg */ export const radToDeg = (radians) => radians * 57.29577951308232 diff --git a/packages/modeling/src/utils/radiusToSegments.js b/packages/modeling/src/utils/radiusToSegments.js index cea747d0b..abd96233f 100644 --- a/packages/modeling/src/utils/radiusToSegments.js +++ b/packages/modeling/src/utils/radiusToSegments.js @@ -2,10 +2,10 @@ import { TAU } from '../maths/constants.js' /** * Calculate the number of segments from the given radius based on minimum length or angle. - * @param {Number} radius - radius of the requested shape - * @param {Number} minimumLength - minimum length of segments; length > 0 - * @param {Number} minimumAngle - minimum angle (radians) between segments; 0 > angle < TAU - * @returns {Number} number of segments to complete the radius + * @param {number} radius - radius of the requested shape + * @param {number} minimumLength - minimum length of segments; length > 0 + * @param {number} minimumAngle - minimum angle (radians) between segments; 0 > angle < TAU + * @returns {number} number of segments to complete the radius * @alias module:modeling/utils.radiusToSegments */ export const radiusToSegments = (radius, minimumLength, minimumAngle) => { diff --git a/packages/modeling/src/utils/recursiveArray.d.ts b/packages/modeling/src/utils/recursiveArray.d.ts index e328660c9..63787c01c 100644 --- a/packages/modeling/src/utils/recursiveArray.d.ts +++ b/packages/modeling/src/utils/recursiveArray.d.ts @@ -1,3 +1 @@ -export default RecursiveArray - -declare interface RecursiveArray extends Array> {} +export interface RecursiveArray extends Array> {} diff --git a/packages/modeling/test/helpers/comparePolygons.js b/packages/modeling/test/helpers/comparePolygons.js index e2a77b09a..a25d34eb0 100644 --- a/packages/modeling/test/helpers/comparePolygons.js +++ b/packages/modeling/test/helpers/comparePolygons.js @@ -2,8 +2,8 @@ import { compareVectors } from './compareVectors.js' /** * Compare two polygons for equality - * @param (poly3} poly1 - polygon with plane and vertices - * @param (poly3} poly2 - polygon with plane and vertices + * @param {Poly3} poly1 - polygon with plane and vertices + * @param {Poly3} poly2 - polygon with plane and vertices * @returns {boolean} result of comparison */ export const comparePolygons = (poly1, poly2) => { diff --git a/packages/modeling/test/helpers/comparePolygonsAsPoints.js b/packages/modeling/test/helpers/comparePolygonsAsPoints.js index 144608ffa..5b3a13944 100644 --- a/packages/modeling/test/helpers/comparePolygonsAsPoints.js +++ b/packages/modeling/test/helpers/comparePolygonsAsPoints.js @@ -9,8 +9,8 @@ const comparePolygons = (poly1, poly2) => { /** * Compare two list of points for equality - * @param (Array} list1 - list of polygons, represented as points - * @param (Array} list2 - list of polygons, represented as points + * @param {Array} list1 - list of polygons, represented as points + * @param {Array} list2 - list of polygons, represented as points * @returns {boolean} result of comparison */ export const comparePolygonsAsPoints = (list1, list2) => { diff --git a/packages/modeling/test/helpers/compareVectors.js b/packages/modeling/test/helpers/compareVectors.js index e14154832..f38bc0f76 100644 --- a/packages/modeling/test/helpers/compareVectors.js +++ b/packages/modeling/test/helpers/compareVectors.js @@ -2,8 +2,8 @@ import { EPS } from '../../src/maths/constants.js' /** * Compare two vectors for equality - * @param {vec} vec1 - vector (array) of values - * @param {vec} vec2 - vector (array) of values + * @param {number[]} vec1 - vector (array) of values + * @param {number[]} vec2 - vector (array) of values * @param {number} eps - Epsilon - the largest difference between two numbers to consider trivial * @returns {boolean} result of comparison */ diff --git a/packages/modeling/tsconfig.json b/packages/modeling/tsconfig.json new file mode 100644 index 000000000..dadeeced5 --- /dev/null +++ b/packages/modeling/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "noEmit": true, + "lib": ["dom", "es2020"], + "target": "es2015", + "moduleResolution": "nodenext" + }, + "include": [ + "src/**/*.js", + "global.d.ts" + ], + "exclude": [ + "src/**/*.test.js" + ] +} diff --git a/packages/utils/array-utils/src/fnNumberSort.js b/packages/utils/array-utils/src/fnNumberSort.js index ce6e3749b..a97a31238 100644 --- a/packages/utils/array-utils/src/fnNumberSort.js +++ b/packages/utils/array-utils/src/fnNumberSort.js @@ -1,8 +1,8 @@ /** * Compare function for sorting arrays of numbers. - * @param {Number} a - first number - * @param {Number} b - second number - * @return {Number} result of a - b + * @param {number} a - first number + * @param {number} b - second number + * @return {number} result of a - b * @alias module:array-utils.fnNumberSort * @example * const numbers = [2, 1, 4, 3, 6, 5, 8, 7, 9, 0] diff --git a/packages/utils/array-utils/src/nth.js b/packages/utils/array-utils/src/nth.js index cf60d86a3..1cdd32c69 100644 --- a/packages/utils/array-utils/src/nth.js +++ b/packages/utils/array-utils/src/nth.js @@ -1,7 +1,7 @@ /** * Return the Nth element of the given array. * @param {*} array - anything - * @param {Number} index - index of the element to return + * @param {number} index - index of the element to return * @returns {*} Nth element of the array, or undefined * @alias module:array-utils.nth * @example diff --git a/packages/utils/array-utils/src/padToLength.js b/packages/utils/array-utils/src/padToLength.js index 81697171e..33744f658 100644 --- a/packages/utils/array-utils/src/padToLength.js +++ b/packages/utils/array-utils/src/padToLength.js @@ -3,7 +3,7 @@ * If the array is already larger than the target length, it will not be shortened. * @param {Array} anArray - the source array to copy into the result. * @param {*} padding - the value to add to the new array to reach the desired length. - * @param {Number} targetLength - The desired length of the returned array. + * @param {number} targetLength - The desired length of the returned array. * @returns {Array} an array with at least 'target length" elements * @alias module:array-utils.padToLength * @example