cesium-to-three 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +226 -0
- package/dist/arrow.js +523 -0
- package/dist/arrow.js.map +1 -0
- package/dist/ground.js +34 -0
- package/dist/ground.js.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/text-primitive-Ci0sbuh1.js +60066 -0
- package/dist/text-primitive-Ci0sbuh1.js.map +1 -0
- package/dist/types/cesium-three-ground.d.ts +2 -0
- package/dist/types/cesium-three-ground.d.ts.map +1 -0
- package/dist/types/lib/arrow/arrow-curves.d.ts +73 -0
- package/dist/types/lib/arrow/arrow-curves.d.ts.map +1 -0
- package/dist/types/lib/arrow/arrow-geometry.d.ts +140 -0
- package/dist/types/lib/arrow/arrow-geometry.d.ts.map +1 -0
- package/dist/types/lib/arrow/arrow-polygon.d.ts +87 -0
- package/dist/types/lib/arrow/arrow-polygon.d.ts.map +1 -0
- package/dist/types/lib/arrow/arrow-types.d.ts +152 -0
- package/dist/types/lib/arrow/arrow-types.d.ts.map +1 -0
- package/dist/types/lib/arrow/index.d.ts +8 -0
- package/dist/types/lib/arrow/index.d.ts.map +1 -0
- package/dist/types/lib/arrow/shapes/assault-direction-arrow.d.ts +20 -0
- package/dist/types/lib/arrow/shapes/assault-direction-arrow.d.ts.map +1 -0
- package/dist/types/lib/arrow/shapes/attack-arrow.d.ts +56 -0
- package/dist/types/lib/arrow/shapes/attack-arrow.d.ts.map +1 -0
- package/dist/types/lib/arrow/shapes/curved-arrow.d.ts +10 -0
- package/dist/types/lib/arrow/shapes/curved-arrow.d.ts.map +1 -0
- package/dist/types/lib/arrow/shapes/fine-arrow.d.ts +23 -0
- package/dist/types/lib/arrow/shapes/fine-arrow.d.ts.map +1 -0
- package/dist/types/lib/arrow/shapes/swallowtail-attack-arrow.d.ts +12 -0
- package/dist/types/lib/arrow/shapes/swallowtail-attack-arrow.d.ts.map +1 -0
- package/dist/types/lib/ground/cesium-ground-adapter.d.ts +9 -0
- package/dist/types/lib/ground/cesium-ground-adapter.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-construct-extruded.d.ts +62 -0
- package/dist/types/lib/ground/circle/circle-construct-extruded.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-extents.d.ts +23 -0
- package/dist/types/lib/ground/circle/circle-extents.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-options.d.ts +59 -0
- package/dist/types/lib/ground/circle/circle-options.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-positions.d.ts +56 -0
- package/dist/types/lib/ground/circle/circle-positions.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-shadow-volume.d.ts +24 -0
- package/dist/types/lib/ground/circle/circle-shadow-volume.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-top-bottom.d.ts +70 -0
- package/dist/types/lib/ground/circle/circle-top-bottom.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-top-indices.d.ts +28 -0
- package/dist/types/lib/ground/circle/circle-top-indices.d.ts.map +1 -0
- package/dist/types/lib/ground/circle/circle-wall-construction.d.ts +75 -0
- package/dist/types/lib/ground/circle/circle-wall-construction.d.ts.map +1 -0
- package/dist/types/lib/ground/classification.d.ts +124 -0
- package/dist/types/lib/ground/classification.d.ts.map +1 -0
- package/dist/types/lib/ground/constants.d.ts +26 -0
- package/dist/types/lib/ground/constants.d.ts.map +1 -0
- package/dist/types/lib/ground/depth.d.ts +63 -0
- package/dist/types/lib/ground/depth.d.ts.map +1 -0
- package/dist/types/lib/ground/geometry.d.ts +12 -0
- package/dist/types/lib/ground/geometry.d.ts.map +1 -0
- package/dist/types/lib/ground/index.d.ts +6 -0
- package/dist/types/lib/ground/index.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-arrowhead.d.ts +67 -0
- package/dist/types/lib/ground/line/line-arrowhead.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-densify.d.ts +35 -0
- package/dist/types/lib/ground/line/line-densify.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-geometry-normals.d.ts +49 -0
- package/dist/types/lib/ground/line/line-geometry-normals.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-options.d.ts +54 -0
- package/dist/types/lib/ground/line/line-options.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-preprocess.d.ts +12 -0
- package/dist/types/lib/ground/line/line-preprocess.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-segment-attributes.d.ts +24 -0
- package/dist/types/lib/ground/line/line-segment-attributes.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-shadow-volume.d.ts +25 -0
- package/dist/types/lib/ground/line/line-shadow-volume.d.ts.map +1 -0
- package/dist/types/lib/ground/line/line-types.d.ts +74 -0
- package/dist/types/lib/ground/line/line-types.d.ts.map +1 -0
- package/dist/types/lib/ground/materials.d.ts +69 -0
- package/dist/types/lib/ground/materials.d.ts.map +1 -0
- package/dist/types/lib/ground/math/cartographic.d.ts +27 -0
- package/dist/types/lib/ground/math/cartographic.d.ts.map +1 -0
- package/dist/types/lib/ground/math/constants.d.ts +20 -0
- package/dist/types/lib/ground/math/constants.d.ts.map +1 -0
- package/dist/types/lib/ground/math/ellipsoid-geodesic.d.ts +93 -0
- package/dist/types/lib/ground/math/ellipsoid-geodesic.d.ts.map +1 -0
- package/dist/types/lib/ground/math/ellipsoid-rhumb-line.d.ts +45 -0
- package/dist/types/lib/ground/math/ellipsoid-rhumb-line.d.ts.map +1 -0
- package/dist/types/lib/ground/math/ellipsoid.d.ts +94 -0
- package/dist/types/lib/ground/math/ellipsoid.d.ts.map +1 -0
- package/dist/types/lib/ground/math/enu-frame.d.ts +27 -0
- package/dist/types/lib/ground/math/enu-frame.d.ts.map +1 -0
- package/dist/types/lib/ground/math/matrix4-helpers.d.ts +20 -0
- package/dist/types/lib/ground/math/matrix4-helpers.d.ts.map +1 -0
- package/dist/types/lib/ground/math/rte-encoding.d.ts +51 -0
- package/dist/types/lib/ground/math/rte-encoding.d.ts.map +1 -0
- package/dist/types/lib/ground/math/vec3-helpers.d.ts +50 -0
- package/dist/types/lib/ground/math/vec3-helpers.d.ts.map +1 -0
- package/dist/types/lib/ground/math/wgs84-helpers.d.ts +22 -0
- package/dist/types/lib/ground/math/wgs84-helpers.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/ellipsoid-tangent-plane.d.ts +71 -0
- package/dist/types/lib/ground/polygon/ellipsoid-tangent-plane.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-cap-construction.d.ts +59 -0
- package/dist/types/lib/ground/polygon/polygon-cap-construction.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-construct-extruded.d.ts +44 -0
- package/dist/types/lib/ground/polygon/polygon-construct-extruded.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-extents.d.ts +24 -0
- package/dist/types/lib/ground/polygon/polygon-extents.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-helpers.d.ts +76 -0
- package/dist/types/lib/ground/polygon/polygon-helpers.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-hierarchy.d.ts +60 -0
- package/dist/types/lib/ground/polygon/polygon-hierarchy.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-offset.d.ts +15 -0
- package/dist/types/lib/ground/polygon/polygon-offset.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-options.d.ts +41 -0
- package/dist/types/lib/ground/polygon/polygon-options.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-rectangle.d.ts +30 -0
- package/dist/types/lib/ground/polygon/polygon-rectangle.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-rings.d.ts +64 -0
- package/dist/types/lib/ground/polygon/polygon-rings.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-shadow-volume.d.ts +39 -0
- package/dist/types/lib/ground/polygon/polygon-shadow-volume.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-style-points.d.ts +29 -0
- package/dist/types/lib/ground/polygon/polygon-style-points.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-subdivide-line.d.ts +93 -0
- package/dist/types/lib/ground/polygon/polygon-subdivide-line.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-subdivide-triangle.d.ts +53 -0
- package/dist/types/lib/ground/polygon/polygon-subdivide-triangle.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/polygon-wall-construction.d.ts +77 -0
- package/dist/types/lib/ground/polygon/polygon-wall-construction.d.ts.map +1 -0
- package/dist/types/lib/ground/polygon/triangulation.d.ts +40 -0
- package/dist/types/lib/ground/polygon/triangulation.d.ts.map +1 -0
- package/dist/types/lib/ground/primitives.d.ts +262 -0
- package/dist/types/lib/ground/primitives.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-attributes.d.ts +29 -0
- package/dist/types/lib/ground/rectangle/rectangle-attributes.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-construct-cap.d.ts +53 -0
- package/dist/types/lib/ground/rectangle/rectangle-construct-cap.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-construct-extruded.d.ts +35 -0
- package/dist/types/lib/ground/rectangle/rectangle-construct-extruded.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-debug.d.ts +22 -0
- package/dist/types/lib/ground/rectangle/rectangle-debug.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-extents.d.ts +33 -0
- package/dist/types/lib/ground/rectangle/rectangle-extents.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-grid.d.ts +76 -0
- package/dist/types/lib/ground/rectangle/rectangle-grid.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-helpers.d.ts +103 -0
- package/dist/types/lib/ground/rectangle/rectangle-helpers.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-options.d.ts +21 -0
- package/dist/types/lib/ground/rectangle/rectangle-options.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-radians.d.ts +51 -0
- package/dist/types/lib/ground/rectangle/rectangle-radians.d.ts.map +1 -0
- package/dist/types/lib/ground/rectangle/rectangle-shadow-volume.d.ts +28 -0
- package/dist/types/lib/ground/rectangle/rectangle-shadow-volume.d.ts.map +1 -0
- package/dist/types/lib/ground/terrain-heights.d.ts +65 -0
- package/dist/types/lib/ground/terrain-heights.d.ts.map +1 -0
- package/dist/types/lib/ground/terrain-log-depth.d.ts +32 -0
- package/dist/types/lib/ground/terrain-log-depth.d.ts.map +1 -0
- package/dist/types/lib/ground/text/index.d.ts +7 -0
- package/dist/types/lib/ground/text/index.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-canvas.d.ts +22 -0
- package/dist/types/lib/ground/text/text-canvas.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-color.d.ts +28 -0
- package/dist/types/lib/ground/text/text-color.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-construct-extruded.d.ts +27 -0
- package/dist/types/lib/ground/text/text-construct-extruded.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-defaults.d.ts +12 -0
- package/dist/types/lib/ground/text/text-defaults.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-extents.d.ts +19 -0
- package/dist/types/lib/ground/text/text-extents.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-layout.d.ts +18 -0
- package/dist/types/lib/ground/text/text-layout.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-options.d.ts +26 -0
- package/dist/types/lib/ground/text/text-options.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-placement.d.ts +34 -0
- package/dist/types/lib/ground/text/text-placement.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-primitive.d.ts +74 -0
- package/dist/types/lib/ground/text/text-primitive.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-shadow-volume.d.ts +21 -0
- package/dist/types/lib/ground/text/text-shadow-volume.d.ts.map +1 -0
- package/dist/types/lib/ground/text/text-types.d.ts +156 -0
- package/dist/types/lib/ground/text/text-types.d.ts.map +1 -0
- package/dist/types/lib/ground/types.d.ts +484 -0
- package/dist/types/lib/ground/types.d.ts.map +1 -0
- package/dist/types/lib/ground/validation.d.ts +8 -0
- package/dist/types/lib/ground/validation.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Polygon wall(单个 ring 的挤出墙)构造结果。
|
|
4
|
+
*
|
|
5
|
+
* 布局(匹配 Cesium computeWallGeometry):
|
|
6
|
+
* positions = [
|
|
7
|
+
* <top vertex 0..perSide-1>, // 高度 = maximumHeight,扁平 (x, y, z, x, y, z, ...)
|
|
8
|
+
* <bottom vertex 0..perSide-1>, // 高度 = minimumHeight
|
|
9
|
+
* ]
|
|
10
|
+
* 每个 vertex 占 3 个 Float64;perSide = 每条 edge 的 (subdivideLineCount + 1) 之和。
|
|
11
|
+
*
|
|
12
|
+
* extrudeDirection 同样长度:
|
|
13
|
+
* top 半 = (0, 0, 0)
|
|
14
|
+
* bot 半 = -geodeticSurfaceNormal(top 半对应位置)
|
|
15
|
+
*
|
|
16
|
+
* indices 引用本 wall 局部顶点 ID(0 到 perSide × 2 - 1);
|
|
17
|
+
* 合并到 prism 时由 caller 加偏移。
|
|
18
|
+
*/
|
|
19
|
+
export interface PolygonWallResult {
|
|
20
|
+
/** Float64 ECEF,长度 = 6 × perSideVertexCount */
|
|
21
|
+
positions: Float64Array;
|
|
22
|
+
/** Float32 extrudeDirection,长度同 positions */
|
|
23
|
+
extrudeDirection: Float32Array;
|
|
24
|
+
/** Uint16/32 索引,长度 = 6 × (perSideVertexCount - ringLength) */
|
|
25
|
+
indices: Uint16Array | Uint32Array;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 构造单个 polygon ring 的挤出墙。
|
|
29
|
+
*
|
|
30
|
+
* 算法 5 步,顺序与 Cesium computeWallGeometry + scaleToGeodeticHeightExtruded +
|
|
31
|
+
* computeAttributes(shadowVolume + wall 分支)一致:
|
|
32
|
+
*
|
|
33
|
+
* 步骤 1 · 计算 perSideVertexCount
|
|
34
|
+
* 遍历 length 条 edge(p1=ring[i], p2=ring[(i+1) % length]),
|
|
35
|
+
* 累加 subdivideLineCount(p1, p2, minDistance) + 1(每条 edge 产 N+1 顶点),
|
|
36
|
+
* 得到每一面(top 或 bot)的总顶点数。
|
|
37
|
+
*
|
|
38
|
+
* 步骤 2 · 写 chord 顶点到双面 buffer
|
|
39
|
+
* 对每条 edge:
|
|
40
|
+
* a. subdivideLine(p1, p2) → 一维 [p1.x, p1.y, p1.z, mid1.x, ..., mid_{N-1}.z]
|
|
41
|
+
* (注意:输出不含 p2 端点)
|
|
42
|
+
* b. 把 subdivideLine 结果同时写入 top 半与 bottom 半
|
|
43
|
+
* c. 显式写 p2.{x, y, z} 到 top 与 bot(edge 的终点;同时也是下一条 edge 的起点
|
|
44
|
+
* —— 但下一条 edge 的 subdivideLine 输出 p2(next.p1)再次,所以 wall 上
|
|
45
|
+
* 相邻 edge 之间确实有"重复顶点对",由索引步骤的 corner-skipping 跳过)
|
|
46
|
+
*
|
|
47
|
+
* 步骤 3 · 生成索引(使用 chord 位置,top == bottom,所以位置相等判定可识别 corner)
|
|
48
|
+
* for i in [0, perSideVertexCount):
|
|
49
|
+
* UL = i,UR = i + 1
|
|
50
|
+
* LL = UL + perSideVertexCount,LR = UR + perSideVertexCount
|
|
51
|
+
* p_UL = positions[UL × 3..],p_UR = positions[UR × 3..]
|
|
52
|
+
* if equalsEpsilon(p_UL, p_UR, EPSILON10): continue // corner / wrap-around 自动跳过
|
|
53
|
+
* 否则写 2 个三角形:(UL, LL, UR) + (UR, LL, LR)
|
|
54
|
+
*
|
|
55
|
+
* 步骤 4 · scaleToGeodeticHeightExtruded:把 chord 位置投到指定高度
|
|
56
|
+
* for i in [0, perSideFloatLength) step 3:
|
|
57
|
+
* chord = positions[i..i+3] (原始 chord 位置,top 半,bot 半相同)
|
|
58
|
+
* surface = scaleToGeodeticSurface(chord)
|
|
59
|
+
* normal = geodeticSurfaceNormal(chord)
|
|
60
|
+
* positions[i.. (top)] = surface + maxHeight * normal
|
|
61
|
+
* positions[i + perSideFloatLength.. (bot)] = surface + minHeight * normal
|
|
62
|
+
* 注:Cesium 用 chord 位置(非 surface)算 normal;细微差异但与 Cesium 一致。
|
|
63
|
+
*
|
|
64
|
+
* 步骤 5 · extrudeDirection
|
|
65
|
+
* top 半 = (0, 0, 0)(Float32Array 默认 0)
|
|
66
|
+
* bot 半 = -geodeticSurfaceNormal(top 半对应位置)
|
|
67
|
+
* Cesium 在 computeAttributes 的 shadowVolume + wall 分支里重新读取 top 半
|
|
68
|
+
* 位置(at maxHeight,已被 step 4 修改)算 normal,与本步骤一致。
|
|
69
|
+
*
|
|
70
|
+
* @param ringPositions 单个 ring 的椭球面 ECEF 顶点(已经过 winding 校正)。
|
|
71
|
+
* @param granularity 角分辨率,弧度(控制 minDistance 阈值)。
|
|
72
|
+
* @param minimumHeight 底面高度,米(典型 -55000)。
|
|
73
|
+
* @param maximumHeight 顶面高度,米(典型 +55000)。
|
|
74
|
+
* @returns PolygonWallResult。
|
|
75
|
+
*/
|
|
76
|
+
export declare function constructPolygonWall(ringPositions: readonly Vector3[], granularity: number, minimumHeight: number, maximumHeight: number): PolygonWallResult;
|
|
77
|
+
//# sourceMappingURL=polygon-wall-construction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polygon-wall-construction.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/polygon/polygon-wall-construction.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAWhC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IACjC,+CAA+C;IAC/C,SAAS,EAAE,YAAY,CAAC;IAExB,6CAA6C;IAC7C,gBAAgB,EAAE,YAAY,CAAC;IAE/B,8DAA8D;IAC9D,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;CACnC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,oBAAoB,CACnC,aAAa,EAAE,SAAS,OAAO,EAAE,EACjC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,GACnB,iBAAiB,CAkMnB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Vector2 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* 对 2D 多边形(outer ring + 可选 holes)做三角剖分,返回索引数组。
|
|
4
|
+
*
|
|
5
|
+
* 顶点排列约定(必须与 caller polygon-rings.ts 输出一致):
|
|
6
|
+
* positions2D = [
|
|
7
|
+
* outer ring 顶点 0,
|
|
8
|
+
* outer ring 顶点 1,
|
|
9
|
+
* ...,
|
|
10
|
+
* outer ring 顶点 (outerN - 1),
|
|
11
|
+
* hole_0 顶点 0,
|
|
12
|
+
* hole_0 顶点 1,
|
|
13
|
+
* ...,
|
|
14
|
+
* hole_M 顶点 (lastHoleN - 1),
|
|
15
|
+
* ]
|
|
16
|
+
* holeStartIndices = [ outer 之后的第一个 hole 起点, ... ] (顶点索引,非浮点偏移)
|
|
17
|
+
*
|
|
18
|
+
* winding 约定:
|
|
19
|
+
* - outer ring 必须 CCW(有向面积 > 0)
|
|
20
|
+
* - 每个 hole 必须 CW(有向面积 < 0)
|
|
21
|
+
*
|
|
22
|
+
* 上述 winding 由 polygon-rings.ts 的 `processRing` 用 shoelace 公式校正,
|
|
23
|
+
* 本函数**不再做** winding 检查或反转 — 分层职责。
|
|
24
|
+
*
|
|
25
|
+
* earcut 库版本:本项目 `package.json:earcut@^3.0.2` 与 Cesium 通过 npm 解析后的
|
|
26
|
+
* earcut 是同一个安装(都 import "earcut" 字符串,Node 解析到同一 node_modules)。
|
|
27
|
+
* 因此 V5 字节级一致路径理论可达。
|
|
28
|
+
*
|
|
29
|
+
* 退化兜底:
|
|
30
|
+
* - 若 positions2D 长度 < 3(< 1 个三角形),或 earcut 返回 < 3 个索引(共线 / 自相交
|
|
31
|
+
* 等极端情况),返回 `[0, 1, 2]` 占位三角形,避免下游 computeSubdivision 崩溃。
|
|
32
|
+
* Cesium 在 createGeometryFromPositions(L974-977)做同样兜底,本函数把这一层
|
|
33
|
+
* 合并进来。
|
|
34
|
+
*
|
|
35
|
+
* @param positions2D 切平面 2D 顶点(由 ellipsoid-tangent-plane.projectPointsOntoPlane 产出)。
|
|
36
|
+
* @param holeStartIndices 每个洞的起始顶点索引(可选;无洞时省略或 undefined)。
|
|
37
|
+
* @returns 顶点索引数组,长度 = 3 × 三角形数(典型 N 顶点凸 polygon → 3·(N-2) 个索引)。
|
|
38
|
+
*/
|
|
39
|
+
export declare function triangulate(positions2D: readonly Vector2[], holeStartIndices?: readonly number[]): number[];
|
|
40
|
+
//# sourceMappingURL=triangulation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triangulation.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/polygon/triangulation.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,WAAW,CAC1B,WAAW,EAAE,SAAS,OAAO,EAAE,EAC/B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,GAClC,MAAM,EAAE,CAiCV"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { Group, Mesh } from 'three';
|
|
2
|
+
import { CesiumClassificationPrimitive } from './classification';
|
|
3
|
+
import type { CartesianLike, CesiumGroundArrowMode, CesiumGroundArrowStyle, CesiumGroundCirclePrimitiveOptions, CesiumGroundFrameState, CesiumGroundPointPrimitiveOptions, CesiumGroundPointShape, CesiumGroundPolygonOptions, CesiumGroundPolylineOptions, CesiumGroundRectanglePrimitiveOptions, LonLatPoint, RectangleRadians } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* 使用本地 rectangle shadow-volume 管线实现的贴地矩形。
|
|
6
|
+
* classification 命令组保持复用,保留此前针对抖动问题落地的全部精度修复。
|
|
7
|
+
*/
|
|
8
|
+
export declare class CesiumGroundRectanglePrimitive {
|
|
9
|
+
readonly classification: CesiumClassificationPrimitive;
|
|
10
|
+
readonly debugSurface: Mesh | null;
|
|
11
|
+
readonly rectangle: RectangleRadians;
|
|
12
|
+
constructor(options: CesiumGroundRectanglePrimitiveOptions);
|
|
13
|
+
/**
|
|
14
|
+
* 更新逐帧 uniform。
|
|
15
|
+
*
|
|
16
|
+
* @param frameState 当前 Three 侧帧状态。
|
|
17
|
+
*/
|
|
18
|
+
update(frameState: CesiumGroundFrameState): void;
|
|
19
|
+
/**
|
|
20
|
+
* 更新矩形命令块的渲染顺序。
|
|
21
|
+
*
|
|
22
|
+
* @param renderOrder 分配给 front-stencil 命令的基础顺序。
|
|
23
|
+
*/
|
|
24
|
+
setRenderOrder(renderOrder: number): void;
|
|
25
|
+
/**
|
|
26
|
+
* 释放资源。
|
|
27
|
+
*/
|
|
28
|
+
dispose(): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 使用本地 polygon shadow-volume 管线实现的贴地多边形。
|
|
32
|
+
* 描边通过 classification 图元的 polygon-border uniform 支持,是附加能力,
|
|
33
|
+
* 不影响精度关键路径。
|
|
34
|
+
*
|
|
35
|
+
* 支持两种调用形态:
|
|
36
|
+
* 1. 新的 ref 风格 API:`points`、可选 `holes` / `hole` / `rotationDegrees`,
|
|
37
|
+
* 以及独立的 `fillColor` / `strokeColor` 等字段。
|
|
38
|
+
* 2. 旧版 `polygonHierarchyDegrees` 形态,搭配 `color` / `alpha`。
|
|
39
|
+
* 构造器会检测实际输入并路由到对应路径。
|
|
40
|
+
*/
|
|
41
|
+
export declare class CesiumGroundPolygonPrimitive {
|
|
42
|
+
readonly classification: CesiumClassificationPrimitive;
|
|
43
|
+
readonly polygonHierarchy: {
|
|
44
|
+
positions: CartesianLike[];
|
|
45
|
+
holes: unknown[];
|
|
46
|
+
};
|
|
47
|
+
readonly rotationDegrees: number;
|
|
48
|
+
readonly hole: boolean;
|
|
49
|
+
constructor(options: CesiumGroundPolygonOptions);
|
|
50
|
+
/**
|
|
51
|
+
* 更新逐帧 uniform。
|
|
52
|
+
*
|
|
53
|
+
* @param frameState 当前 Three 侧帧状态。
|
|
54
|
+
*/
|
|
55
|
+
update(frameState: CesiumGroundFrameState): void;
|
|
56
|
+
/**
|
|
57
|
+
* 更新多边形命令块的渲染顺序。
|
|
58
|
+
*
|
|
59
|
+
* @param renderOrder 分配给 front-stencil 命令的基础顺序。
|
|
60
|
+
*/
|
|
61
|
+
setRenderOrder(renderOrder: number): void;
|
|
62
|
+
/**
|
|
63
|
+
* 释放资源。
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 使用本地 circle shadow-volume 管线实现的贴地圆。
|
|
69
|
+
*
|
|
70
|
+
* plot-spec 选项与参考项目保持同形:`center` + `radius` + stroke/fill/visible,
|
|
71
|
+
* 以及可选装饰字段 `ringCount`、`ringGapMeters`、`sectorStartDegrees`、
|
|
72
|
+
* `sectorAngleDegrees`、`stRotationRadians`、`granularityRadians`,
|
|
73
|
+
* shadow-volume 窗口高度 `height` / `extrudedHeight`,以及
|
|
74
|
+
* `renderOrder` / `fragmentCull` 控制项。片元着色器的 circle 分支通过
|
|
75
|
+
* `classification.setCircleBorderStyle(...)` 激活;LOG_DEPTH 与 Float64 路径不受影响。
|
|
76
|
+
*/
|
|
77
|
+
export declare class CesiumGroundCirclePrimitive {
|
|
78
|
+
readonly classification: CesiumClassificationPrimitive;
|
|
79
|
+
readonly center: LonLatPoint;
|
|
80
|
+
readonly radius: number;
|
|
81
|
+
constructor(options: CesiumGroundCirclePrimitiveOptions);
|
|
82
|
+
/**
|
|
83
|
+
* 更新逐帧 uniform。
|
|
84
|
+
*
|
|
85
|
+
* @param frameState 当前 Three 侧帧状态。
|
|
86
|
+
*/
|
|
87
|
+
update(frameState: CesiumGroundFrameState): void;
|
|
88
|
+
/**
|
|
89
|
+
* 更新圆形命令块的渲染顺序。
|
|
90
|
+
*
|
|
91
|
+
* @param renderOrder 分配给 front-stencil 命令的基础顺序。
|
|
92
|
+
*/
|
|
93
|
+
setRenderOrder(renderOrder: number): void;
|
|
94
|
+
/**
|
|
95
|
+
* 释放资源。
|
|
96
|
+
*/
|
|
97
|
+
dispose(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 贴地点标绘。点本质上是一种"特殊"图元——把 lon/lat 锚点 + 米尺寸映射到既有
|
|
101
|
+
* 的圆形或矩形 shadow-volume 管线,而不是新增一套渲染路径:
|
|
102
|
+
* - shape='circle' → 委托给 CesiumGroundCirclePrimitive,center=position,
|
|
103
|
+
* radius=size/2。沿用圆形的扇区 / 环线 / 描边 shader 分支。
|
|
104
|
+
* - shape='square' → 委托给 CesiumGroundRectanglePrimitive,4 角点由 ENU 米
|
|
105
|
+
* 偏移反算(±size/2 east/north),沿用矩形的轴对齐 fill + 描边路径。
|
|
106
|
+
*
|
|
107
|
+
* 这样描边 / 填充 / 命令 visibility / fragment culling / classification depth
|
|
108
|
+
* 等所有精度修复都自动继承,不会引入任何新的着色器分支或几何路径。
|
|
109
|
+
*/
|
|
110
|
+
export declare class CesiumGroundPointPrimitive {
|
|
111
|
+
readonly classification: CesiumClassificationPrimitive;
|
|
112
|
+
readonly position: LonLatPoint;
|
|
113
|
+
readonly shape: CesiumGroundPointShape;
|
|
114
|
+
readonly size: number;
|
|
115
|
+
private readonly delegate;
|
|
116
|
+
constructor(options: CesiumGroundPointPrimitiveOptions);
|
|
117
|
+
/**
|
|
118
|
+
* 更新底层图元的逐帧 uniform。
|
|
119
|
+
*/
|
|
120
|
+
update(frameState: CesiumGroundFrameState): void;
|
|
121
|
+
/**
|
|
122
|
+
* 更新点图元命令块的渲染顺序。
|
|
123
|
+
*/
|
|
124
|
+
setRenderOrder(renderOrder: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* 释放资源。
|
|
127
|
+
*/
|
|
128
|
+
dispose(): void;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 贴地折线(polyline)—— 与 polygon/rectangle/circle 等贴地面图元正交的
|
|
132
|
+
* 「深度纹理重建分类法」单 pass 管线:每段 8 顶点 box + FS 内重建地形点 +
|
|
133
|
+
* 三平面距离裁切 + 上色。无 stencil。详见 doc 00 §1。
|
|
134
|
+
*
|
|
135
|
+
* 公开方法:
|
|
136
|
+
* primitive.group // Three.Group,scene.add(primitive.group)
|
|
137
|
+
* primitive.update(frameState) // 每帧
|
|
138
|
+
* primitive.setColor(...)
|
|
139
|
+
* primitive.setWidth(...) // screen→px / world→m
|
|
140
|
+
* primitive.setRenderOrder(n)
|
|
141
|
+
* primitive.setVisible(b)
|
|
142
|
+
* primitive.dispose()
|
|
143
|
+
*/
|
|
144
|
+
export declare class CesiumGroundPolylinePrimitive {
|
|
145
|
+
private readonly _group;
|
|
146
|
+
private readonly uniforms;
|
|
147
|
+
private readonly mesh;
|
|
148
|
+
private readonly material;
|
|
149
|
+
private geometry;
|
|
150
|
+
private readonly options;
|
|
151
|
+
private readonly cameraHigh;
|
|
152
|
+
private readonly cameraLow;
|
|
153
|
+
private arrowMesh?;
|
|
154
|
+
private arrowMaterial?;
|
|
155
|
+
private arrowGeometry?;
|
|
156
|
+
private arrowColorExplicit;
|
|
157
|
+
private disposed;
|
|
158
|
+
constructor(options: CesiumGroundPolylineOptions);
|
|
159
|
+
/**
|
|
160
|
+
* 构造或重建箭头 mesh。在 `options.arrowMode` 不是 NONE 时调用。
|
|
161
|
+
* 调用前需确保旧的 arrowMesh / Geometry / Material 已 dispose。
|
|
162
|
+
*
|
|
163
|
+
* @param userData 线几何 userData,含端点标架。
|
|
164
|
+
*/
|
|
165
|
+
private buildArrowMesh;
|
|
166
|
+
/**
|
|
167
|
+
* 拆掉当前 arrowMesh + geometry + material。`setArrowMode` 切端 → 重建 /
|
|
168
|
+
* dispose() 总清理 都用这条路径。
|
|
169
|
+
*/
|
|
170
|
+
private disposeArrowMesh;
|
|
171
|
+
/** 把图元挂到场景:`scene.add(primitive.group)`。 */
|
|
172
|
+
get group(): Group;
|
|
173
|
+
/** 每帧调用:刷新相机相关 uniform + 全局地形深度纹理。 */
|
|
174
|
+
update(frameState: CesiumGroundFrameState): void;
|
|
175
|
+
/**
|
|
176
|
+
* 改线色。
|
|
177
|
+
*
|
|
178
|
+
* @param strokeColor '#rrggbb' 或 css 颜色。
|
|
179
|
+
* @param strokeOpacity 0..100 百分比(与其它图元一致)。
|
|
180
|
+
*/
|
|
181
|
+
setColor(strokeColor: string, strokeOpacity?: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* 改线宽。screen 模式传像素,world 模式传米。**只改当前模式对应的那一个
|
|
184
|
+
* uniform**——切换模式请用 `applyWidthState`,否则 `this.options.widthMode`
|
|
185
|
+
* 跟实际意图不一致时会写错 uniform。
|
|
186
|
+
*
|
|
187
|
+
* @param width 像素或米。
|
|
188
|
+
*/
|
|
189
|
+
setWidth(width: number): void;
|
|
190
|
+
/**
|
|
191
|
+
* 一次性原子地刷新「线宽相关三件」——`u_lineWidthMode` + `u_lineWidthPixels`
|
|
192
|
+
* + `u_lineWidthMeters`,并同步 `this.options.widthMode/Pixels/Meters`。
|
|
193
|
+
*
|
|
194
|
+
* 为什么需要这条 API:单 `setWidth(value)` 用 `this.options.widthMode` 决定
|
|
195
|
+
* 写哪个 uniform。如果调用方在 GUI 上切了 `widthMode` 但没触发 rebuild,
|
|
196
|
+
* `this.options.widthMode` 还是旧值,`setWidth` 会写错 uniform,而且
|
|
197
|
+
* `u_lineWidthMode` 也没人更新 → 线的宽度模式跟显示对不上、且来回切
|
|
198
|
+
* 不回原状态。这条方法让宿主把 widthMode + 两个宽度值一次刷到位。
|
|
199
|
+
*
|
|
200
|
+
* @param mode 'screen' or 'world'。
|
|
201
|
+
* @param widthPixels 像素宽(即使当前是 world 模式也写入,便于切回)。
|
|
202
|
+
* @param widthMeters 米宽(即使当前是 screen 模式也写入,便于切回)。
|
|
203
|
+
*/
|
|
204
|
+
applyWidthState(mode: 'screen' | 'world', widthPixels: number, widthMeters: number): void;
|
|
205
|
+
/** 改渲染顺序(直接设 mesh.renderOrder,无 stencil 三件套偏移)。 */
|
|
206
|
+
setRenderOrder(order: number): void;
|
|
207
|
+
/** 改可见性。 */
|
|
208
|
+
setVisible(visible: boolean): void;
|
|
209
|
+
/**
|
|
210
|
+
* 切换箭头放置模式。NONE → 拆掉 arrowMesh;其它 → 重建 arrowMesh(端点数
|
|
211
|
+
* 变化需要新的几何)。颜色 / 大小变化不必走这条路径,分别用
|
|
212
|
+
* `setArrowColor` / `setArrowSize`。
|
|
213
|
+
*
|
|
214
|
+
* @param mode 'none' / 'left' / 'right' / 'both'。
|
|
215
|
+
*/
|
|
216
|
+
setArrowMode(mode: CesiumGroundArrowMode): void;
|
|
217
|
+
/**
|
|
218
|
+
* 切换箭头样式(实心三角 / 开口雪佛龙)。要换 material 的 define,所以
|
|
219
|
+
* 必须重建材质——但几何不变。
|
|
220
|
+
*
|
|
221
|
+
* @param style 'solid' / 'open'。
|
|
222
|
+
*/
|
|
223
|
+
setArrowStyle(style: CesiumGroundArrowStyle): void;
|
|
224
|
+
/**
|
|
225
|
+
* 把 `u_lineArrowClip{Start,End}Enabled` 同步成「对应端是否有箭头」的逻辑值。
|
|
226
|
+
* `setArrowMode` 改变端数时必须调一遍——否则线 FS 的 V 形收口会停留在
|
|
227
|
+
* 上一个状态(拔掉箭头还在收口、加上箭头不收口)。
|
|
228
|
+
* 与 style 无关(SOLID / OPEN 共享同一套 V 形几何边界)。
|
|
229
|
+
*/
|
|
230
|
+
private syncLineArrowClipUniforms;
|
|
231
|
+
/**
|
|
232
|
+
* 独立给箭头改色(设过之后 `setColor` 改线色不再波及箭头)。
|
|
233
|
+
*
|
|
234
|
+
* @param color '#rrggbb' / css 颜色。
|
|
235
|
+
* @param opacity 0..100 百分比。缺省沿用线 strokeOpacity。
|
|
236
|
+
*/
|
|
237
|
+
setArrowColor(color: string, opacity?: number): void;
|
|
238
|
+
/**
|
|
239
|
+
* 改箭头尺寸模式('screen' = 屏幕像素恒定,'world' = 世界米恒定)。
|
|
240
|
+
* 与线 widthMode 独立,对应 Cesium `Billboard.sizeInMeters` 语义。
|
|
241
|
+
*
|
|
242
|
+
* @param mode 'screen' or 'world'。
|
|
243
|
+
*/
|
|
244
|
+
setArrowWidthMode(mode: 'screen' | 'world'): void;
|
|
245
|
+
/**
|
|
246
|
+
* 改箭头屏幕像素尺寸(沿线长 + 基底全宽)。world 模式用 `setArrowSizeMeters`。
|
|
247
|
+
*
|
|
248
|
+
* @param lengthPixels 沿线长(屏幕像素)。
|
|
249
|
+
* @param widthPixels 基底全宽(屏幕像素)。
|
|
250
|
+
*/
|
|
251
|
+
setArrowSize(lengthPixels: number, widthPixels: number): void;
|
|
252
|
+
/**
|
|
253
|
+
* 改箭头世界米尺寸(仅在 u_arrowWidthMode=1 时生效)。
|
|
254
|
+
*
|
|
255
|
+
* @param lengthMeters 沿线长(米)。
|
|
256
|
+
* @param widthMeters 基底全宽(米)。
|
|
257
|
+
*/
|
|
258
|
+
setArrowSizeMeters(lengthMeters: number, widthMeters: number): void;
|
|
259
|
+
/** 释放 geometry / material(共享深度纹理由 CesiumGlobeDepth 管理,不动)。 */
|
|
260
|
+
dispose(): void;
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../../../src/lib/ground/primitives.ts"],"names":[],"mappings":"AAeA,OAAO,EAIN,KAAK,EAGL,IAAI,EAOJ,MAAM,O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5E,8DAA8D;IACvD,OAAO,IAAI,IAAI;CAUtB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 计算每个顶点的椭球表面单位法向。
|
|
3
|
+
*
|
|
4
|
+
* 遍历 positions(Float64,长度必须是 3 的倍数),对每点调用
|
|
5
|
+
* `geodeticSurfaceNormal`,把单位法向写入新分配的 Float32Array。
|
|
6
|
+
*
|
|
7
|
+
* 法向 Float32 精度充裕(单位向量 |n|=1,Float32 有 ~7 位十进制精度)。
|
|
8
|
+
*
|
|
9
|
+
* @param positions ECEF 顶点数组(Float64,长度 = 3 × vertexCount)。
|
|
10
|
+
* @returns 单位法向数组(Float32,长度同 positions)。
|
|
11
|
+
* @throws 某个顶点位于椭球中心(geodeticSurfaceNormal 返回 undefined)。
|
|
12
|
+
*/
|
|
13
|
+
export declare function computeCapNormals(positions: Float64Array): Float32Array;
|
|
14
|
+
/**
|
|
15
|
+
* 根据顶点数选择索引 TypedArray:
|
|
16
|
+
* - vertexCount ≤ 65535 → Uint16Array(WebGL 1 默认支持)
|
|
17
|
+
* - vertexCount > 65535 → Uint32Array(需 WebGL 2 或 ANGLE_instanced_arrays 等)
|
|
18
|
+
*
|
|
19
|
+
* Three BufferGeometry 在 setIndex 时自动检测 TypedArray 类型并选择对应
|
|
20
|
+
* GL 调用,两种返回值都能消费。
|
|
21
|
+
*
|
|
22
|
+
* Cesium 对应:IndexDatatype.js#createTypedArray
|
|
23
|
+
*
|
|
24
|
+
* @param vertexCount 顶点总数(决定索引值上限)。
|
|
25
|
+
* @param indexCount 索引数组长度(顶点 ID 个数)。
|
|
26
|
+
* @returns Uint16Array 或 Uint32Array,长度 = indexCount。
|
|
27
|
+
*/
|
|
28
|
+
export declare function createIndexTypedArray(vertexCount: number, indexCount: number): Uint16Array | Uint32Array;
|
|
29
|
+
//# sourceMappingURL=rectangle-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-attributes.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/rectangle/rectangle-attributes.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAE,SAAS,EAAE,YAAY,GAAI,YAAY,CAmBzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACpC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GAChB,WAAW,GAAG,WAAW,CAK3B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
import type { RectangleRadians } from './rectangle-radians';
|
|
3
|
+
/**
|
|
4
|
+
* `constructRectangleCap` 的完整输出。
|
|
5
|
+
*
|
|
6
|
+
* 字段意义见 `RectangleCapResult` 注释。所有数组都是新分配的,caller
|
|
7
|
+
* 拥有全部所有权(下游 extruded 路径会原地修改 positions / normals)。
|
|
8
|
+
*/
|
|
9
|
+
export interface RectangleCapResult {
|
|
10
|
+
/**
|
|
11
|
+
* 顶点位置,ECEF 米,Float64。
|
|
12
|
+
* 长度 = 3 × vertexCount;vertexCount = width · rowHeight + capExtras。
|
|
13
|
+
*/
|
|
14
|
+
positions: Float64Array;
|
|
15
|
+
/**
|
|
16
|
+
* 每顶点单位法向,Float32(单位向量精度充裕)。
|
|
17
|
+
* 长度 = positions.length。
|
|
18
|
+
*/
|
|
19
|
+
normals: Float32Array;
|
|
20
|
+
/**
|
|
21
|
+
* 顶面三角形索引(从地表上方俯视为 CCW)。
|
|
22
|
+
* vertexCount ≤ 65535 → Uint16Array;否则 Uint32Array。
|
|
23
|
+
*/
|
|
24
|
+
indices: Uint16Array | Uint32Array;
|
|
25
|
+
/** 网格列数(经度方向顶点数) */
|
|
26
|
+
width: number;
|
|
27
|
+
/** 网格行数(纬度方向顶点数,包含 cap 用) */
|
|
28
|
+
height: number;
|
|
29
|
+
/** 是否覆盖北极(north === π/2) */
|
|
30
|
+
northCap: boolean;
|
|
31
|
+
/** 是否覆盖南极(south === -π/2) */
|
|
32
|
+
southCap: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 构造矩形顶面 cap 网格。
|
|
36
|
+
*
|
|
37
|
+
* 算法 6 步:
|
|
38
|
+
* 1. computeRectangleGridOptions → width / height / nwCorner / capFlags
|
|
39
|
+
* 2. 计算 size = width · height + cap 修正,确定 rowStart / rowEnd / rowHeight
|
|
40
|
+
* 3. 主循环采样 ECEF 顶点(行主序)
|
|
41
|
+
* 4. (可选) cap 单点采样(north/south 极点单点表示)
|
|
42
|
+
* 5. 计算每顶点法向
|
|
43
|
+
* 6. 构造索引(主网格双三角化 + cap 扇形)
|
|
44
|
+
*
|
|
45
|
+
* Cesium 对应:RectangleGeometry.js:220-429
|
|
46
|
+
*
|
|
47
|
+
* @param rect 矩形(弧度)。
|
|
48
|
+
* @param granularity 网格精度(弧度)。
|
|
49
|
+
* @param radiiSquared 椭球半轴平方,用于 grid 采样的 gamma 投影法。
|
|
50
|
+
* @returns 完整 cap 结果。
|
|
51
|
+
*/
|
|
52
|
+
export declare function constructRectangleCap(rect: RectangleRadians, granularity: number, radiiSquared: Vector3): RectangleCapResult;
|
|
53
|
+
//# sourceMappingURL=rectangle-construct-cap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-construct-cap.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/rectangle/rectangle-construct-cap.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAUhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,SAAS,EAAE,YAAY,CAAC;IAExB;;;OAGG;IACH,OAAO,EAAE,YAAY,CAAC;IAEtB;;;OAGG;IACH,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IAEnC,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IAEf,4BAA4B;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAElB,6BAA6B;IAC7B,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,OAAO,GACnB,kBAAkB,CAqKpB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
import type { RectangleRadians } from './rectangle-radians';
|
|
3
|
+
/**
|
|
4
|
+
* `constructExtrudedRectangleShadowVolume` 的完整输出。
|
|
5
|
+
*
|
|
6
|
+
* 三个数组互相一致:
|
|
7
|
+
* - positions / extrudeDirection 同长度,顶点对应。
|
|
8
|
+
* - indices 已合并 top + bottom + wall,墙索引已加上 topBottomVertexCount 偏移。
|
|
9
|
+
* - indices 末尾可能被 subarray 截断(因为墙角点重复检测会跳过 4 个 quad)。
|
|
10
|
+
*/
|
|
11
|
+
export interface RectangleShadowVolumeResult {
|
|
12
|
+
/** 全部顶点 ECEF 位置(top + bottom + walls),Float64,长度 = 3 × totalVertexCount */
|
|
13
|
+
positions: Float64Array;
|
|
14
|
+
/** 每顶点 extrudeDirection(top 半 = 0,bottom 半 = -normal),Float32,长度同 positions */
|
|
15
|
+
extrudeDirection: Float32Array;
|
|
16
|
+
/** 合并索引(top + bottom + wall),墙索引已偏移 topBottomVertexCount */
|
|
17
|
+
indices: Uint16Array | Uint32Array;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 构造矩形挤出 shadow volume prism。
|
|
21
|
+
*
|
|
22
|
+
* 完整 8 步算法(见文件头职责说明)。所有循环边界、winding 反向、
|
|
23
|
+
* EPSILON10 容差判定都与 Cesium 字节级一致。
|
|
24
|
+
*
|
|
25
|
+
* Cesium 对应:RectangleGeometry.js:457-908
|
|
26
|
+
*
|
|
27
|
+
* @param rect 矩形(弧度)。
|
|
28
|
+
* @param granularity 网格精度(弧度)。
|
|
29
|
+
* @param minimumHeight shadow volume 底面高度(米;可负)。
|
|
30
|
+
* @param maximumHeight shadow volume 顶面高度(米;> minimumHeight)。
|
|
31
|
+
* @param radiiSquared 椭球半轴平方(供 cap grid 采样用)。
|
|
32
|
+
* @returns ECEF positions / extrudeDirection / 合并索引。
|
|
33
|
+
*/
|
|
34
|
+
export declare function constructExtrudedRectangleShadowVolume(rect: RectangleRadians, granularity: number, minimumHeight: number, maximumHeight: number, radiiSquared: Vector3): RectangleShadowVolumeResult;
|
|
35
|
+
//# sourceMappingURL=rectangle-construct-extruded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-construct-extruded.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/rectangle/rectangle-construct-extruded.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAWhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC3C,2EAA2E;IAC3E,SAAS,EAAE,YAAY,CAAC;IAExB,+EAA+E;IAC/E,gBAAgB,EAAE,YAAY,CAAC;IAE/B,4DAA4D;IAC5D,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;CACnC;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sCAAsC,CACrD,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,OAAO,GACnB,2BAA2B,CAuT7B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BufferGeometry } from 'three';
|
|
2
|
+
import type { RectangleRadians } from './rectangle-radians';
|
|
3
|
+
/**
|
|
4
|
+
* 构造贴在椭球面上的矩形 debug 网格(线框可视化)。
|
|
5
|
+
*
|
|
6
|
+
* Classification 渲染路径使用 RTE 编码的 shadow volume 几何,Three 自带
|
|
7
|
+
* Mesh 材质无法直接渲染。此 helper 产出一个普通 POSITION-only 网格,
|
|
8
|
+
* 在同一个 ECEF 世界坐标系下贴在椭球面上,便于:
|
|
9
|
+
* - 验证矩形地理位置是否正确
|
|
10
|
+
* - 与 classification 输出对比 debug
|
|
11
|
+
*
|
|
12
|
+
* 网格分辨率默认 96×64(列 × 行),足够覆盖珠峰尺度矩形的曲面。
|
|
13
|
+
*
|
|
14
|
+
* @param rectangle 矩形(弧度,west < east, south < north)。
|
|
15
|
+
* @param height 网格点高度,米(在椭球面以上)。
|
|
16
|
+
* @param longitudeSegments 经度方向段数(顶点数 = segments + 1)。
|
|
17
|
+
* @param latitudeSegments 纬度方向段数。
|
|
18
|
+
* @returns Three BufferGeometry,含 `position` attribute(Float32, 3)
|
|
19
|
+
* + index(Uint32);computeBoundingSphere 已计算。
|
|
20
|
+
*/
|
|
21
|
+
export declare function createDebugRectangleSurfaceGeometry(rectangle: RectangleRadians, height: number, longitudeSegments?: number, latitudeSegments?: number): BufferGeometry;
|
|
22
|
+
//# sourceMappingURL=rectangle-debug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-debug.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/rectangle/rectangle-debug.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmB,cAAc,EAAW,MAAM,OAAO,CAAC;AAIjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mCAAmC,CAClD,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,iBAAiB,SAAK,EACtB,gBAAgB,SAAK,GACnB,cAAc,CAsDhB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PlanarExtents } from '../types';
|
|
2
|
+
import { type RectangleRadians } from './rectangle-radians';
|
|
3
|
+
/**
|
|
4
|
+
* 计算矩形 ShadowVolume PlanarExtents uniform。
|
|
5
|
+
*
|
|
6
|
+
* 完整 7 步算法:
|
|
7
|
+
* 1. fill 矩形中心 cartographic(height = 0)→ ECEF
|
|
8
|
+
* 2. 在 center 处构造 ENU → ECEF 矩阵
|
|
9
|
+
* 3. invert 得到 ECEF → ENU 矩阵
|
|
10
|
+
* 4. render 矩形 8 角点采样到 ENU 平面,取包围盒
|
|
11
|
+
* 5. fill 矩形同样采样
|
|
12
|
+
* 6. SW 角点 ENU → ECEF;再计算 eastward / northward(从 SW 出发的单位 ENU 向量
|
|
13
|
+
* 在 ECEF 中的对应)
|
|
14
|
+
* 7. innerMetersRect = clamp(fillBounds 相对 renderBounds 的 SW 偏移),
|
|
15
|
+
* 并 RTE 编码 SW
|
|
16
|
+
*
|
|
17
|
+
* 输出对应 GLSL uniform:
|
|
18
|
+
* - u_southWest_HIGH/LOW:SW ECEF 的 RTE 高 / 低分量
|
|
19
|
+
* - u_eastward:SW 朝东 1 米的 ECEF 位移(模约 1)
|
|
20
|
+
* - u_northward:SW 朝北 1 米的 ECEF 位移(模约 1)
|
|
21
|
+
* - u_uvMinAndExtents:矩形固定 (0, 0, 1, 1)
|
|
22
|
+
* - u_uMaxVmax:矩形固定 (0, 1, 1, 0)
|
|
23
|
+
* - u_innerMetersRect:fill 区在 render 区中的米偏移(xMin, yMin, xMax, yMax)
|
|
24
|
+
*
|
|
25
|
+
* 当前位置:迁移自 geometry.ts:649-719 的 computePlanarExtents 矩形分支。
|
|
26
|
+
* 逻辑零改动,只是把 Cesium 数学依赖切换到 math/*。
|
|
27
|
+
*
|
|
28
|
+
* @param renderRect 渲染矩形(已外扩 border 的几何用矩形)。
|
|
29
|
+
* @param fillRect 实心矩形(border fragment 用)。
|
|
30
|
+
* @returns PlanarExtents 完整 uniform 集。
|
|
31
|
+
*/
|
|
32
|
+
export declare function computeRectanglePlanarExtents(renderRect: RectangleRadians, fillRect: RectangleRadians): PlanarExtents;
|
|
33
|
+
//# sourceMappingURL=rectangle-extents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle-extents.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ground/rectangle/rectangle-extents.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAuF7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,6BAA6B,CAC5C,UAAU,EAAE,gBAAgB,EAC5B,QAAQ,EAAE,gBAAgB,GACxB,aAAa,CAmFf"}
|