@xort/cga 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xort/cga",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Computational geometry algorithms for JavaScript and TypeScript",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.ts",
@@ -18,13 +18,18 @@
18
18
  "format:check": "node scripts/format.mjs",
19
19
  "prepublishOnly": "npm run release:check -- --complete && npm run verify",
20
20
  "release:check": "node scripts/release-check.mjs",
21
- "verify": "npm run release:check && npm run source:check && npm run typecheck && npm run docs:typecheck && npm run format:check && npm test && npm run demos:check && npm run docs:build && npm run build:demo && npm run browser:check && npm audit && npm pack --dry-run && npm run package:check",
21
+ "verify": "npm run release:check && npm run source:check && npm run algorithms:check && npm run typecheck && npm run docs:typecheck && npm run format:check && npm test && npm run readme:check && npm run demos:check && npm run api:check && npm run media:check && npm run docs:build && npm run build:demo && npm run browser:check && npm audit && npm pack --dry-run && npm run package:check",
22
22
  "source:check": "node scripts/source-check.mjs",
23
23
  "browser:check": "node scripts/browser-check.mjs",
24
24
  "package:check": "node scripts/package-check.mjs",
25
25
  "docs:typecheck": "vue-tsc --noEmit -p docs/tsconfig.json",
26
26
  "demos:check": "node scripts/demo-coverage.mjs",
27
- "docs:deploy": "node scripts/deploy-docs.mjs"
27
+ "docs:deploy": "node scripts/deploy-docs.mjs",
28
+ "docs:screenshots": "npm run docs:build && node scripts/capture-demos.mjs && npm run docs:build",
29
+ "media:check": "node scripts/media-check.mjs",
30
+ "api:check": "node scripts/api-methods.mjs",
31
+ "readme:check": "node scripts/readme-check.mjs",
32
+ "algorithms:check": "node scripts/algorithm-check.mjs"
28
33
  },
29
34
  "private": false,
30
35
  "repository": {
@@ -45,10 +50,6 @@
45
50
  "gis"
46
51
  ],
47
52
  "license": "MIT",
