@rulecad/topopt 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/topopt.mjs +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/topopt",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Topology optimisation for flat and solid parts: the stiffest layout of a fixed amount of material, printable without supports if asked, as outlines or a surface ready to print.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/topopt.mjs
CHANGED
|
@@ -85,7 +85,9 @@ export function discretise(p) {
|
|
|
85
85
|
const all = [...space, ...keep].map(bounds), lo = [], hi = [], n = [];
|
|
86
86
|
for (let a = 0; a < dim; a++) {
|
|
87
87
|
lo.push(Math.min(...all.map((b) => b[a]))); hi.push(Math.max(...all.map((b) => b[dim + a])));
|
|
88
|
-
|
|
88
|
+
// (up: rounded down, a 40 mm space on 3 mm cells was 39 mm; but not for a sliver of a cell, a surface poking a few
|
|
89
|
+
// nanometres past the space it was drawn in, which grew a 12 mm part's grid to 16 cells across)
|
|
90
|
+
n.push(Math.max(1, Math.ceil((hi[a] - lo[a]) / p.cell - 1e-3)));
|
|
89
91
|
}
|
|
90
92
|
if (dim === 2) for (let a = 0; a < 2; a++) lo[a] -= (n[a] * p.cell - (hi[a] - lo[a])) / 2; // the padding split evenly round the space
|
|
91
93
|
if (dim === 3) { // whole numbers of 2, 4 or 8 cells along every side, for multigrid
|