rm-build-dxf 0.1.186

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.
Files changed (195) hide show
  1. package/README.md +6 -0
  2. package/package.json +50 -0
  3. package/src/App.vue.d.ts +2 -0
  4. package/src/DomEventRegister.js +1 -0
  5. package/src/api/getSocket.d.ts +1 -0
  6. package/src/api/index.d.ts +27 -0
  7. package/src/api/type.d.ts +46 -0
  8. package/src/build.js +1 -0
  9. package/src/components/DragContainer.vue.d.ts +48 -0
  10. package/src/components/NumberEditor.vue.d.ts +33 -0
  11. package/src/constants.d.ts +11 -0
  12. package/src/demo.d.ts +1 -0
  13. package/src/dxf-system/DxfSystem.d.ts +26 -0
  14. package/src/dxf-system/build.d.ts +94 -0
  15. package/src/dxf-system/components/CorrectionDxf.d.ts +44 -0
  16. package/src/dxf-system/components/Dxf.d.ts +96 -0
  17. package/src/dxf-system/components/ThreeVJia.d.ts +33 -0
  18. package/src/dxf-system/components/Variable.d.ts +41 -0
  19. package/src/dxf-system/index.d.ts +2 -0
  20. package/src/dxf-system/plugins/editor/Command/ClippingLine.d.ts +30 -0
  21. package/src/dxf-system/plugins/editor/Command/Command.d.ts +346 -0
  22. package/src/dxf-system/plugins/editor/Command/DefaultCommand.d.ts +56 -0
  23. package/src/dxf-system/plugins/editor/Command/DeleteSelectLine.d.ts +25 -0
  24. package/src/dxf-system/plugins/editor/Command/DrawBalconyRailing.d.ts +12 -0
  25. package/src/dxf-system/plugins/editor/Command/DrawBeam.d.ts +12 -0
  26. package/src/dxf-system/plugins/editor/Command/DrawDoorLine.d.ts +9 -0
  27. package/src/dxf-system/plugins/editor/Command/DrawHole.d.ts +67 -0
  28. package/src/dxf-system/plugins/editor/Command/DrawLine.d.ts +41 -0
  29. package/src/dxf-system/plugins/editor/Command/DrawPillar.d.ts +12 -0
  30. package/src/dxf-system/plugins/editor/Command/DrawWindow.d.ts +12 -0
  31. package/src/dxf-system/plugins/editor/Command/ManualDistance.d.ts +23 -0
  32. package/src/dxf-system/plugins/editor/Command/MergeLine.d.ts +33 -0
  33. package/src/dxf-system/plugins/editor/Command/PointDrag/index.d.ts +38 -0
  34. package/src/dxf-system/plugins/editor/Command/PointDrag/modifyDoor.d.ts +40 -0
  35. package/src/dxf-system/plugins/editor/Command/PointDrag/modifyLine.d.ts +34 -0
  36. package/src/dxf-system/plugins/editor/Command/PointDrag/modifyWindow.d.ts +25 -0
  37. package/src/dxf-system/plugins/editor/Command/PropertiesPanel.d.ts +33 -0
  38. package/src/dxf-system/plugins/editor/Command/RayDistance.d.ts +23 -0
  39. package/src/dxf-system/plugins/editor/Command/SelectAll.d.ts +30 -0
  40. package/src/dxf-system/plugins/editor/Command/TwoLineConnectionLine.d.ts +33 -0
  41. package/src/dxf-system/plugins/editor/Command/TwoPointConnection.d.ts +33 -0
  42. package/src/dxf-system/plugins/editor/Command/VerticalCorr.d.ts +66 -0
  43. package/src/dxf-system/plugins/editor/Command/VerticalCorrContinue.d.ts +35 -0
  44. package/src/dxf-system/plugins/editor/Command/ViewAngle.d.ts +21 -0
  45. package/src/dxf-system/plugins/editor/Editor.d.ts +56 -0
  46. package/src/dxf-system/plugins/editor/RenderManager.d.ts +101 -0
  47. package/src/dxf-system/plugins/editor/index.d.ts +9 -0
  48. package/src/dxf-system/plugins/editor/pages/EditorTool/EditorTool.vue.d.ts +7 -0
  49. package/src/dxf-system/plugins/editor/pages/EditorTool/EditorToolContent.vue.d.ts +7 -0
  50. package/src/dxf-system/plugins/editor/pages/PropertiesPanel.vue.d.ts +18 -0
  51. package/src/dxf-system/plugins/editor/pages/components/Button.vue.d.ts +17 -0
  52. package/src/dxf-system/plugins/editor/pages/components/Input.vue.d.ts +13 -0
  53. package/src/dxf-system/plugins/editor/pages/components/ToolToggle.vue.d.ts +20 -0
  54. package/src/dxf-system/plugins/editor/type.d.ts +11 -0
  55. package/src/dxf-system/plugins/editor/us-service/DragControlPoint.d.ts +48 -0
  56. package/src/dxf-system/plugins/editor/us-service/LineSelector.d.ts +44 -0
  57. package/src/dxf-system/plugins/editor/us-service/PointerFollowMove.d.ts +86 -0
  58. package/src/dxf-system/plugins/editor/us-service/SnapController.d.ts +32 -0
  59. package/src/dxf-system/plugins/editor/utils/Wall2D.d.ts +10 -0
  60. package/src/dxf-system/plugins/model3d/components/DxfLineModel.d.ts +14 -0
  61. package/src/dxf-system/plugins/model3d/components/WhiteModel.d.ts +61 -0
  62. package/src/dxf-system/plugins/model3d/components/index.d.ts +2 -0
  63. package/src/dxf-system/plugins/model3d/index.d.ts +11 -0
  64. package/src/dxf-system/plugins/renderer/components/DomContainer.d.ts +13 -0
  65. package/src/dxf-system/plugins/renderer/components/DomEventRegister.d.ts +116 -0
  66. package/src/dxf-system/plugins/renderer/components/EventInput.d.ts +74 -0
  67. package/src/dxf-system/plugins/renderer/components/ModelDataRender.d.ts +13 -0
  68. package/src/dxf-system/plugins/renderer/components/Renderer.d.ts +100 -0
  69. package/src/dxf-system/plugins/renderer/components/index.d.ts +5 -0
  70. package/src/dxf-system/plugins/renderer/index.d.ts +13 -0
  71. package/src/dxf-system/type.d.ts +218 -0
  72. package/src/dxf-system/utils/BayWindowHelper.d.ts +58 -0
  73. package/src/dxf-system/utils/BoundExt.d.ts +51 -0
  74. package/src/dxf-system/utils/DoorFind.d.ts +44 -0
  75. package/src/dxf-system/utils/DoubleWallFinder.d.ts +24 -0
  76. package/src/dxf-system/utils/HeightQuery.d.ts +12 -0
  77. package/src/dxf-system/utils/LineGroupType.d.ts +125 -0
  78. package/src/dxf-system/utils/LoadModel.d.ts +7 -0
  79. package/src/dxf-system/utils/RunJianPipeline.d.ts +92 -0
  80. package/src/dxf-system/utils/SceneAutoGenerat.d.ts +42 -0
  81. package/src/dxf-system/utils/ThreeVJiaPipeline.d.ts +154 -0
  82. package/src/dxf-system/utils/WallGroupManager.d.ts +27 -0
  83. package/src/dxf-system/utils/WallHole.d.ts +134 -0
  84. package/src/dxf-system/utils/WallHoleDrawData.d.ts +31 -0
  85. package/src/dxf-system/utils/ZHouseMockData.d.ts +127 -0
  86. package/src/dxf-system/utils/cad/DxfDataPlugin.d.ts +20 -0
  87. package/src/dxf-system/utils/cad/DxfDrawPlugin.d.ts +13 -0
  88. package/src/dxf-system/utils/cad/draw-data.d.ts +43 -0
  89. package/src/dxf-system/utils/cad/draw-dxf-image.d.ts +2 -0
  90. package/src/dxf-system/utils/cad/draw-dxf-string.d.ts +3 -0
  91. package/src/dxf-system/utils/cad/index.d.ts +143 -0
  92. package/src/dxf-system/utils/clipping-double-wall.d.ts +7 -0
  93. package/src/dxf-system/utils/draw-helper.d.ts +6 -0
  94. package/src/dxf-system/utils/find-discrete.d.ts +26 -0
  95. package/src/dxf-system/utils/find-rooms.d.ts +16 -0
  96. package/src/dxf-system/utils/get-win-draw-data.d.ts +18 -0
  97. package/src/dxf-system/utils/index.d.ts +8 -0
  98. package/src/dxf-system/utils/line-pipeline/builtin/axis-align-corr.d.ts +16 -0
  99. package/src/dxf-system/utils/line-pipeline/builtin/beam-support-line.d.ts +3 -0
  100. package/src/dxf-system/utils/line-pipeline/builtin/bound-ext.d.ts +8 -0
  101. package/src/dxf-system/utils/line-pipeline/builtin/build-group/bay-window.d.ts +7 -0
  102. package/src/dxf-system/utils/line-pipeline/builtin/build-group/double-wall.d.ts +6 -0
  103. package/src/dxf-system/utils/line-pipeline/builtin/build-group/index.d.ts +7 -0
  104. package/src/dxf-system/utils/line-pipeline/builtin/door-space-handle.d.ts +5 -0
  105. package/src/dxf-system/utils/line-pipeline/builtin/door-to-hole.d.ts +9 -0
  106. package/src/dxf-system/utils/line-pipeline/builtin/double-wall-alignment.d.ts +7 -0
  107. package/src/dxf-system/utils/line-pipeline/builtin/index.d.ts +39 -0
  108. package/src/dxf-system/utils/line-pipeline/builtin/init.d.ts +8 -0
  109. package/src/dxf-system/utils/line-pipeline/builtin/remove-room-sundries.d.ts +3 -0
  110. package/src/dxf-system/utils/line-pipeline/builtin/remove-short-double-wall.d.ts +6 -0
  111. package/src/dxf-system/utils/line-pipeline/builtin/wall-height-handle.d.ts +8 -0
  112. package/src/dxf-system/utils/line-pipeline/index.d.ts +22 -0
  113. package/src/dxf-system/utils/remove-dangline.d.ts +7 -0
  114. package/src/dxf-system/utils/tools.d.ts +91 -0
  115. package/src/index.css +1 -0
  116. package/src/index.js +1 -0
  117. package/src/index2.js +1 -0
  118. package/src/index3.js +1 -0
  119. package/src/main.d.ts +0 -0
  120. package/src/pages/CubeView.vue.d.ts +4 -0
  121. package/src/pages/DxfPreview.vue.d.ts +9 -0
  122. package/src/pages/Editor.vue.d.ts +8 -0
  123. package/src/pages/ExportGLB.vue.d.ts +2 -0
  124. package/src/pages/ImagePreview.vue.d.ts +9 -0
  125. package/src/pages/ModelView.vue.d.ts +11 -0
  126. package/src/pages/Setting.vue.d.ts +6 -0
  127. package/src/pages/Todo.vue.d.ts +2 -0
  128. package/src/pages/WallView.vue.d.ts +9 -0
  129. package/src/pages/WindowManager.vue.d.ts +2 -0
  130. package/src/pages/buildJson.vue.d.ts +4 -0
  131. package/src/pages/modelCarrier/index.vue.d.ts +4 -0
  132. package/src/router/index.d.ts +2 -0
  133. package/src/utils/EventDispatcher.d.ts +18 -0
  134. package/src/utils/algorithms/AlignToParallelSegments.d.ts +25 -0
  135. package/src/utils/algorithms/AxisAlignCorr.d.ts +38 -0
  136. package/src/utils/algorithms/Box2.d.ts +96 -0
  137. package/src/utils/algorithms/CheckPointCloudContinuity.d.ts +63 -0
  138. package/src/utils/algorithms/ConstraintSystem.d.ts +17 -0
  139. package/src/utils/algorithms/ConvexHullGraham.d.ts +16 -0
  140. package/src/utils/algorithms/Debouncing.d.ts +10 -0
  141. package/src/utils/algorithms/LineIndexGenerator.d.ts +12 -0
  142. package/src/utils/algorithms/LineQueryer.d.ts +42 -0
  143. package/src/utils/algorithms/LineSegment.d.ts +258 -0
  144. package/src/utils/algorithms/LineSegmentSpatialHash.d.ts +86 -0
  145. package/src/utils/algorithms/LineSegmentUtils.d.ts +185 -0
  146. package/src/utils/algorithms/Map.d.ts +38 -0
  147. package/src/utils/algorithms/MaxiCircles.d.ts +15 -0
  148. package/src/utils/algorithms/MiniCircles.d.ts +57 -0
  149. package/src/utils/algorithms/OBB.d.ts +30 -0
  150. package/src/utils/algorithms/PCSparseOctree.d.ts +56 -0
  151. package/src/utils/algorithms/Pipeline.d.ts +20 -0
  152. package/src/utils/algorithms/Point.d.ts +271 -0
  153. package/src/utils/algorithms/PointSpatialHash.d.ts +149 -0
  154. package/src/utils/algorithms/PointUtils.d.ts +47 -0
  155. package/src/utils/algorithms/Polygon.d.ts +164 -0
  156. package/src/utils/algorithms/PolygonUtils.d.ts +9 -0
  157. package/src/utils/algorithms/Quadtree.d.ts +89 -0
  158. package/src/utils/algorithms/Rectangle.d.ts +62 -0
  159. package/src/utils/algorithms/UndirectedGraph.d.ts +124 -0
  160. package/src/utils/algorithms/UnionFindSet.d.ts +12 -0
  161. package/src/utils/algorithms/ccw.d.ts +2 -0
  162. package/src/utils/algorithms/lazy.d.ts +14 -0
  163. package/src/utils/algorithms/precision.d.ts +3 -0
  164. package/src/utils/algorithms/stepElimination.d.ts +6 -0
  165. package/src/utils/algorithms/uuid.d.ts +1 -0
  166. package/src/utils/command/CommandFlow.d.ts +45 -0
  167. package/src/utils/command/CommandSystem.d.ts +96 -0
  168. package/src/utils/command/index.d.ts +2 -0
  169. package/src/utils/decorators/measure-time.d.ts +5 -0
  170. package/src/utils/ecs/Component.d.ts +18 -0
  171. package/src/utils/ecs/Container.d.ts +47 -0
  172. package/src/utils/ecs/index.d.ts +4 -0
  173. package/src/utils/geometry-manager/GeometryManager.d.ts +2 -0
  174. package/src/utils/index.d.ts +25 -0
  175. package/src/utils/modelScenario/bayWindow.d.ts +35 -0
  176. package/src/utils/modelScenario/scenario.d.ts +92 -0
  177. package/src/utils/three-object-3d/ExtrudeMesh.d.ts +11 -0
  178. package/src/utils/three-object-3d/LineAlignmentGuide.d.ts +20 -0
  179. package/src/utils/three-object-3d/Lines.d.ts +25 -0
  180. package/src/utils/three-object-3d/Lines2.d.ts +22 -0
  181. package/src/utils/three-object-3d/Shape2D.d.ts +61 -0
  182. package/src/utils/tools/GCHandle.d.ts +12 -0
  183. package/src/utils/tools/Gltf.d.ts +7 -0
  184. package/src/utils/tools/SnapLine.d.ts +19 -0
  185. package/src/utils/tools/StorageHelper.d.ts +8 -0
  186. package/src/utils/tools/clone-user-data.d.ts +7 -0
  187. package/src/utils/tools/create-html.d.ts +9 -0
  188. package/src/utils/tools/create-promise.d.ts +5 -0
  189. package/src/utils/tools/createVueApp.d.ts +1 -0
  190. package/src/utils/tools/download.d.ts +1 -0
  191. package/src/utils/tools/get-json.d.ts +5 -0
  192. package/src/utils/tools/include.d.ts +1 -0
  193. package/src/utils/tools/is-mobile.d.ts +2 -0
  194. package/src/utils/tools/repetitive-task.d.ts +1 -0
  195. package/src/utils/tools/selectLocal-file.d.ts +7 -0
