build-dxf 0.0.6 → 0.0.8
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 +7 -1
- package/src/index.d.ts +35 -4
- package/src/index.js +432 -12631
- package/src/plugins/ModelDataPlugin/index.d.ts +588 -0
- package/src/plugins/ModelDataPlugin/index.js +1184 -0
- package/src/plugins/RenderPlugin/index.d.ts +588 -0
- package/src/plugins/RenderPlugin/index.js +1184 -0
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "build-dxf",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "线段构建双线墙壁的dxf版本",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
9
|
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"clipper-lib": "^6.4.2",
|
|
12
|
+
"dxf-writer": "^1.18.4",
|
|
13
|
+
"three-bvh-csg": "^0.0.17",
|
|
14
|
+
"three-csg-ts": "^3.2.0"
|
|
15
|
+
},
|
|
10
16
|
"author": "夏过初秋",
|
|
11
17
|
"license": "ISC"
|
|
12
18
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ declare class Box2 {
|
|
|
10
10
|
get height(): number;
|
|
11
11
|
get center(): Point;
|
|
12
12
|
constructor(minX?: number, maxX?: number, minY?: number, maxY?: number);
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param z
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
getPaths3D(z?: number): number[];
|
|
13
19
|
/**
|
|
14
20
|
* 判断线段是与包围盒相交
|
|
15
21
|
* @description Liang-Barsky算法的变种
|
|
@@ -41,6 +47,10 @@ declare class Box2 {
|
|
|
41
47
|
* @param box
|
|
42
48
|
*/
|
|
43
49
|
containsBox(box: Box2): boolean;
|
|
50
|
+
/** 判断点是在包围盒内
|
|
51
|
+
* @param point
|
|
52
|
+
*/
|
|
53
|
+
containsPoint(point: Point): boolean;
|
|
44
54
|
/**
|
|
45
55
|
*
|
|
46
56
|
* @param minX
|
|
@@ -154,6 +164,9 @@ declare class Dxf extends Component<{
|
|
|
154
164
|
pointsGroups: Point[][][];
|
|
155
165
|
wallsGroup: Point[][];
|
|
156
166
|
doors: DataItem[];
|
|
167
|
+
lineSegments: LineSegment<{
|
|
168
|
+
isDoor: boolean;
|
|
169
|
+
}>[];
|
|
157
170
|
originalZAverage: number;
|
|
158
171
|
static EndType: {
|
|
159
172
|
etOpenSquare: number;
|
|
@@ -167,7 +180,9 @@ declare class Dxf extends Component<{
|
|
|
167
180
|
};
|
|
168
181
|
/** 原始数据组
|
|
169
182
|
*/
|
|
170
|
-
get lines():
|
|
183
|
+
get lines(): LineSegment<{
|
|
184
|
+
isDoor: boolean;
|
|
185
|
+
}>[];
|
|
171
186
|
/**初始化
|
|
172
187
|
* @param data 点云数据
|
|
173
188
|
* @param width 墙体宽度
|
|
@@ -241,6 +256,7 @@ export declare class DxfSystem extends ComponentManager {
|
|
|
241
256
|
Dxf: Dxf;
|
|
242
257
|
Variable: Variable;
|
|
243
258
|
wallWidth: number;
|
|
259
|
+
environment: "node" | "browser" | "unknown";
|
|
244
260
|
/** 构造函数
|
|
245
261
|
* @param wallWidth 输出墙壁厚度,该墙壁厚度不受缩放影响
|
|
246
262
|
* @param scale 原始数据缩放比例
|
|
@@ -284,9 +300,12 @@ declare interface EventTypeMap {
|
|
|
284
300
|
/**
|
|
285
301
|
* 非轴对称线段
|
|
286
302
|
*/
|
|
287
|
-
declare class LineSegment {
|
|
303
|
+
declare class LineSegment<T = Record<string, any>> {
|
|
288
304
|
points: Point[];
|
|
305
|
+
userData?: T;
|
|
289
306
|
get center(): Point;
|
|
307
|
+
get start(): Point;
|
|
308
|
+
get end(): Point;
|
|
290
309
|
constructor(p1?: Point, p2?: Point);
|
|
291
310
|
/**
|
|
292
311
|
* 计算线段的长度
|
|
@@ -304,7 +323,7 @@ declare class LineSegment {
|
|
|
304
323
|
* @returns 投影并裁剪后的线段
|
|
305
324
|
*/
|
|
306
325
|
projectLineSegment(line: LineSegment): LineSegment;
|
|
307
|
-
clone(): LineSegment
|
|
326
|
+
clone(): LineSegment<Record<string, any>>;
|
|
308
327
|
}
|
|
309
328
|
|
|
310
329
|
declare interface OriginalDataItem {
|
|
@@ -340,6 +359,7 @@ declare class Point {
|
|
|
340
359
|
* @param y
|
|
341
360
|
*/
|
|
342
361
|
constructor(x?: number, y?: number);
|
|
362
|
+
set(x: number, y: number): this;
|
|
343
363
|
setX(x: number): this;
|
|
344
364
|
setY(y: number): this;
|
|
345
365
|
/**
|
|
@@ -362,6 +382,7 @@ declare class Point {
|
|
|
362
382
|
* @param scalar
|
|
363
383
|
*/
|
|
364
384
|
mutiplyScalar(scalar: number): this;
|
|
385
|
+
multiplyScalar(scalar: number): this;
|
|
365
386
|
/**
|
|
366
387
|
*
|
|
367
388
|
* @param scalar
|
|
@@ -401,7 +422,7 @@ declare class Point {
|
|
|
401
422
|
*/
|
|
402
423
|
normal(point: Point): Point;
|
|
403
424
|
/**
|
|
404
|
-
*
|
|
425
|
+
* 获取由传入的点到该点的单位方向向量
|
|
405
426
|
* @description 计算当前点到指定点的方向向量,并返回单位方向
|
|
406
427
|
* @param point
|
|
407
428
|
* @returns
|
|
@@ -460,6 +481,16 @@ declare class Rectangle {
|
|
|
460
481
|
* @returns 是否完全在矩形内部
|
|
461
482
|
*/
|
|
462
483
|
containsLineSegment(line: LineSegment): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* 判断点是否完全位于矩形内部
|
|
486
|
+
* @param point
|
|
487
|
+
*/
|
|
488
|
+
containsPoint(point: Point): boolean;
|
|
489
|
+
/**
|
|
490
|
+
*
|
|
491
|
+
* @returns
|
|
492
|
+
*/
|
|
493
|
+
toBox(): Box2;
|
|
463
494
|
/**
|
|
464
495
|
*
|
|
465
496
|
* @param line
|