JavaScript has finally matured as a language and as a global community.
We are finally seeing the last of Google COMMONJS and the creation of NODE packages.
Now, we have the JavaScript ECMAScript standard which is the most widely used programming language on Github.
As well as over 2 million packages available at NPM.
And there's a very active ECMA committee making improvements to the JavaScript language.
It's time for JSCAD designs to move forward but there are somethings you should know.
Please try all the examples, and get a feel for what's new. Let us know if you have any issues.
The old require() stetements need to be replaced with import() statements.
In addition, the old names spaces can be dropped.
All the functions for primitives, operations, etc are available directly.
NOTE: The old V2 namespaces should be considered obsolete.
// v2
const { cuboid } = require('@jscad/modeling').primitives
const { subtract } = require('@jscad/modeling').booleans
// v3
import { cuboid, subtract } from '@jscad/modeling'
In order to improve performance, there have been some changes. If your designs are using the data structures then please take note as changes may be required.
| Geometry | V2 | V3 |
|---|---|---|
| geom2 | { sides: [[vec2, vec2],...] } | { outlines: [[vec2, ...], ...] } |
| geom3 | { polygons: [poly3, ...] } | { polygons: [poly3, ...] } |
| path2 | { points: [vec2, ...], isClosed: false } | { points: [vec2, ...], isClosed: false } |
| path3 | { vertices: [vec3, ...], isClosed: false } | |
| poly2 | { vertices: [vec2, ...] } | { points: [vec2, ...] } |
| poly3 | { vertices: [vec3, ...] } | { vertices: [vec3, ...] } |
| slice | { edges: [[vec3, ...], ...] } | { contours: [[vec3, ...], ...] } |
NOTE: The big change is geom2, which now uses outlines, i.e. array of outlines.
If you find some strange results review the V3 API documenttion,
as non-camelCase parameter names were corrected.
Please let us know if the following list is missing something.
Most of the API remains but there are obsolete functions now. If your designs are using these then please take the time to make the changes. The obsolete functions could go away at any time.