Skip to content

Commit

Permalink
refactor(modeling): changed imports to directly import from single fi…
Browse files Browse the repository at this point in the history
…les when possible (#1267)
  • Loading branch information
z3dev authored Jul 2, 2023
1 parent 6e50bb6 commit 639d7af
Show file tree
Hide file tree
Showing 68 changed files with 35,109 additions and 1,271 deletions.
17,497 changes: 17,497 additions & 0 deletions packages/modeling/dist/jscad-modeling.es.js

Large diffs are not rendered by default.

18,713 changes: 17,520 additions & 1,193 deletions packages/modeling/dist/jscad-modeling.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/modeling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"coverage": "nyc --all --reporter=html --reporter=text npm test",
"test": "ava 'src/**/*.test.js' --verbose --timeout 2m",
"test:tsd": "tsd",
"version": "npm run build && git add dist"
"version": "pnpm run build && git add dist"
},
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/colorize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as geom2 from '../geometries/geom2/index.js'
import * as geom3 from '../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/hslToRgb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { hueToColorComponent } from './hueToColorComponent.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/hsvToRgb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

/**
* Converts HSV color values to RGB color values.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/rgbToHex.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

/**
* Convert the given RGB color values to CSS color notation (string)
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/rgbToHsl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

/**
* Converts an RGB color value to HSL.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/colors/rgbToHsv.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

/**
* Converts an RGB color value to HSV.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/connectors/transformationBetween.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as plane from '../maths/plane/index.js'
import * as vec2 from '../maths/vec2/index.js'
import * as vec3 from '../maths/vec3/index.js'

import { OrthonormalFormula } from '../maths/utils/index.js'
import { OrthonormalFormula } from '../maths/utils/OrthonormalFormula.js'

import { transform } from './transform.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/geometries/geom2/validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as vec2 from '../../maths/vec2/index.js'
import { intersect } from '../../maths/utils/index.js'

import { intersect } from '../../maths/utils/intersect.js'

import { isA } from './isA.js'
import { toOutlines } from './toOutlines.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/geometries/poly2/isSimple.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { intersect } from '../../maths/utils/index.js'
import { intersect } from '../../maths/utils/intersect.js'

/**
* Check whether the given polygon is simple, i.e. does not intersect itself.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/geometries/poly2/measureArea.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { area } from '../../maths/utils/index.js'
import { area } from '../../maths/utils/area.js'

/**
* Measure the area under the given polygon.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureAggregateArea.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { measureArea } from './measureArea.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as vec3 from '../maths/vec3/index.js'

import { measureBoundingBox } from './measureBoundingBox.js'
Expand Down
6 changes: 4 additions & 2 deletions packages/modeling/src/measurements/measureAggregateEpsilon.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { geom2, geom3, path2 } from '../geometries/index.js'
import * as geom2 from '../geometries/geom2/index.js'
import * as geom3 from '../geometries/geom3/index.js'
import * as path2 from '../geometries/path2/index.js'

import { measureAggregateBoundingBox } from './measureAggregateBoundingBox.js'
import { calculateEpsilonFromBounds } from './calculateEpsilonFromBounds.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { measureVolume } from './measureVolume.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureArea.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as geom2 from '../geometries/geom2/index.js'
import * as geom3 from '../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureBoundingBox.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as vec2 from '../maths/vec2/index.js'
import * as vec3 from '../maths/vec3/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as vec2 from '../maths/vec2/index.js'
import * as vec3 from '../maths/vec3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureCenter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { measureBoundingBox } from './measureBoundingBox.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureCenterOfMass.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as vec3 from '../maths/vec3/index.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureDimensions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import { measureBoundingBox } from './measureBoundingBox.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureEpsilon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as geom2 from '../geometries/geom2/index.js'
import * as geom3 from '../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/measurements/measureVolume.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../utils/index.js'
import { flatten } from '../utils/flatten.js'

import * as geom2 from '../geometries/geom2/index.js'
import * as geom3 from '../geometries/geom3/index.js'
Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/operations/booleans/intersect.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { areAllShapesTheSameType, flatten } from '../../utils/index.js'
import { areAllShapesTheSameType } from '../../utils/areAllShapesTheSameType.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { INTERSECTION } from './martinez/operation.js'
import { boolean } from './martinez/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { retessellate } from '../modifiers/retessellate.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/operations/booleans/mayOverlap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EPS } from '../../maths/constants.js'

import { measureBoundingBox } from '../../measurements/index.js'
import { measureBoundingBox } from '../../measurements/measureBoundingBox.js'


/*
* Determine if the given geometries overlap by comparing min and max bounds.
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/scission.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom3 from '../../geometries/geom3/index.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/scissionGeom3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vec3 from '../../maths/vec3/index.js'

import { measureEpsilon } from '../../measurements/index.js'
import { measureEpsilon } from '../../measurements/measureEpsilon.js'

import * as geom3 from '../../geometries/geom3/index.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/operations/booleans/subtract.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { areAllShapesTheSameType, flatten } from '../../utils/index.js'
import { areAllShapesTheSameType } from '../../utils/areAllShapesTheSameType.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/subtractGeom2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { DIFFERENCE } from './martinez/operation.js'
import { boolean } from './martinez/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/subtractGeom3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { retessellate } from '../modifiers/retessellate.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/operations/booleans/union.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { areAllShapesTheSameType, flatten } from '../../utils/index.js'
import { areAllShapesTheSameType } from '../../utils/areAllShapesTheSameType.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/unionGeom2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { UNION } from './martinez/operation.js'
import { boolean } from './martinez/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/booleans/unionGeom3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { retessellate } from '../modifiers/retessellate.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/expansions/expand.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/expansions/expandGeom3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as geom3 from '../../geometries/geom3/index.js'

import { union } from '../booleans/index.js'
import { union } from '../booleans/union.js'

import { expandShell } from './expandShell.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/expansions/expandPath2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { area } from '../../maths/utils/index.js'
import { area } from '../../maths/utils/area.js'

import * as vec2 from '../../maths/vec2/index.js'

Expand Down
4 changes: 2 additions & 2 deletions packages/modeling/src/operations/expansions/expandShell.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { EPS, TAU } from '../../maths/constants.js'
import * as mat4 from '../../maths/mat4/index.js'
import * as vec3 from '../../maths/vec3/index.js'

import { fnNumberSort } from '../../utils/index.js'
import { fnNumberSort } from '../../utils/fnNumberSort.js'

import * as geom3 from '../../geometries/geom3/index.js'
import * as poly3 from '../../geometries/poly3/index.js'

import { sphere } from '../../primitives/index.js'
import { sphere } from '../../primitives/sphere.js'

import { retessellate } from '../modifiers/retessellate.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/expansions/offset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as path2 from '../../geometries/path2/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EPS, TAU } from '../../maths/constants.js'

import { area, intersect } from '../../maths/utils/index.js'
import { area } from '../../maths/utils/area.js'
import { intersect } from '../../maths/utils/intersect.js'

import * as line2 from '../../maths/line2/index.js'
import * as vec2 from '../../maths/vec2/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as path2 from '../../geometries/path2/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as path2 from '../../geometries/path2/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { area } from '../../maths/utils/index.js'
import { area } from '../../maths/utils/area.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as path2 from '../../geometries/path2/index.js'

import { expand } from '../expansions/index.js'
import { expand } from '../expansions/expand.js'

import { extrudeLinearGeom2 } from './extrudeLinearGeom2.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path2 from '../../geometries/path2/index.js'

import { expand } from '../expansions/index.js'
import { expand } from '../expansions/expand.js'

import { extrudeLinearGeom2 } from './extrudeLinearGeom2.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TAU } from '../../maths/constants.js'
import * as mat4 from '../../maths/mat4/index.js'

import { mirrorX } from '../transforms/index.js'
import { mirrorX } from '../transforms/mirror.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as slice from '../../geometries/slice/index.js'
Expand Down
7 changes: 4 additions & 3 deletions packages/modeling/src/operations/extrusions/project.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { aboutEqualNormals } from '../../maths/utils/aboutEqualNormals.js'

import { aboutEqualNormals } from '../../maths/utils/index.js'
import * as plane from '../../maths/plane/index.js'
import * as mat4 from '../../maths/mat4/index.js'
import * as vec2 from '../../maths/vec2/index.js'
Expand All @@ -9,7 +10,7 @@ import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
import * as poly3 from '../../geometries/poly3/index.js'

import { measureEpsilon } from '../../measurements/index.js'
import { measureEpsilon } from '../../measurements/measureEpsilon.js'

import { unionGeom2 } from '../booleans/unionGeom2.js'

Expand Down
3 changes: 2 additions & 1 deletion packages/modeling/src/operations/hulls/hull.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { areAllShapesTheSameType, flatten } from '../../utils/index.js'
import { areAllShapesTheSameType } from '../../utils/areAllShapesTheSameType.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
4 changes: 2 additions & 2 deletions packages/modeling/src/operations/hulls/hullChain.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { union } from '../booleans/index.js'
import { union } from '../booleans/union.js'

import { hull } from './hull.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/hulls/hullGeom2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom2 from '../../geometries/geom2/index.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/hulls/hullGeom3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as geom3 from '../../geometries/geom3/index.js'
import * as poly3 from '../../geometries/poly3/index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/modeling/src/operations/hulls/hullPath2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import * as path2 from '../../geometries/path2/index.js'

Expand Down
4 changes: 2 additions & 2 deletions packages/modeling/src/operations/modifiers/generalize.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flatten } from '../../utils/index.js'
import { flatten } from '../../utils/flatten.js'

import { measureEpsilon } from '../../measurements/index.js'
import { measureEpsilon } from '../../measurements/measureEpsilon.js'

import * as geom2 from '../../geometries/geom2/index.js'
import * as geom3 from '../../geometries/geom3/index.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { aboutEqualNormals } from '../../maths/utils/index.js'
import { aboutEqualNormals } from '../../maths/utils/aboutEqualNormals.js'

import * as vec3 from '../../maths/vec3/index.js'

Expand Down
Loading

0 comments on commit 639d7af

Please sign in to comment.