15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
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
import { SphereOutlineGeometry } from "../../Source/Cesium.js";
import createPackableSpecs from "../createPackableSpecs.js";
import { Math as CesiumMath } from "../../Source/Cesium.js";
 
describe("Core/SphereOutlineGeometry", function () {
  it("constructor throws if stackPartitions less than 1", function () {
    expect(function () {
      return new SphereOutlineGeometry({
        stackPartitions: 0,
      });
    }).toThrowDeveloperError();
  });
 
  it("constructor throws if slicePartitions less than 0", function () {
    expect(function () {
      return new SphereOutlineGeometry({
        slicePartitions: -1,
      });
    }).toThrowDeveloperError();
  });
 
  it("constructor throws if subdivisions less than 0", function () {
    expect(function () {
      return new SphereOutlineGeometry({
        subdivisions: -2,
      });
    }).toThrowDeveloperError();
  });
 
  it("computes positions", function () {
    var m = SphereOutlineGeometry.createGeometry(
      new SphereOutlineGeometry({
        stackPartitions: 2,
        slicePartitions: 2,
        subdivisions: 2,
      })
    );
 
    expect(m.attributes.position.values.length).toEqual(12 * 3);
    expect(m.indices.length).toEqual(6 * 2);
    expect(m.boundingSphere.radius).toEqual(1);
  });
 
  it("undefined is returned if radius is equals to zero", function () {
    var sphereOutline = new SphereOutlineGeometry({
      radius: 0.0,
    });
 
    var geometry = SphereOutlineGeometry.createGeometry(sphereOutline);
 
    expect(geometry).toBeUndefined();
  });
 
  var sphere = new SphereOutlineGeometry({
    radius: 1,
    stackPartitions: 3,
    slicePartitions: 3,
    subdivisions: 2,
  });
  var packedInstance = [
    1.0,
    1.0,
    1.0,
    1.0,
    1.0,
    1.0,
    0.0,
    CesiumMath.TWO_PI,
    0.0,
    CesiumMath.PI,
    3.0,
    3.0,
    2.0,
    -1.0,
  ];
  createPackableSpecs(SphereOutlineGeometry, sphere, packedInstance);
});