yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
 * Cesium - https://github.com/CesiumGS/cesium
 *
 * Copyright 2011-2020 Cesium Contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Columbus View (Pat. Pend.)
 *
 * Portions licensed separately.
 * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
 */
 
define(['exports', './ComponentDatatype-f194c48b'], (function (exports, ComponentDatatype) { 'use strict';
 
  /**
   * @private
   */
  var CylinderGeometryLibrary = {};
 
  /**
   * @private
   */
  CylinderGeometryLibrary.computePositions = function (
    length,
    topRadius,
    bottomRadius,
    slices,
    fill
  ) {
    var topZ = length * 0.5;
    var bottomZ = -topZ;
 
    var twoSlice = slices + slices;
    var size = fill ? 2 * twoSlice : twoSlice;
    var positions = new Float64Array(size * 3);
    var i;
    var index = 0;
    var tbIndex = 0;
    var bottomOffset = fill ? twoSlice * 3 : 0;
    var topOffset = fill ? (twoSlice + slices) * 3 : slices * 3;
 
    for (i = 0; i < slices; i++) {
      var angle = (i / slices) * ComponentDatatype.CesiumMath.TWO_PI;
      var x = Math.cos(angle);
      var y = Math.sin(angle);
      var bottomX = x * bottomRadius;
      var bottomY = y * bottomRadius;
      var topX = x * topRadius;
      var topY = y * topRadius;
 
      positions[tbIndex + bottomOffset] = bottomX;
      positions[tbIndex + bottomOffset + 1] = bottomY;
      positions[tbIndex + bottomOffset + 2] = bottomZ;
 
      positions[tbIndex + topOffset] = topX;
      positions[tbIndex + topOffset + 1] = topY;
      positions[tbIndex + topOffset + 2] = topZ;
      tbIndex += 3;
      if (fill) {
        positions[index++] = bottomX;
        positions[index++] = bottomY;
        positions[index++] = bottomZ;
        positions[index++] = topX;
        positions[index++] = topY;
        positions[index++] = topZ;
      }
    }
 
    return positions;
  };
 
  exports.CylinderGeometryLibrary = CylinderGeometryLibrary;
 
}));
//# sourceMappingURL=CylinderGeometryLibrary-c09ae083.js.map