Skip to content

Commit eb0fb94

Browse files
committed
improved patterns
1 parent 05f3c0d commit eb0fb94

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

src/traces/isosurface/attributes.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,25 @@ var attrs = module.exports = overrideAll(extendFlat({
163163
},
164164
pattern: {
165165
valType: 'enumerated',
166-
values: ['all', 'check1', 'check2', 'A', 'B', 'C', 'AB', 'AC', 'BC', 'ABC'],
166+
values: [
167+
'all', 'check1', 'check2',
168+
'A', 'B', 'C', 'D', 'E',
169+
'AB', 'AC', 'AD', 'AE',
170+
'BC', 'BD', 'BE',
171+
'CD', 'CE', 'DE',
172+
'ABC', 'ABD', 'ABE', 'ACD', 'ACE', 'ADE',
173+
'BCD', 'BCE', 'BDE', 'CDE',
174+
'ABCD', 'ABCE', 'ABDE', 'ACDE', 'BCDE'
175+
],
167176
dflt: 'all',
168177
role: 'style',
169178
description: [
170179
'Sets the surface pattern of the iso-surface 3-D sections. The default pattern of',
171180
'the surface is `all` meaning that the rest of surface elements would be shaded.',
172181
'The check options (either 1 or 2) could be used to draw half of the squares',
173-
'on the surface. Using various combinations of capital `A`, `B`, and `C` may also',
174-
'be used to reduce the number of triangles on the iso-surfaces and creating other',
175-
'patterns of interest.'
182+
'on the surface. Using various combinations of capital `A`, `B`, `C`, `D` and `E`',
183+
'may also be used to reduce the number of triangles on the iso-surfaces and',
184+
'creating other patterns of interest.'
176185
].join(' ')
177186
}
178187
},

src/traces/isosurface/convert.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,7 @@ function generateIsosurfaceMesh(data) {
524524
var p2 = calcIntersection(D, B, min, max);
525525
var p3 = calcIntersection(D, C, min, max);
526526

527-
if(styleIncludes(style, 'A')) {
528-
drawTri(null, [p1, p2, p3], [-1, -1, -1]);
529-
}
527+
drawTri(null, [p1, p2, p3], [-1, -1, -1]);
530528
}
531529

532530
interpolated = true;
@@ -557,9 +555,7 @@ function generateIsosurfaceMesh(data) {
557555
drawTri(style, [A, p4, p1], [abcd[e[0]], -1, -1]);
558556
drawTri(style, [B, p2, p3], [abcd[e[1]], -1, -1]);
559557
} else {
560-
if(styleIncludes(style, 'B')) {
561-
drawQuad(null, [p1, p2, p3, p4], [-1, -1, -1, -1]);
562-
}
558+
drawQuad(null, [p1, p2, p3, p4], [-1, -1, -1, -1]);
563559
}
564560

565561
interpolated = true;
@@ -588,9 +584,7 @@ function generateIsosurfaceMesh(data) {
588584
drawTri(style, [A, p2, p3], [abcd[e[0]], -1, -1]);
589585
drawTri(style, [A, p3, p1], [abcd[e[0]], -1, -1]);
590586
} else {
591-
if(styleIncludes(style, 'C')) {
592-
drawTri(null, [p1, p2, p3], [-1, -1, -1]);
593-
}
587+
drawTri(null, [p1, p2, p3], [-1, -1, -1]);
594588
}
595589

596590
interpolated = true;
@@ -602,13 +596,20 @@ function generateIsosurfaceMesh(data) {
602596
function addCube(style, p000, p001, p010, p011, p100, p101, p110, p111, min, max) {
603597

604598
if(drawingSurface) {
605-
var a = tryCreateTetra(style, [p000, p001, p010, p100], min, max);
606-
var b = tryCreateTetra(style, [p001, p010, p011, p111], min, max);
607-
var c = tryCreateTetra(style, [p001, p100, p101, p111], min, max);
608-
var d = tryCreateTetra(style, [p010, p100, p110, p111], min, max);
609-
610-
if(a || b || c || d) {
611-
tryCreateTetra(style, [p001, p010, p100, p111], min, max);
599+
if(styleIncludes(style, 'A')) {
600+
tryCreateTetra(null, [p000, p001, p010, p100], min, max);
601+
}
602+
if(styleIncludes(style, 'B')) {
603+
tryCreateTetra(null, [p001, p010, p011, p111], min, max);
604+
}
605+
if(styleIncludes(style, 'C')) {
606+
tryCreateTetra(null, [p001, p100, p101, p111], min, max);
607+
}
608+
if(styleIncludes(style, 'D')) {
609+
tryCreateTetra(null, [p010, p100, p110, p111], min, max);
610+
}
611+
if(styleIncludes(style, 'E')) {
612+
tryCreateTetra(null, [p001, p010, p100, p111], min, max);
612613
}
613614
}
614615

0 commit comments

Comments
 (0)