molstar
Version:
A comprehensive macromolecular library.
432 lines • 16 kB
JavaScript
"use strict";
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author Fred Ludlow <fred.ludlow@gmail.com>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AllowedContours = exports.TriTable = exports.EdgeTable = exports.EdgeIdInfo = exports.CubeEdges = exports.CubeVertices = exports.EdgesYZ = exports.EdgesXZ = exports.EdgesXY = exports.IndexPair = exports.Index = void 0;
function Index(i, j, k) { return { i: i, j: j, k: k }; }
exports.Index = Index;
function IndexPair(a, b) { return { a: a, b: b }; }
exports.IndexPair = IndexPair;
exports.EdgesXY = [
[],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[]
];
exports.EdgesXZ = [
[],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[]
];
exports.EdgesYZ = [
[],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[]
];
exports.CubeVertices = [
Index(0, 0, 0),
Index(1, 0, 0),
Index(1, 1, 0),
Index(0, 1, 0),
Index(0, 0, 1),
Index(1, 0, 1),
Index(1, 1, 1),
Index(0, 1, 1), // h
];
exports.CubeEdges = [
IndexPair(exports.CubeVertices[0], exports.CubeVertices[1]),
IndexPair(exports.CubeVertices[1], exports.CubeVertices[2]),
IndexPair(exports.CubeVertices[2], exports.CubeVertices[3]),
IndexPair(exports.CubeVertices[3], exports.CubeVertices[0]),
IndexPair(exports.CubeVertices[4], exports.CubeVertices[5]),
IndexPair(exports.CubeVertices[5], exports.CubeVertices[6]),
IndexPair(exports.CubeVertices[6], exports.CubeVertices[7]),
IndexPair(exports.CubeVertices[7], exports.CubeVertices[4]),
IndexPair(exports.CubeVertices[0], exports.CubeVertices[4]),
IndexPair(exports.CubeVertices[1], exports.CubeVertices[5]),
IndexPair(exports.CubeVertices[2], exports.CubeVertices[6]),
IndexPair(exports.CubeVertices[3], exports.CubeVertices[7]),
];
exports.EdgeIdInfo = [
{ i: 0, j: 0, k: 0, e: 0 },
{ i: 1, j: 0, k: 0, e: 1 },
{ i: 0, j: 1, k: 0, e: 0 },
{ i: 0, j: 0, k: 0, e: 1 },
{ i: 0, j: 0, k: 1, e: 0 },
{ i: 1, j: 0, k: 1, e: 1 },
{ i: 0, j: 1, k: 1, e: 0 },
{ i: 0, j: 0, k: 1, e: 1 },
{ i: 0, j: 0, k: 0, e: 2 },
{ i: 1, j: 0, k: 0, e: 2 },
{ i: 1, j: 1, k: 0, e: 2 },
{ i: 0, j: 1, k: 0, e: 2 }
];
// Tables EdgeTable and TriTable taken from http://paulbourke.net/geometry/polygonise/
exports.EdgeTable = [
0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c,
0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac,
0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c,
0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc,
0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c,
0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc,
0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460,
0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0,
0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230,
0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190,
0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0
];
exports.TriTable = [
[],
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
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[]
];
/**
* Triangles are constructed between points on cube edges.
* AllowedContours[edge1][edge1] indicates which lines from a given
* triangle should be shown in line mode.
*
* Values are bitmasks:
* In loop over cubes we keep another bitmask indicating whether our current
* cell is the first x-value (1),
* first y-value (2) or first z-value (4) of the current loop.
* We draw all lines on leading faces but only draw trailing face lines the first
* time through the loop
* A value of 8 below means the edge is always drawn (leading face)
*
* E.g. the first row, lines between edge0 and other edges in the bottom
* x-y plane are only drawn for the first value of z, edges in the
* x-z plane are only drawn for the first value of y. No other lines
* are drawn as they're redundant
* The line between edge 1 and 5 is always drawn as it's on the leading edge
*/
exports.AllowedContours = [
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ]
];
//# sourceMappingURL=tables.js.map