mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 04:27:55 +01:00
move adeline to separate file
This commit is contained in:
parent
ed76a9f255
commit
be77d6eeb5
@ -1,12 +1,6 @@
|
|||||||
import THREE from 'three.js';
|
import THREE from 'three.js';
|
||||||
|
|
||||||
export default function createLines(geometry, settings) {
|
function addLine(geometry, lineLookup, lines, a, b) {
|
||||||
console.log('constructing unique lines from geometry');
|
|
||||||
|
|
||||||
var lines = [];
|
|
||||||
var lineLookup = {};
|
|
||||||
|
|
||||||
var addLine = (a, b) => {
|
|
||||||
var index = lineLookup[`${b}_${a}`];
|
var index = lineLookup[`${b}_${a}`];
|
||||||
|
|
||||||
if (index === undefined) {
|
if (index === undefined) {
|
||||||
@ -23,6 +17,12 @@ export default function createLines(geometry, settings) {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default function createLines(geometry, settings) {
|
||||||
|
console.log('constructing unique lines from geometry');
|
||||||
|
|
||||||
|
var lines = [];
|
||||||
|
var lineLookup = {};
|
||||||
|
|
||||||
for (var i = 0; i < geometry.faces.length; i ++) {
|
for (var i = 0; i < geometry.faces.length; i ++) {
|
||||||
var face = geometry.faces[i];
|
var face = geometry.faces[i];
|
||||||
if (face.normal.y !== 1 && face.normal.y !== -1) {
|
if (face.normal.y !== 1 && face.normal.y !== -1) {
|
||||||
@ -30,9 +30,9 @@ export default function createLines(geometry, settings) {
|
|||||||
|
|
||||||
// check for only adding unique lines
|
// check for only adding unique lines
|
||||||
// returns index of said line
|
// returns index of said line
|
||||||
var a = addLine(face.a, face.b);
|
var a = addLine(geometry, lineLookup, lines, face.a, face.b);
|
||||||
var b = addLine(face.b, face.c);
|
var b = addLine(geometry, lineLookup, lines, face.b, face.c);
|
||||||
var c = addLine(face.c, face.a);
|
var c = addLine(geometry, lineLookup, lines, face.c, face.a);
|
||||||
|
|
||||||
// set connecting lines (based on face)
|
// set connecting lines (based on face)
|
||||||
lines[a].connects.push(b, c);
|
lines[a].connects.push(b, c);
|
||||||
|
Loading…
Reference in New Issue
Block a user