molstar
Version:
A comprehensive macromolecular library.
22 lines • 914 B
JavaScript
/**
* Copyright (c) 2018 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.Sphere = exports.sphereVertexCount = void 0;
var polyhedron_1 = require("./polyhedron");
var icosahedron_1 = require("./icosahedron");
var _a = (0, icosahedron_1.Icosahedron)(), vertices = _a.vertices, indices = _a.indices;
/** Calculate vertex count for subdived icosahedron */
function sphereVertexCount(detail) {
return 10 * Math.pow(Math.pow(2, detail), 2) + 2;
}
exports.sphereVertexCount = sphereVertexCount;
/** Create sphere by subdividing an icosahedron */
function Sphere(detail) {
return (0, polyhedron_1.Polyhedron)(vertices, indices, { detail: detail, radius: 1 });
}
exports.Sphere = Sphere;
//# sourceMappingURL=sphere.js.map
;