molstar
Version:
A comprehensive macromolecular library.
50 lines • 1.44 kB
JavaScript
/**
* Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.PlyFile = exports.PlyType = exports.PlyTypes = exports.PlyTypeByteLength = void 0;
// http://paulbourke.net/dataformats/ply/
// https://en.wikipedia.org/wiki/PLY_(file_format)
exports.PlyTypeByteLength = {
'char': 1,
'uchar': 1,
'short': 2,
'ushort': 2,
'int': 4,
'uint': 4,
'float': 4,
'double': 8,
'int8': 1,
'uint8': 1,
'int16': 2,
'uint16': 2,
'int32': 4,
'uint32': 4,
'float32': 4,
'float64': 8
};
exports.PlyTypes = new Set(Object.keys(exports.PlyTypeByteLength));
function PlyType(str) {
if (!exports.PlyTypes.has(str))
throw new Error("unknown ply type '" + str + "'");
return str;
}
exports.PlyType = PlyType;
function PlyFile(elements, elementNames, comments) {
var elementMap = new Map();
for (var i = 0, il = elementNames.length; i < il; ++i) {
elementMap.set(elementNames[i], elements[i]);
}
return {
comments: comments,
elementNames: elementNames,
getElement: function (name) {
return elementMap.get(name);
}
};
}
exports.PlyFile = PlyFile;
//# sourceMappingURL=schema.js.map
;