@@ -0,0 +1,258 @@
1
+ import { Point, PointType } from './Point';
2
+ import { Rectangle } from './Rectangle';
3
+ /**
4
+ * 非轴对称线段
5
+ */
6
+ export declare class LineSegment<T = Record<string, any>> {
7
+ static get LINE_SYMBOL(): symbol;
8
+ points: Point[];
9
+ userData: T;
10
+ currentData: Record<string | number | symbol, any>;
11
+ uuid: string;
12
+ private _length;
13
+ /**
14
+ * 线段长度
15
+ * @returns
16
+ */
17
+ get length(): number;
18
+ get start(): Point<Record<string, any>>;
19
+ get end(): Point<Record<string, any>>;
20
+ _center: Point | null;
21
+ get center(): Point<Record<string, any>>;
22
+ _direction: null | Point;
23
+ constructor(p1?: PointType, p2?: PointType);
24
+ private _startVersion;
25
+ private _endVersion;
26
+ private _update;
27
+ set(p1: PointType, p2: PointType): this;
28
+ setLength(len: number): this;
29
+ /** 获取另一个点
30
+ * @param point
31
+ * @returns
32
+ */
33
+ getAnotherPoint(point: Point): Point<Record<string, any>>;
34
+ /**
35
+ * 沿线段方向偏移起点。
36
+ *
37
+ * width > 0 时,起点向终点方向移动;
38
+ * width < 0 时,起点向终点反方向移动。
39
+ */
40
+ offsetStart(width: number): this;
41
+ /**
42
+ * 沿线段方向偏移起点。
43
+ *
44
+ * width > 0 时,结束点向终点方向移动;
45
+ * width < 0 时,结束点向终点反方向移动。
46
+ */
47
+ offsetEnd(width: number): this;
48
+ /**
49
+ * 是否有相同端点
50
+ * @param line
51
+ * @returns
52
+ */
53
+ isSameEndpoint(line: LineSegment, eps?: number): boolean;
54
+ /**
55
+ * 相同端点是否为开始
56
+ * @param line
57
+ * @returns
58
+ */
59
+ isSameEndpointAsStart(line: LineSegment, eps?: number): boolean;
60
+ /**
61
+ * 相同端点是否为结束
62
+ * @param line
63
+ * @returns
64
+ */
65
+ isSameEndpointAsEnd(line: LineSegment, eps?: number): boolean;
66
+ /**
67
+ * 获取共线点
68
+ * @param line
69
+ * @returns
70
+ */
71
+ getSameEndpoint(line: LineSegment, eps?: number): Point<Record<string, any>>[] | null;
72
+ /**
73
+ * 判断一个点是否在当前线段上(包含端点)
74
+ * @param point 要判断的点
75
+ * @returns 如果点在当前线段上则返回 true,否则返回 false
76
+ */
77
+ isPointOnSegment(point: Point): boolean;
78
+ /** 膨胀
79
+ * @description 向线段的两个端点分别膨胀 width
80
+ * @param width
81
+ */
82
+ extendAlongDirection(width: number, direction?: "start" | "end" | "all"): this;
83
+ /** 向指定方向移动
84
+ * @param dist
85
+ * @param direction
86
+ * @returns
87
+ */
88
+ translate(dist: number, direction?: Point<Record<string, any>>): this;
89
+ /** 旋转
90
+ * @param angle 弧度
91
+ */
92
+ rotate(angle: number, center?: Point<Record<string, any>>): this;
93
+ /** 镜像线段
94
+ */
95
+ mirror(): void;
96
+ /** 交换两个端点
97
+ */
98
+ swap(): void;
99
+ /** 交换两个端点值
100
+ */
101
+ swapValue(): void;
102
+ /** 获取点在线段上的叉积
103
+ * @param point
104
+ * @returns
105
+ */
106
+ cross(point: Point): number;
107
+ /**
108
+ * 获取方向
109
+ * @returns
110
+ */
111
+ direction(out?: Point<Record<string, any>>): Point<Record<string, any>>;
112
+ /**
113
+ * 获取发向量-左法线
114
+ */
115
+ normal(): Point<Record<string, any>>;
116
+ /**
117
+ * @param line
118
+ * @param t
119
+ * @returns
120
+ */
121
+ pointAt(t: number, out?: Point<Record<string, any>>): Point<Record<string, any>>;
122
+ /** 膨胀为矩形
123
+ * @param width
124
+ * @param cap butt: 不延长, square: 延长
125
+ * @returns
126
+ */
127
+ toRectangle(width?: number, cap?: "butt" | "square", out?: Rectangle): Rectangle;
128
+ /** 获取点在当前线段的左边还是右边,或者线段上
129
+ * @param point
130
+ */
131
+ getPointSideOfLine(point: Point): "on" | "left" | "right";
132
+ /** 获取向右的方向
133
+ * @returns
134
+ */
135
+ getRightDirection(): Point<Record<string, any>>;
136
+ /** 获取向左的方向
137
+ * @returns
138
+ */
139
+ getLeftDirection(): Point<Record<string, any>>;
140
+ /** 获取点距离线段的长度(直线距离)
141
+ * @param point
142
+ */
143
+ distanceToPoint(point: Point): number;
144
+ /** 获取点距离线段的长度平方(直线距离)
145
+ * @param point
146
+ */
147
+ distanceSquaredToPoint(point: Point): number;
148
+ /** line 获取两条线段之间的最短距离
149
+ * @param
150
+ */
151
+ distanceToSegment(line: LineSegment): number;
152
+ /**
153
+ * 两条线段或角度是否平行,忽略方向
154
+ * @param line
155
+ */
156
+ isParallelTo(line: LineSegment, eps?: number): boolean;
157
+ /** 两条线段或角度是否 垂直, 忽略方向
158
+ * @param line
159
+ * @param errAngle
160
+ * @returns
161
+ */
162
+ isPerpendicularTo(line: LineSegment, eps?: number): boolean;
163
+ /**
164
+ * @param line
165
+ * @param eps
166
+ * @returns
167
+ */
168
+ isCollinearOverlap(line: LineSegment, eps?: number): boolean;
169
+ /**
170
+ * 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
171
+ * @param line 要投影的线段
172
+ * @returns 投影并裁剪后的线段
173
+ */
174
+ projectLineSegment(line: LineSegment, out?: LineSegment<Record<string, any>>): LineSegment;
175
+ /**
176
+ * 计算一条线段在另一条直线上的投影
177
+ * @param p1 要投影的点
178
+ * @param clip 是否裁剪超出目标线段的部分,默认裁剪
179
+ * @returns 投影并裁剪后的线段
180
+ */
181
+ projectPoint(p1: Point, clip?: boolean): Point | null;
182
+ /** 获取点的投影值
183
+ */
184
+ projectPointValue(point: {
185
+ x: number;
186
+ y: number;
187
+ }, eps?: number): number;
188
+ /** 获取两条线段夹角
189
+ * @deprecated 已废弃, 请使用 angle
190
+ * @param line
191
+ */
192
+ includedAngle(line: LineSegment): number;
193
+ /** 获取两条线段夹角
194
+ * @param line
195
+ */
196
+ angle(line: LineSegment, opt?: {
197
+ unit?: "radian" | "degree" | "cos";
198
+ range?: "180" | "360";
199
+ }): number;
200
+ /**
201
+ * 判断两条线段,是否在同一直线上:
202
+ * - 返回 -1:不在同一直线(不共线)
203
+ * - 返回 0:共线但没有重合部分
204
+ * - 返回 1:共线且有重合(端点或区间重叠)
205
+ */
206
+ sameLine(line: LineSegment): number;
207
+ private crossProduct;
208
+ private isPointInSegmentBounds;
209
+ /**
210
+ * 判断线段是否与另一条线段相交(包含共用端点或部分重合的情况)
211
+ * @param line
212
+ * @param endpoint 是否包含端点相交
213
+ * @returns
214
+ */
215
+ intersectLineSegment(line: LineSegment, endpoint?: boolean): boolean;
216
+ /**
217
+ * 判断一个点是否在线段上(含端点)
218
+ * @param pt 要判断的点
219
+ * @returns 如果点在当前线段上返回 true,否则返回 false
220
+ */
221
+ containsPoint(pt: Point): boolean;
222
+ /**
223
+ * 获取交点
224
+ * @param line
225
+ * @returns
226
+ */
227
+ getIntersection(line: LineSegment): Point | null;
228
+ /**
229
+ * 两条线段方向是否一致
230
+ * @param line
231
+ */
232
+ directionEqual(line: LineSegment, errAngle?: number): boolean;
233
+ /** 克隆
234
+ * @returns
235
+ */
236
+ clone(userData?: boolean, cloneUUid?: boolean): LineSegment<T>;
237
+ /** 复制
238
+ * @param line
239
+ */
240
+ copy(line: {
241
+ start: {
242
+ x: number;
243
+ y: number;
244
+ };
245
+ end: {
246
+ x: number;
247
+ y: number;
248
+ };
249
+ }): this;
250
+ /** 获取点属于的线段
251
+ * @param point
252
+ * @returns
253
+ */
254
+ static getSegmentFromPoint(point: Point): LineSegment | null;
255
+ static axisY(width: number, out?: LineSegment<Record<string, any>>): LineSegment<Record<string, any>>;
256
+ static axisX(width: number, out?: LineSegment<Record<string, any>>): LineSegment<Record<string, any>>;
257
+ static angleToYAxis(line: LineSegment): number;
258
+ }
@@ -0,0 +1,86 @@
1
+ import { Box2 } from './Box2';
2
+ import { LineSegment } from './LineSegment';
3
+ import { Point } from './Point';
4
+ import { Rectangle } from './Rectangle';
5
+ export interface RaycastHit {
6
+ line: LineSegment;
7
+ point: Point;
8
+ distance: number;
9
+ t: number;
10
+ }
11
+ /**
12
+ * 线段空间哈希
13
+ */
14
+ export declare class LineSegmentSpatialHash {
15
+ cellSize: number;
16
+ /** cell => lines */
17
+ private buckets;
18
+ /** line => cellKeys */
19
+ private lineCells;
20
+ /**
21
+ * @param cellSize 网格大小
22
+ */
23
+ constructor(cellSize?: number);
24
+ /**
25
+ * 插入线段
26
+ */
27
+ insert(line: LineSegment): this;
28
+ /**
29
+ * 批量插入
30
+ */
31
+ insertLines(lines: LineSegment[]): this;
32
+ /**
33
+ * 删除线段
34
+ */
35
+ remove(line: LineSegment): this;
36
+ /**
37
+ * 更新线段
38
+ */
39
+ update(line: LineSegment): this;
40
+ /**
41
+ * 清空
42
+ */
43
+ clear(): this;
44
+ private visited;
45
+ /**
46
+ * 查询点附近线段
47
+ * @param point
48
+ * @param radius
49
+ */
50
+ queryPoint(point: Point, radius?: number, out?: LineSegment[]): LineSegment<Record<string, any>>[];
51
+ /**
52
+ * 范围查询
53
+ */
54
+ queryBounds(bounds: Box2, out?: LineSegment[]): LineSegment<Record<string, any>>[];
55
+ /**
56
+ * 查询可能相交线段
57
+ * @description 仅 broad phase
58
+ */
59
+ queryPotentialLine(line: LineSegment, out?: LineSegment[]): LineSegment<Record<string, any>>[];
60
+ /**
61
+ * 查询相交线段
62
+ */
63
+ queryLine(line: LineSegment, out?: LineSegment[]): LineSegment<Record<string, any>>[];
64
+ private rectangleBounds;
65
+ /** 通过矩形查询 */
66
+ queryRectangle(rectangle: Rectangle, out?: LineSegment[]): LineSegment<Record<string, any>>[];
67
+ private rayIntersectSegment;
68
+ /**
69
+ * 射线检测
70
+ * @param origin 起点
71
+ * @param direction 方向(必须归一化)
72
+ * @param maxDistance 最大距离
73
+ */
74
+ raycast(origin: Point, direction: Point, maxDistance?: number, out?: RaycastHit): RaycastHit | null;
75
+ private tempKeys;
76
+ /**
77
+ * 获取线段覆盖的所有 cell key
78
+ */
79
+ private getLineCellKeys;
80
+ /**
81
+ * 坐标转 cell
82
+ */
83
+ private toCell;
84
+ private getKey;
85
+ static from(lines: LineSegment[], cellSize?: number): LineSegmentSpatialHash;
86
+ }
@@ -0,0 +1,185 @@
1
+ import { LineSegment } from './LineSegment';
2
+ import { Point } from './Point';
3
+ import { Rectangle } from './Rectangle';
4
+ export declare class LineSegmentUtils {
5
+ static clone(lines: LineSegment[]): LineSegment<Record<string, any>>[];
6
+ /**保留小数位数
7
+ * @param points
8
+ */
9
+ static precision(lines: LineSegment[], count: number): LineSegment<Record<string, any>>[];
10
+ /** 线段合法性检测 */
11
+ static legitimacy(line: LineSegment): boolean;
12
+ /**保留四位小数位数
13
+ * @param points
14
+ */
15
+ static precision4(lines: LineSegment[]): LineSegment<Record<string, any>>[];
16
+ /** 获取最长线段索引
17
+ * @param lines
18
+ */
19
+ static maxLengthLineIndex(lines: LineSegment[], excludeCallBack?: (line: LineSegment) => boolean): number;
20
+ /** 获取线段组的中心
21
+ * @param lines
22
+ */
23
+ static getLinesCenter(lines: LineSegment[]): Point<Record<string, any>>;
24
+ /** 合并分组和处理
25
+ * @param groups
26
+ * @returns
27
+ */
28
+ static GroupBuilder<T = any, K extends PropertyKey = string>(groups: Partial<Record<K, LineSegment<T>[]>>): {
29
+ handle(k: K, fn: (lines: LineSegment<T>[], groups: Partial<Record<K, LineSegment<T>[]>>) => LineSegment<T>[]): /*elided*/ any;
30
+ merge(): LineSegment<T>[];
31
+ };
32
+ /** 自定义分组
33
+ * @param lines
34
+ * @returns
35
+ */
36
+ static group<T = any, K extends PropertyKey = string>(lines: LineSegment<T>[], fn: (line: LineSegment<T>) => K): Partial<Record<K, LineSegment<T>[]>>;
37
+ /** 通过在同一路径上且平行的线段分组
38
+ * @param lines
39
+ */
40
+ static groupByPathAndParallel(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
41
+ /** 通过线段中心点在目标线段的左边还是右边,或者线段上 分组
42
+ * @param lines
43
+ * @param line
44
+ * @returns
45
+ */
46
+ static groupByCenterPointSide(lines: LineSegment[], line: LineSegment): LineSegment<Record<string, any>>[][];
47
+ /** 通过连通路径,给线段分组
48
+ * @param lines
49
+ * @returns
50
+ */
51
+ static groupByPath(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
52
+ /** 通过共享点分组
53
+ * @param lines
54
+ * @returns
55
+ */
56
+ static groupBySharedPoints(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
57
+ /** 通过最大叶子路径,给线段分组,每条路径没有分叉
58
+ * @param lines
59
+ * @returns
60
+ */
61
+ static groupByLeafPath(lines: LineSegment[]): LineSegment<Record<string, any>>[][];
62
+ /** 通过与轴是否平行对线段进行分组
63
+ * @param lines
64
+ * @param axisLine
65
+ * @param errAngle
66
+ * @returns
67
+ */
68
+ static groupByParallelToAxis(lines: LineSegment[], axisLine: LineSegment, errAngle?: number): LineSegment<Record<string, any>>[][];
69
+ /** 通过平行轴和垂直轴投影重合分组
70
+ * @param verticalLines
71
+ * @param parallelAxis 平行轴
72
+ * @param verticalAxis 垂直轴
73
+ * @param esp 垂直投影值分组距离
74
+ * @param gap 平行轴投影区间间隙
75
+ */
76
+ static groupByProjectedOverlap(lines: LineSegment[], parallelAxis: LineSegment, verticalAxis: LineSegment, esp?: number, gap?: number, onGroup?: (group: LineSegment[], verticalProjValues: number[], verticalAxis: LineSegment, parallelProjValues: [number, number][], parallelAxis: LineSegment) => void): LineSegment<Record<string, any>>[][];
77
+ /** 合并线段到最长线段
78
+ * @param lines
79
+ * @returns
80
+ */
81
+ static mergeLinesByMaxlength(...lines: LineSegment[]): LineSegment<Record<string, any>>;
82
+ /** 传入的线段全部投影为一条线段
83
+ * @param lines 请确保共线
84
+ * @returns
85
+ */
86
+ static mergeCollinearSegments(lines: LineSegment[]): LineSegment<Record<string, any>>;
87
+ /** 合并满足平行的线段
88
+ * @param selectLines
89
+ */
90
+ static mergeParallelSegments(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void): {
91
+ lines: LineSegment<Record<string, any>>[];
92
+ newLines: LineSegment<Record<string, any>>[];
93
+ deleteLines: LineSegment<Record<string, any>>[];
94
+ };
95
+ /** 合并本属于同一条的线段,且不能被其他线段分割
96
+ * @param lines
97
+ * @param callBack
98
+ * @returns
99
+ */
100
+ static mergeCollinearSegmentsAll(lines: LineSegment[], callBack?: (newLine: LineSegment, group: LineSegment[]) => void, removeLines?: Set<LineSegment<Record<string, any>>>, newLines?: LineSegment[]): LineSegment<Record<string, any>>[];
101
+ /** 去重
102
+ * @param lines
103
+ * @returns
104
+ */
105
+ static deduplicate(lines: LineSegment[], precision?: number): LineSegment<Record<string, any>>[];
106
+ /** 通过点裁剪线段
107
+ * @param line
108
+ * @param points
109
+ * @returns
110
+ */
111
+ static clippingByPoints(line: LineSegment, points: Point[], callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[];
112
+ /** 通过线段组裁剪线段
113
+ * @param target
114
+ * @param clippingLines
115
+ * @param callBack
116
+ * @returns
117
+ */
118
+ static clippingByLines(target: LineSegment, clippingLines: LineSegment[], callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[] | undefined;
119
+ /** 通过线段裁剪线段
120
+ * @param target
121
+ * @param clippingLine
122
+ */
123
+ static clippingByLine(target: LineSegment, clippingLine: LineSegment, callBack?: (newLine: LineSegment, line: LineSegment) => void): LineSegment<Record<string, any>>[] | undefined;
124
+ /**
125
+ * @param line
126
+ * @param base
127
+ * @returns
128
+ */
129
+ static constrainLine(line: LineSegment, base: LineSegment): LineSegment<Record<string, any>>;
130
+ /** 通过线段提取所有点
131
+ * @param lines
132
+ * @returns
133
+ */
134
+ static flatPoints(lines: LineSegment[] | LineSegment): any[];
135
+ /** 裁剪
136
+ * @param lines
137
+ * @param opt
138
+ * @returns
139
+ */
140
+ static splitIntersections<T>(lines: LineSegment[], opt?: {
141
+ onSplit?: (target: LineSegment<T>, newLines: LineSegment<T>[]) => void;
142
+ obstacle?: LineSegment[];
143
+ }): LineSegment<T>[];
144
+ /** 对线段组统计,找到主导方向线
145
+ * @param lineSegments
146
+ * @returns
147
+ */
148
+ static findDominantDirectionLine(lineSegments: LineSegment[], bin?: number): LineSegment<Record<string, any>>;
149
+ /** 创建线段修改管理器
150
+ * @returns
151
+ */
152
+ static createModifyManager(): {
153
+ readonly setPoint: (line: LineSegment, point: Point, value: Point) => void;
154
+ readonly modify: () => void;
155
+ clear(): void;
156
+ };
157
+ /** 转为虚线
158
+ * @param line
159
+ * @param pattern
160
+ */
161
+ static dash(line: LineSegment, pattern: number[]): LineSegment<Record<string, any>>[];
162
+ /** 线段最佳吸附参考线查找
163
+ * @param opt
164
+ */
165
+ static findBestReferenceSegment<TLines extends readonly LineSegment[], TReferenceLines extends readonly LineSegment[]>(opt: {
166
+ lines: TLines;
167
+ linesScope: {
168
+ [K in keyof TLines]: Rectangle;
169
+ };
170
+ referenceLines: TReferenceLines;
171
+ referenceLinesScope: {
172
+ [K in keyof TReferenceLines]: Rectangle;
173
+ };
174
+ }): (LineSegment<Record<string, any>> | null)[];
175
+ /** 在线段上根据数量采样
176
+ * @param line
177
+ * @returns
178
+ */
179
+ static sampleSegment(line: LineSegment, count: number): Point<Record<string, any>>[];
180
+ /** 在线段上根据数量采样
181
+ * @param line
182
+ * @returns
183
+ */
184
+ static sampleSegmentBydistance(line: LineSegment, dist?: number): Point<Record<string, any>>[];
185
+ }
@@ -0,0 +1,38 @@
1
+ export declare class MapEnhance<K, V> extends Map<K, V> {
2
+ get valueArray(): V[];
3
+ map<T = any>(callbackfn: (v: V, k: K) => T): T[];
4
+ filter(callbackfn: (v: V, k: K) => boolean): V[];
5
+ filterKey(callbackfn: (v: V, k: K) => boolean): K[];
6
+ reduce<T>(callbackfn: (pre: T, v: V, k: K) => T, result: T): T;
7
+ some(callbackfn: (v: V, k: K) => boolean): boolean;
8
+ every(callbackfn: (v: V, k: K) => boolean): boolean;
9
+ find(callbackfn: (v: V, k: K) => boolean): V | undefined;
10
+ findKey(callbackfn: (v: V, k: K) => boolean): K | undefined;
11
+ someKeys(keys: K[]): boolean;
12
+ everyKeys(keys: K[]): boolean;
13
+ group(callbackfn: (v: V, k: K) => string): ArrayMap<string, V>;
14
+ toObject(): Record<string, V>;
15
+ first(): V | undefined;
16
+ firstKey(): K | undefined;
17
+ last(): V | undefined;
18
+ sortBy<T>(callback: (v: V, k: K) => T): [K, V][];
19
+ pluck<U>(keyPath: string): U[];
20
+ }
21
+ export declare class ArrayMap<K, V> extends MapEnhance<K, V[]> {
22
+ maxLength: number;
23
+ append(k: K, ...arr: V[]): this;
24
+ setLength(key: K, len: number): void;
25
+ remove(k: K, ...arr: V[]): this;
26
+ getOrCreate(key: K): V[];
27
+ }
28
+ export declare class SetMap<K, V> extends MapEnhance<K, Set<V>> {
29
+ append(k: K, ...arr: V[]): this;
30
+ hasValue(key: K, value: V): boolean;
31
+ }
32
+ export declare class CounterMap<K> extends MapEnhance<K, number> {
33
+ set(key: K, step?: number): this;
34
+ increment(key: K, step?: number): this;
35
+ getByCount(count: number): K[];
36
+ getMaxKey(): K | undefined;
37
+ getminKey(): K | undefined;
38
+ }
@@ -0,0 +1,15 @@
1
+ import { LineSegment } from './LineSegment';
2
+ import { MiniCircles } from './MiniCircles';
3
+ export declare class MaxiCircles extends MiniCircles {
4
+ #private;
5
+ static get instance(): MaxiCircles;
6
+ mergeCircles(circles: LineSegment[][], internalEdges?: LineSegment[]): {
7
+ internalEdges: LineSegment<Record<string, any>>[];
8
+ circles: LineSegment<Record<string, any>>[][];
9
+ };
10
+ maxiCircles(lines: LineSegment[], findMinCirclesFilter?: (circles: LineSegment[][]) => LineSegment<Record<string, any>>[][]): {
11
+ newLines: LineSegment<Record<string, any>>[];
12
+ circles: LineSegment<Record<string, any>>[][];
13
+ internalEdges: LineSegment<Record<string, any>>[];
14
+ };
15
+ }
@@ -0,0 +1,57 @@
1
+ import { LineSegment } from './LineSegment';
2
+ import { LineSegmentUndirectedGraph } from './UndirectedGraph';
3
+ import { Point } from './Point';
4
+ import { ArrayMap } from './Map';
5
+ import { PointSpatialHash } from './PointSpatialHash';
6
+ export declare enum Side {
7
+ ALL = 0,
8
+ OUT = 1,
9
+ IN = 2
10
+ }
11
+ export interface MiniCirclesOption {
12
+ side?: Side;
13
+ circleEdges?: LineSegment[];
14
+ }
15
+ export declare class MiniCircles {
16
+ debug: {
17
+ angle: boolean;
18
+ edges: boolean;
19
+ };
20
+ scope: number;
21
+ /** 通过并查集,查找为环的一部分边
22
+ * @description
23
+ * @param lines
24
+ */
25
+ findCycleEntryEdges(lineUG_: LineSegment[] | LineSegmentUndirectedGraph): LineSegment<Record<string, any>>[];
26
+ /** 环去重
27
+ * @param rings
28
+ */
29
+ deduplicate(rings: LineSegment[][]): LineSegment<Record<string, any>>[][];
30
+ /** 环的侧面测试,是内侧环,还是外侧环
31
+ * @param circles
32
+ * @param side
33
+ * @returns
34
+ */
35
+ sideTest(circles: LineSegment[][], side?: Side): LineSegment<Record<string, any>>[][];
36
+ /** 同侧路径查找
37
+ * @param opt
38
+ * @returns
39
+ */
40
+ findSameSidePath(opt: {
41
+ A: Point;
42
+ B: Point;
43
+ exitPoint?: Point;
44
+ grid: PointSpatialHash<LineSegment> | LineSegment[];
45
+ path?: Set<LineSegment>;
46
+ }): LineSegment<Record<string, any>>[] | undefined;
47
+ /** 通过方向点查找环
48
+ * @description 通过 findCircleOneEdge 查找 到ringEdges,然后在一条条的找,类似迷宫算法的左右手原则
49
+ * @param lines
50
+ * @param ringEdges
51
+ */
52
+ miniCircle(lines: LineSegment[], option?: MiniCirclesOption): {
53
+ circles: LineSegment<Record<string, any>>[][];
54
+ setMap: ArrayMap<LineSegment<Record<string, any>>, Set<LineSegment<Record<string, any>>>>;
55
+ circleEdges: LineSegment<Record<string, any>>[];
56
+ };
57
+ }
@@ -0,0 +1,30 @@
1
+ import { OBB as OBB_ } from 'three/addons/math/OBB.js';
2
+ import * as THREE from 'three';
3
+ export declare class OBB extends OBB_ {
4
+ getBoxMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
5
+ getBoxEdge(color?: number): THREE.LineSegments<THREE.EdgesGeometry<THREE.BoxGeometry>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
6
+ toJson(): {
7
+ size: THREE.Vector3Tuple;
8
+ center: THREE.Vector3Tuple;
9
+ quaternion: THREE.QuaternionTuple;
10
+ };
11
+ /**
12
+ * @param box
13
+ * @param position
14
+ * @param rotation
15
+ * @param out
16
+ * @returns
17
+ */
18
+ static from(box: THREE.Vector3, position: THREE.Vector3, rotation: THREE.Euler | THREE.Quaternion, out?: OBB): OBB;
19
+ /** 通过2d路径创建
20
+ * @param path
21
+ * @param origin
22
+ * @param height
23
+ * @param out
24
+ * @returns
25
+ */
26
+ static fromByPath2D(path: {
27
+ x: number;
28
+ y: number;
29
+ }[], origin: THREE.Vector3, height: number, out?: OBB): OBB;
30
+ }