Skip to content

Commit 94b4f5e

Browse files
committed
reduced num lines
1 parent 40c7fb6 commit 94b4f5e

File tree

1 file changed

+16
-30
lines changed

1 file changed

+16
-30
lines changed

src/traces/isosurface/convert.js

+16-30
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ function generateIsosurfaceMesh(data) {
633633
}
634634
}
635635

636-
function drawSlicesX(style, items, min, max) {
636+
function draw2dX(style, items, min, max) {
637637
items.forEach(function(i) {
638638
for(var k = 1; k < depth; k++) {
639639
for(var j = 1; j < height; j++) {
@@ -651,7 +651,7 @@ function generateIsosurfaceMesh(data) {
651651
});
652652
}
653653

654-
function drawSlicesY(style, items, min, max) {
654+
function draw2dY(style, items, min, max) {
655655
items.forEach(function(j) {
656656
for(var i = 1; i < width; i++) {
657657
for(var k = 1; k < depth; k++) {
@@ -669,7 +669,7 @@ function generateIsosurfaceMesh(data) {
669669
});
670670
}
671671

672-
function drawSlicesZ(style, items, min, max) {
672+
function draw2dZ(style, items, min, max) {
673673
items.forEach(function(k) {
674674
for(var j = 1; j < height; j++) {
675675
for(var i = 1; i < width; i++) {
@@ -687,8 +687,7 @@ function generateIsosurfaceMesh(data) {
687687
});
688688
}
689689

690-
function drawSpaceframe(style, min, max) {
691-
drawingSpaceframe = true;
690+
function draw3d(style, min, max) {
692691
for(var k = 1; k < depth; k++) {
693692
for(var j = 1; j < height; j++) {
694693
for(var i = 1; i < width; i++) {
@@ -708,30 +707,17 @@ function generateIsosurfaceMesh(data) {
708707
}
709708
}
710709
}
710+
}
711+
712+
function drawSpaceframe(style, min, max) {
713+
drawingSpaceframe = true;
714+
draw3d(style, min, max);
711715
drawingSpaceframe = false;
712716
}
713717

714718
function drawSurface(style, min, max) {
715719
drawingSurface = true;
716-
for(var k = 1; k < depth; k++) {
717-
for(var j = 1; j < height; j++) {
718-
for(var i = 1; i < width; i++) {
719-
begin3dCell(style,
720-
getIndex(i - 1, j - 1, k - 1),
721-
getIndex(i - 1, j - 1, k),
722-
getIndex(i - 1, j, k - 1),
723-
getIndex(i - 1, j, k),
724-
getIndex(i, j - 1, k - 1),
725-
getIndex(i, j - 1, k),
726-
getIndex(i, j, k - 1),
727-
getIndex(i, j, k),
728-
min,
729-
max,
730-
(i + j + k) % 2
731-
);
732-
}
733-
}
734-
}
720+
draw3d(style, min, max);
735721
drawingSurface = false;
736722
}
737723

@@ -829,11 +815,11 @@ function generateIsosurfaceMesh(data) {
829815
}
830816

831817
if(e === 'x') {
832-
drawSlicesX(activeStyle, indices, activeMin, activeMax);
818+
draw2dX(activeStyle, indices, activeMin, activeMax);
833819
} else if(e === 'y') {
834-
drawSlicesY(activeStyle, indices, activeMin, activeMax);
820+
draw2dY(activeStyle, indices, activeMin, activeMax);
835821
} else {
836-
drawSlicesZ(activeStyle, indices, activeMin, activeMax);
822+
draw2dZ(activeStyle, indices, activeMin, activeMax);
837823
}
838824
}
839825

@@ -842,11 +828,11 @@ function generateIsosurfaceMesh(data) {
842828
if(cap.show && cap.fill) {
843829
setFill(cap.fill);
844830
if(e === 'x') {
845-
drawSlicesX(activeStyle, [0, width - 1], activeMin, activeMax);
831+
draw2dX(activeStyle, [0, width - 1], activeMin, activeMax);
846832
} else if(e === 'y') {
847-
drawSlicesY(activeStyle, [0, height - 1], activeMin, activeMax);
833+
draw2dY(activeStyle, [0, height - 1], activeMin, activeMax);
848834
} else {
849-
drawSlicesZ(activeStyle, [0, depth - 1], activeMin, activeMax);
835+
draw2dZ(activeStyle, [0, depth - 1], activeMin, activeMax);
850836
}
851837
}
852838
}

0 commit comments

Comments
 (0)