text: "use strict";
  /**
   * 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.Star = exports.DefaultStarProps = void 0;
  var tslib_1 = require("tslib");
  var linear_algebra_1 = require("../../mol-math/linear-algebra");
  var primitive_1 = require("./primitive");
  exports.DefaultStarProps = {
      pointCount: 5,
      outerRadius: 1,
      innerRadius: 0.5,
      thickness: 0.3
  };
  var op = linear_algebra_1.Vec3.zero(), on = linear_algebra_1.Vec3.zero();
  var a = linear_algebra_1.Vec3.zero(), b = linear_algebra_1.Vec3.zero(), c = linear_algebra_1.Vec3.zero();
  function Star(props) {
      var _a = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, exports.DefaultStarProps), props), outerRadius = _a.outerRadius, innerRadius = _a.innerRadius, thickness = _a.thickness, pointCount = _a.pointCount;
      var triangleCount = pointCount * 2 * 2;
      var builder = (0, primitive_1.PrimitiveBuilder)(triangleCount);
      var innerPoints = new Float32Array(pointCount * 2);
      var outerPoints = new Float32Array(pointCount * 2);
      for (var i = 0; i < pointCount; ++i) {
          var io = i * 2, ii = i * 2 + 1;
          var co = (io + 1) / pointCount * Math.PI, ci = (ii + 1) / pointCount * Math.PI;
          outerPoints[io] = Math.cos(co) * outerRadius;
          outerPoints[ii] = Math.sin(co) * outerRadius;
          innerPoints[io] = Math.cos(ci) * innerRadius;
          innerPoints[ii] = Math.sin(ci) * innerRadius;
      }
      linear_algebra_1.Vec3.set(op, 0, 0, thickness / 2);
      linear_algebra_1.Vec3.set(on, 0, 0, -thickness / 2);
      for (var i = 0; i < pointCount; ++i) {
          var ni = (i + 1) % pointCount;
          linear_algebra_1.Vec3.set(a, outerPoints[i * 2], outerPoints[i * 2 + 1], 0);
          linear_algebra_1.Vec3.set(b, innerPoints[i * 2], innerPoints[i * 2 + 1], 0);
          linear_algebra_1.Vec3.set(c, outerPoints[ni * 2], outerPoints[ni * 2 + 1], 0);
          builder.add(op, a, b);
          builder.add(b, a, on);
          builder.add(op, b, c);
          builder.add(c, b, on);
      }
      return builder.getPrimitive();
  }
  exports.Star = Star;
  //# sourceMappingURL=star.js.map