work on fdm slicing
This commit is contained in:
parent
5bf4142355
commit
6e172fe40f
12 changed files with 231 additions and 252 deletions
|
|
@ -1,26 +1,24 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
import { base } from '../geo/base.js';
|
||||
import { gyroid } from '../geo/gyroid.js';
|
||||
import { driver } from '../kiri-mode/fdm/driver.js';
|
||||
|
||||
import { base, util } from '../../geo/base.js';
|
||||
import { slice as gyroid_slice } from '../../geo/gyroid.js';
|
||||
|
||||
const { base, kiri } = root;
|
||||
const { util } = base;
|
||||
export const fill_fixed = {
|
||||
hex: fillHexFull,
|
||||
grid: fillGrid,
|
||||
triangle: fillTriangle
|
||||
};
|
||||
|
||||
const DEG2RAD = Math.PI / 180,
|
||||
FILL = kiri.fill = {
|
||||
hex: fillHexFull,
|
||||
grid: fillGrid,
|
||||
gyroid: fillGyroid,
|
||||
triangle: fillTriangle,
|
||||
linear: fillLinear,
|
||||
cubic: fillCubic
|
||||
},
|
||||
CACHE = kiri.fill_fixed = {
|
||||
hex: fillHexFull,
|
||||
grid: fillGrid,
|
||||
triangle: fillTriangle
|
||||
};
|
||||
export const fill = {
|
||||
hex: fillHexFull,
|
||||
grid: fillGrid,
|
||||
gyroid: fillGyroid,
|
||||
triangle: fillTriangle,
|
||||
linear: fillLinear,
|
||||
cubic: fillCubic
|
||||
};
|
||||
|
||||
const DEG2RAD = Math.PI / 180;
|
||||
|
||||
function fillHexFull(target) {
|
||||
fillHex(target, true);
|
||||
|
|
@ -106,13 +104,13 @@ function fillGyroid(target) {
|
|||
let tile_x = span_x / tile;
|
||||
let tile_y = span_y / tile;
|
||||
let tile_z = 1 / tile;
|
||||
let gyroid = base.gyroid.slice(target.zValue() * tile_z, (1 - density) * 500);
|
||||
let gen = gyroid_slice(target.zValue() * tile_z, (1 - density) * 500);
|
||||
|
||||
let polys = [];
|
||||
if (gyroid.dir == 'lr') {
|
||||
if (gen.dir == 'lr') {
|
||||
for (let ty=0; ty<=tile_y; ty++) {
|
||||
for (let tx=0; tx<=tile_x; tx++) {
|
||||
for (let poly of gyroid.polys) {
|
||||
for (let poly of gen.polys) {
|
||||
target.newline();
|
||||
let points = poly.map(el => {
|
||||
return {
|
||||
|
|
@ -129,7 +127,7 @@ function fillGyroid(target) {
|
|||
} else {
|
||||
for (let tx=0; tx<=tile_x; tx++) {
|
||||
for (let ty=0; ty<=tile_y; ty++) {
|
||||
for (let poly of gyroid.polys) {
|
||||
for (let poly of gen.polys) {
|
||||
target.newline();
|
||||
let points = poly.map(el => {
|
||||
return {
|
||||
|
|
@ -320,6 +318,3 @@ function fillTriangle(target) {
|
|||
target.emit(xp, bounds.max.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export { fillHexFull, fillHex, fillGyroid, connectOpenPolys, fillGrid, fillCubic, fillLinear, fillTriangle, DEG2RAD, spacing, vhlen, anxlen, anylen, bounds, even, evenZ, maxy, height, span_x, span_y, density, tile, tile_x, tile_y, tile_z, gyroid, polys, ty, tx, points, heal, ntmp, i, s1, j, s2, offset, tile_xc, tile_yc, bx, by, span, steps, step, ztype, line_w, xp };
|
||||
|
|
|
|||
Loading…
Reference in a new issue