48
- "dependencies": {
49
- "decimal.js": "^10.6.0",
50
- "geographiclib-geodesic": "2.2.0"
51
- },
52
53
  "devDependencies": {
53
54
  "@types/node": "26.6.11",
54
55
  "@types/three": "0.187.0",
package/readme.md CHANGED
@@ -1,117 +1,239 @@
1
1
  # cga.js
2
2
 
3
- JavaScript / TypeScript 计算几何库:统一几何查询、最近点与参数、平面和实体布尔、剖分、点云、路径、网格、GIS 和逆运动学。核心计算可在 Node.js 和浏览器运行,不要求 DOM、Three.js 或 WebGL。
3
+ **JavaScript / TypeScript 计算几何库。** 用统一数据结构计算距离、最近点、相交、多边形布尔、剖分、点云和路径网格,并提供高精度 CSG、IK、GIS 与可选 Three.js / GLSL 适配。
4
4
 
5
- [文档](https://yszhao91.github.io/cga.js/) · [API](docs/guide/api.md) · [模块指南](docs/guide/experimental.md) · [0.1.2 迁移](docs/guide/migration-0.1.2.md) · [缺口验收](docs/guide/gaps.md) · [贡献](CONTRIBUTING.md)
5
+ [![npm](https://img.shields.io/npm/v/%40xort%2Fcga)](https://www.npmjs.com/package/@xort/cga) [![CI](https://github.com/yszhao91/cga.js/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/yszhao91/cga.js/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
6
+
7
+ [快速开始](#安装与快速开始) · [在线演示](https://yszhao91.github.io/cga.js/guide/playground.html) · [真实图册](https://yszhao91.github.io/cga.js/guide/gallery.html) · [API](https://yszhao91.github.io/cga.js/guide/api.html) · [复审与路线图](docs/guide/review-0.1.3.md) · [贡献](CONTRIBUTING.md)
6
8
 
7
9
  <!-- release-status:start -->
8
- 本轮发行版本为 **0.1.2**:升级工具链,移除 Earcut / 旧 Clipper,使用自有 TypeScript 内核,并修复线上文档部署。npm latest 与线上部署的实际回执以版本状态页为准。进度见[缺口清单](docs/guide/gaps.md)与[版本状态](docs/release-status.md)。
10
+ 本轮发行版本 **0.1.3**:全部计算算法使用内部 TypeScript、核心零运行时依赖;丰富 README、真实截图和演示;修复方端盖、微小尺度剖分与非法轮廓校验。npm latest、发布标签和线上部署的实际状态见[发布记录](https://yszhao91.github.io/cga.js/release-status.html)。版本按发布递增,提交和授权重试不重复升版。
9
11
  <!-- release-status:end -->
10
12
 
11
- ## 可操作算法示例
13
+ ## 看看实际效果
14
+
15
+ 图片由当前项目在真实浏览器中计算并截取。点击可操作对应场景;图册还保留带控件、图例和计算结果的完整截图。
16
+
17
+ | 几何距离与最近点 | 凹多边形和多个孔洞 |
18
+ | --- | --- |
19
+ | [![胶囊体与三角形距离](https://yszhao91.github.io/cga.js/images/demos/geometry-distance.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#geometry-distance?a=Capsule&b=Triangle&ax=0.5&ay=3&az=1) | [![凹轮廓与多孔三角剖分](https://yszhao91.github.io/cga.js/images/demos/triangulation-multiple-holes.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#triangulation-multiple-holes) |
20
+ | **带孔截面与路径扫掠** | **高精度实体布尔** |
21
+ | [![带孔闭合路径扫掠](https://yszhao91.github.io/cga.js/images/demos/extrude-holes-closed.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#extrude-holes-closed?width=0.65) | [![高精度 CSG 差集](https://yszhao91.github.io/cga.js/images/demos/csg-subtract.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#csg-subtract?x=0.5) |
22
+ | **带约束的逆运动学** | **GIS 球面瓦片** |
23
+ | [![铰链约束 IK](https://yszhao91.github.io/cga.js/images/demos/ik-hinge.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#ik-hinge?x=1.5&y=2) | [![GIS 球面瓦片网格](https://yszhao91.github.io/cga.js/images/demos/gis-globe.jpg)](https://yszhao91.github.io/cga.js/guide/playground.html#gis-globe?level=2) |
12
24
 
13
- [进入示例库](https://yszhao91.github.io/cga.js/guide/playground.html) · [完整覆盖清单](docs/guide/demo-coverage.md) · [自有内核说明](docs/guide/polygon-kernels.md) · [升级记录](docs/guide/upgrades-0.1.2.md)
25
+ **94 个可操作案例 · 184 个公开入口映射 · 15 类几何体的 225 种有序组合。** 这些数字描述案例和入口覆盖,公有方法的逐项演示另见[方法级清单](docs/guide/method-coverage.md),数值正确性由解析、随机和退化测试验证。
14
26
 
15
- 88 个案例覆盖几何查询、平面布尔、带孔剖分、点云、曲线、网格、空间树、高精度 CSG、IK、GIS 和 GLSL。展示代码与实际执行代码相同;参数修改、画面像素变化和全部 225 个几何组合均纳入浏览器回归。覆盖统计按公开入口和算法族计数,类型、常量及全部重载不单独计数。
27
+ [查看全部 14 组真实预览](https://yszhao91.github.io/cga.js/guide/gallery.html) · [带参数的案例目录](docs/guide/demo-coverage.md) · [截图复现方法](#开发与验证)
16
28
 
17
- ## 安装与使用
29
+ ## 安装与快速开始
18
30
 
19
31
  ```sh
20
32
  npm install @xort/cga
21
33
  ```
22
34
 
23
- ```ts
24
- import { v3, Segment, Circle, distance, intersects } from '@xort/cga';
35
+ ### 距离、最近点和参数
36
+
37
+ ```js
38
+ // example:distance
39
+ import { v3, segment, distance, intersects } from '@xort/cga';
25
40
 
26
41
  const point = v3(1, 2, 0);
27
- const segment = new Segment(v3(), v3(4, 0, 0));
28
- const result = distance(point, segment);
29
- console.log(result.distance); // 2
30
- console.log(result.closests); // [(1,2,0), (1,0,0)]
31
- console.log(result.parameters); // [0, 0.25]
32
- point.queryDistance(segment); // 各几何体共有的方法,与 distance 返回相同结构
33
-
34
- const arc = new Circle(v3(), 1, 0, Math.PI / 2, v3(0, 0, 1));
35
- console.log(distance(arc, v3(-1, 0, 0)).distance); // √2,受圆弧范围限制
36
- console.log(intersects(segment, arc)); // true
42
+ const edge = segment(v3(0, 0, 0), v3(4, 0, 0));
43
+ const result = distance(point, edge);
44
+
45
+ console.log(result.distance); // 2
46
+ console.log(result.distanceSqr); // 4
47
+ console.log(result.closests.map(p => p.toArray())); // [[1, 2, 0], [1, 0, 0]]
48
+ console.log(result.parameters); // [0, 0.25]
49
+ console.log(intersects(point, edge)); // false
50
+ console.log(point.queryDistance(edge).distance); // 2
51
+ ```
52
+
53
+ `distance(a, b)`、`a.queryDistance(b)` 返回相同结果契约。`Vec3.distanceTo(otherPoint)` 则返回点间距离数字。
54
+
55
+ ### CommonJS
56
+
57
+ ```js
58
+ // example:commonjs
59
+ const { v3, segment, distance } = require('@xort/cga');
60
+ const result = distance(v3(1, 2, 0), segment(v3(), v3(4, 0, 0)));
61
+ console.log(result.distance); // 2
37
62
  ```
38
63
 
39
- CommonJS 使用 `const { v3, distance } = require('@xort/cga')`。浏览器直接引入 `build/@xort_cga.js` 后使用全局 `cga`;原生 ESM 文件为 `build/cga.esm.js`。
64
+ ### 克隆和序列化
40
65
 
41
- ## 统一数据接口
66
+ ```js
67
+ // example:serialization
68
+ import { Triangle, geometryFromJSON, v3 } from '@xort/cga';
42
69
 
43
- `Point / Vec3`、直线、射线、线段、平面、三角形、矩形、圆弧、圆盘、球体、胶囊体、包围盒、折线、多边形和带孔 `Shape` 共享:
70
+ const original = new Triangle(v3(), v3(2, 0, 0), v3(0, 2, 0));
71
+ const clone = original.clone();
72
+ const restored = geometryFromJSON(JSON.parse(JSON.stringify(original)));
73
+ original[0].x = 3;
74
+ console.log(clone[0].x, restored[0].x); // 0, 0:坐标相互独立
75
+ ```
44
76
 
45
- - `kind`、`copy(source)`、`clone()`、`distancePoint(point)`、`queryDistance(other, options?)`、`toJSON()`。
46
- - `distance / distanceSqr / closests / parameters` 是必填字段;最近点和参数始终按操作数 `[a, b]` 排列。
47
- - 构造器与克隆拥有坐标;查询不修改输入。固定顶点几何体支持索引和迭代,顶点数量不可被数组操作改变。
48
- - `geometryFromJSON` 校验并恢复统一数据;`Shape` 的孔洞一起序列化。
77
+ ### 自有 TypeScript 多边形内核
49
78
 
50
- `Vec3.distanceTo` 继续返回点间数值距离;几何查询统一使用 `queryDistance`。`Line(origin, end)` 第二项是另一个点,`Ray(origin, direction)` 第二项是方向。线段参数为 `[0,1]`;平面方程为 `n·p + w = 0`。
79
+ ```js
80
+ // example:polygon
81
+ import { v3, triangulation, clipPolygons } from '@xort/cga';
51
82
 
52
- ## 算法覆盖
83
+ const outer = [v3(-2,-2,0), v3(2,-2,0), v3(2,2,0), v3(-2,2,0)];
84
+ const hole = [v3(-.5,-.5,0), v3(.5,-.5,0), v3(.5,.5,0), v3(-.5,.5,0)];
85
+ const vertices = [...outer, ...hole];
86
+ const indices = triangulation(outer, [hole]);
87
+ console.log(vertices.length, indices.length / 3); // 8 顶点、8 三角形
53
88
 
54
- 上述几何体支持全部两两距离与容差相交判断。球体、胶囊体、包围盒按闭合实体处理;圆圈是圆周/圆弧,圆盘和多边形是填充面。自交多边形应先整理为简单轮廓。
89
+ const contours = clipPolygons([outer], [hole], 'difference', v3(0,0,1));
90
+ console.log(contours.length); // 2:外边界和孔洞,绕序相反
91
+ ```
55
92
 
56
- | 范围 | 入口与行为 |
93
+ 剖分、裁剪、偏移、清理均由本项目维护的 TypeScript 内核实现。输入限制、精度和复杂度见[多边形内核说明](docs/guide/polygon-kernels.md)。
94
+
95
+ ## 算法与示例导航
96
+
97
+ | 范围 | 可操作示例 | 关键能力 |
98
+ | --- | --- | --- |
99
+ | 几何查询 | [距离与求交](https://yszhao91.github.io/cga.js/guide/playground.html#geometry-distance) | 最近点、参数、双向查询、容差相交 |
100
+ | 圆弧与圆盘 | [有向圆弧](https://yszhao91.github.io/cga.js/guide/playground.html#circle-arc) | 弧段范围、端点限制、迭代误差界 |
101
+ | 平面布尔 | [拓扑变化](https://yszhao91.github.io/cga.js/guide/playground.html#polygon-topology) | 交/并/差/异或、多轮廓、孔洞、共边 |
102
+ | 偏移与描边 | [斜线端盖](https://yszhao91.github.io/cga.js/guide/playground.html#offset-open-caps) | 尖/圆/方连接,平/圆/方端盖 |
103
+ | 三角剖分 | [多孔凹轮廓](https://yszhao91.github.io/cga.js/guide/playground.html#triangulation-multiple-holes) | 3D 平面投影、原始顶点索引、多个孔洞 |
104
+ | Delaunay / Voronoi | [三角网](https://yszhao91.github.io/cga.js/guide/playground.html#delaunay-delaunay) · [单元和邻居](https://yszhao91.github.io/cga.js/guide/playground.html#voronoi) | 平面剖分、裁剪单元、站点与邻接 |
105
+ | 点云 | [三维凸包](https://yszhao91.github.io/cga.js/guide/playground.html#hull-degeneracy) · [最近点对](https://yszhao91.github.io/cga.js/guide/playground.html#closest-pair) | 共面/共线退化、三维 hull、最近点对 |
106
+ | 曲线与路径 | [Catmull–Rom](https://yszhao91.github.io/cga.js/guide/playground.html#curve-catmull) · [里程采样](https://yszhao91.github.io/cga.js/guide/playground.html#path-mileage) | 参数化、累计长度、切片与重采样 |
107
+ | 挤压与网格 | [带孔扫掠](https://yszhao91.github.io/cga.js/guide/playground.html#extrude-holes-closed) | 平行移动标架、连接、封口、UV 与法线 |
108
+ | 平面切割 | [体积守恒](https://yszhao91.github.io/cga.js/guide/playground.html#mesh-split-volume) | 分侧网格、属性插值、多轮廓封口 |
109
+ | 空间结构 | [KdTree](https://yszhao91.github.io/cga.js/guide/playground.html#tree-kdtree) · [QuadTree](https://yszhao91.github.io/cga.js/guide/playground.html#tree-quadtree) · [Frustum](https://yszhao91.github.io/cga.js/guide/playground.html#frustum) | 最近邻、范围、空间划分、剔除与裁剪 |
110
+ | 高精度与 CSG | [精度投影](https://yszhao91.github.io/cga.js/guide/playground.html#precision-projection) · [实体差集](https://yszhao91.github.io/cga.js/guide/playground.html#csg-subtract) | Decimal 向量、平面、BSP 并/交/差 |
111
+ | IK | [自由 CCD](https://yszhao91.github.io/cga.js/guide/playground.html#ik-free) · [铰链](https://yszhao91.github.io/cga.js/guide/playground.html#ik-hinge) · [滑块](https://yszhao91.github.io/cga.js/guide/playground.html#ik-slider) | 目标求解、累计限位、收敛与骨长 |
112
+ | GIS | [坐标转换](https://yszhao91.github.io/cga.js/guide/playground.html#gis-coordinates) · [测地线](https://yszhao91.github.io/cga.js/guide/playground.html#gis-geodesic) · [地形](https://yszhao91.github.io/cga.js/guide/playground.html#gis-heightmap) | ECEF/WGS84、瓦片、影像、地形和任务 |
113
+ | 渲染与 GLSL | [查看器](https://yszhao91.github.io/cga.js/guide/playground.html#glview) · [噪声](https://yszhao91.github.io/cga.js/guide/playground.html#shader-classicnoise3d) | 可选 Three.js、材质、噪声和距离场 |
114
+
115
+ ## 统一数据结构与接口
116
+
117
+ 15 类几何体:`Point / Vec3`、`Line`、`Ray`、`Segment`、`Plane`、`Triangle`、`Rectangle`、`Circle`、`Disk`、`Sphere`、`Capsule`、`Box`、`Polyline`、`Polygon`、`Shape`。
118
+
119
+ - 查询共有 `kind`、`copy`、`clone`、`distancePoint`、`queryDistance` 和 `toJSON`;`geometryFromJSON` 校验并恢复数据。
120
+ - 距离结果必含 `distance / distanceSqr / closests / parameters`。最近点和参数始终按 `[a, b]` 排列;迭代圆类查询可报告 `errorBound`。
121
+ - 构造和克隆拥有独立坐标;查询保留输入。固定顶点对象支持索引与迭代,顶点数量固定。
122
+ - 网格统一使用 `IGeometry`:`position:number[]`,可选 `index / normal / uv / uv2 / tangent`。索引相对于该次返回的顶点数组。
123
+ - `Shape` 在外轮廓之外保留孔洞,并统一参与查询、剖分和序列化。
124
+
125
+ ### 使用时需要明确的约定
126
+
127
+ | 项目 | 约定 |
57
128
  | --- | --- |
58
- | 距离与最近点 | `distance / queryDistance / intersects`;线性、退化、平行、共面、圆弧和圆盘组合 |
59
- | 曲线求解 | 线性对象到圆弧的四次多项式候选;弧段自适应界;圆盘凸距离 GJK;迭代结果附 `errorBound` |
60
- | 切割网格 | `Plane.splitGeometry(..., { cap: true })`、`splitPlaneGeometry`;属性插值、多轮廓与孔洞封口 |
61
- | 平面多边形 | 包含、清理、偏移、交/并/差/异或;自有 TypeScript 内核,局部量化精度可配置 |
62
- | 剖分与点云 | 自有带孔耳切剖分、Delaunay/Voronoi、共面凸包、`convexHull3D`、三维最近点对 `O(n log n)` |
63
- | 路径与挤压 | 路径里程/采样/变换刷新、Catmull–Rom、平行移动标架、转角、端盖、孔洞、UV 与法线 |
64
- | 空间结构 | BTree、KdTree、QuadTree、BSP 平面划分、PolyTree 外轮廓/孔洞/岛屿层次 |
65
- | 高精度与实体布尔 | `HVec3`、`Robust.Vec / Plane`、`CSG.BSP` 的并/交/差 |
66
- | 逆运动学 | `IK` 骨链、关节、CCD、铰链角度及滑块位移约束 |
67
- | GIS | `GIS` ECEF/WGS84、椭球正反算、Karney 测地线、瓦片、影像/地形、任务和 Globe 数据层 |
68
- | 渲染适配与着色器 | 可选 `@xort/cga/three` 和 `@xort/cga/shaders`;独立于主包渲染环境 |
69
-
70
- 圆类迭代查询可传 `{ tolerance, maximumIterations }`。达到迭代预算仍无法满足误差要求时抛错;普通数值几何使用浮点运算,不能把容差判断当作精确算术谓词。高精度向量使用 Decimal,字符串输入可保留 JS number 无法表达的有效位数。
71
-
72
- ## 领域模块
73
-
74
- ```ts
129
+ | 直线 | `Line(origin, end)` 的第二项是另一个点 |
130
+ | 射线 | `Ray(origin, direction)` 的第二项是方向 |
131
+ | 线段 | 参数区间为 `[0, 1]` |
132
+ | 平面 | `normal · point + w = 0`;数值有符号距离单独定义 |
133
+ | 圆圈 / 圆盘 | `Circle` 表示圆周或有向圆弧;`Disk` 表示填充面 |
134
+ | 多边形 | 填充面;自交轮廓先整理,剖分孔洞须互不接触 |
135
+ | 单位 | 核心几何使用调用者的模型单位;GIS 经纬度内部为弧度,高度为米 |
136
+ | 资源所有权 | 查看器与效果显式释放;宿主模型的几何和材质由宿主管理 |
137
+
138
+ ## 高精度、IK 与 GIS
139
+
140
+ ```js
141
+ // example:domains
75
142
  import { HVec3, IK, GIS, v3 } from '@xort/cga';
76
143
 
77
- console.log(new HVec3('0.1', '0.2', '0.3').add(new HVec3('0.2', 0, 0)).x.toString()); // 0.3
144
+ const precise = new HVec3('0.1', '0.2', '0.3').add(new HVec3('0.2', 0, 0));
145
+ console.log(precise.x.toString()); // 0.3:用字符串保留十进制输入
78
146
 
79
- const chain = IK.Skeleton.fromPoints([v3(), v3(1,0,0), v3(2,0,0)]);
80
- const solved = new IK.CCDSolver().solve(chain, v3(1,1,0));
147
+ const skeleton = IK.Skeleton.fromPoints([v3(), v3(1,0,0), v3(2,0,0)]);
148
+ const solved = new IK.CCDSolver().solve(skeleton, v3(1,1,0));
81
149
  console.log(solved.converged, solved.distance);
82
150
 
83
- const coordinate = GIS.GVec3.fromDegrees(116.4, 39.9, 50);
84
- console.log(coordinate.toCartographic()); // 弧度、米;ECEF 的 Z 轴朝北
151
+ const ecef = GIS.GVec3.fromDegrees(116.4, 39.9, 50);
152
+ console.log(ecef.toCartographic()); // 经度/纬度为弧度,高度为米
85
153
  ```
86
154
 
155
+ CSG 使用凸多边形面组成的闭合定向实体。GIS 的 `Globe` 提供瓦片和网格数据层,宿主负责渲染;`pick` 查询参考椭球,`getHeight` 读取已加载地形。影像和地形服务通过 fetch / 解码器接入,演示中明确使用本地注入数据。详见[领域模块指南](docs/guide/experimental.md)。
156
+
157
+ ## 浏览器与可选 Three.js
158
+
159
+ 核心计算无需 DOM、Three.js 或 GPU。按需安装渲染依赖:
160
+
87
161
  ```sh
88
162
  npm install three
89
163
  ```
90
164
 
91
- ```ts
92
- import { GLView, BreathLight, ThreeBSP } from '@xort/cga/three';
93
- import { shaders } from '@xort/cga/shaders';
94
- const view = new GLView({ container: document.querySelector('#view')! });
165
+ 在 Vite 等支持包导入的浏览器工程中,先提供有高度的容器:
166
+
167
+ ```html
168
+ <div id="view" style="height:420px;width:100%"></div>
169
+ ```
170
+
171
+ ```js
172
+ // example:browser
173
+ import { GLView, BreathLight } from '@xort/cga/three';
174
+
175
+ const view = new GLView({ container: document.querySelector('#view') });
95
176
  const light = new BreathLight();
96
177
  view.add(light);
97
178
  view.addUpdates(time => light.update(time));
98
179
  view.run();
99
- // 页面卸载时 view.dispose(); light.dispose();
180
+
181
+ // 在组件卸载或页面销毁时调用;自有模型资源也应按所有权释放。
182
+ const dispose = () => { light.dispose(); view.dispose(); };
183
+ window.addEventListener('pagehide', dispose, { once: true });
184
+ ```
185
+
186
+ 另有 `@xort/cga/shaders` 文本入口、`ThreeBSP` 和 `DiamondShader`。不使用打包器时可选择 `build/@xort_cga.js` 的全局 `cga`,或 `build/cga.esm.js` 的 ESM;这两个核心文件不包含 Three.js 查看器。
187
+
188
+ ## 内部算法与依赖边界
189
+
190
+ 几何、剖分、布尔、CSG、IK、GIS 测地线和高精度运算均在仓库内实现为 TypeScript,核心包 **零运行时依赖**。十进制采用内部 BigInt 内核;椭球测地线采用内部 Karney 移植,保留对跖点能力与 MIT 来源声明。开发工具不进入核心发行包,Three.js 是可选的显示适配器,GPU 着色器使用 GLSL。
191
+
192
+ ```js
193
+ // example:decimal
194
+ import { Decimal, HVec3 } from '@xort/cga';
195
+ const previous = { precision: Decimal.precision, rounding: Decimal.rounding };
196
+ try {
197
+ Decimal.set({ precision: 50, rounding: Decimal.ROUND_HALF_EVEN });
198
+ console.log(new Decimal(2).sqrt().toString());
199
+ console.log(new HVec3('0.1').add(new HVec3('0.2')).toJSON());
200
+ } finally { Decimal.set(previous); }
100
201
  ```
101
202
 
102
- GIS 影像与地形可通过 fetch/解码器适配真实服务。Globe 管理几何和瓦片数据,由宿主渲染器消费网格;`pick` 针对参考椭球,`getHeight` 读取已加载地形。详见[模块指南](docs/guide/experimental.md)和[网格指南](docs/guide/meshes.md)。
203
+ 内部 Decimal 提供向量/CSG 所需算术、比较、开方和格式化;不宣称完整兼容 decimal.js 的三角函数、clone 或配置接口。构造时保留输入数字,运算按 1–1000 位有效数字舍入,默认 20 位;非有限值和超范围指数会报错。[实现、来源与迁移](docs/guide/internal-algorithms.md)。
204
+
205
+ ## 能力边界与剩余工作
103
206
 
104
- ## 开发与发布
207
+ - 浮点查询按容差计算,迭代预算耗尽会明确报错;距离为 0 的实体交叠查询不提供通用接触流形或穿透深度。
208
+ - 带孔剖分采用可见桥和耳切法,最坏 O(n³)。多边形布尔的边交点阶段 O(E²),分类还需扫描原始边,适用于中小型轮廓。
209
+ - 平面布尔默认量化步长约为 `1e-6` 模型单位,可调整 `scale`;小于量化精度的特征可能合并。高精度向量不会自动把普通浮点布尔变为精确谓词算法。
210
+ - 圆角和圆端盖使用离散圆弧。对超大轮廓、极端长宽比和近重合边的性能与误差,还需要专门的基准与更强的数值谓词。
211
+ - 入口示例已覆盖,**方法级的独立演示仍需继续补充**,优先矩阵法线/投影、几何变换和缓冲属性;[方法清单](docs/guide/method-coverage.md)明确区分独立示例和共享查询。
212
+ - 约束 Delaunay、BVH、大型数据增量更新、更多曲线/曲面、GIS 瓦片协议扩展属于后续能力,见[复审与路线图](docs/guide/review-0.1.3.md)。
105
213
 
106
- 最低 Node.js 22.12,建议 Node.js 24。先 `npm ci`,浏览器测试环境执行 `npx playwright install chromium`(Windows 也可使用已安装的 Edge)。
214
+ ## 开发与验证
215
+
216
+ 最低 Node.js **22.12**,建议使用 `.nvmrc` 指定的 **Node.js 26**。CI 同时验证 Linux / Windows 和 Node 22 / 24 / 26。
107
217
 
108
218
  ```sh
109
- npm run verify # 版本、全仓源文件、类型、格式、测试、文档、示例、浏览器、依赖及打包
219
+ npm ci
220
+ npx playwright install chromium # Windows 也可使用已安装的 Edge
221
+ npm run docs:dev # 本地文档与演示
222
+ npm run verify # 完整验证
223
+ npm run algorithms:check # 内部 TS、零运行时依赖、算法导入边界
224
+ npm run docs:screenshots # 从真实浏览器重新生成 14 组、28 张截图
225
+ npm run media:check # 截图哈希、尺寸、案例和源代码指纹
226
+ npm run api:check # 方法级示例登记
227
+ npm run readme:check # 执行 README 中的 Node.js 示例
110
228
  npm run release:check -- --complete
111
229
  ```
112
230
 
113
- 每轮发布先规划版本、更新包和相关文档,然后实现、验收,最后提交、推送和发布。末位每次加 1,满 100 向前进位:`0.1.99 → 0.2.0`、`0.99.99 → 1.0.0`。同一轮的修复和授权重试不重复升版。
231
+ 源码目录与模块关系见[架构说明](docs/guide/architecture.md),截图参数和哈希保存在 `.release/screenshots.json`。新增公开入口须增加可操作案例;新功能与边界修复须提供相应的解析或独立参考验证。
232
+
233
+ 每轮发布先规划版本并同步文档,再实现与验收,最后提交、推送、部署和发布 npm。版本末位每次加 1,满 100 进位:`0.1.99 → 0.2.0`、`0.99.99 → 1.0.0`。同一轮提交和授权重试保持相同版本。
234
+
235
+ [0.1.3 迁移](docs/guide/migration-0.1.3.md) · [缺口清单](docs/guide/gaps.md) · [贡献约定](CONTRIBUTING.md) · [发布记录](docs/release-status.md)
114
236
 
115
- 缺口清单全部验收、计划状态为 `ready` 后,提交脚本和发布钩子才放行。[版本规则](docs/guide/releasing.md) · [架构](docs/guide/architecture.md) · [审核记录](docs/guide/audit.md)
237
+ ## 许可证
116
238
 
117
- MIT License;第三方组件和着色器声明见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
239
+ MIT License。第三方组件与着色器声明见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。