build-dxf 0.0.13 → 0.0.15

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/src/index2.js CHANGED
@@ -7127,7 +7127,7 @@ class ModelDataRender extends Component {
7127
7127
  group.clear();
7128
7128
  dxf.wallsGroup.forEach((path, j) => {
7129
7129
  path.forEach((p, i) => {
7130
- renderer.createText(`${i}`, p, { color: "#ff00ff", fontSize: "10px" }, group).position.z = dxf.originalZAverage * 0.99;
7130
+ renderer.createText(`${j}-${i}`, p, { color: "#ff00ff", fontSize: "10px" }, group).position.z = dxf.originalZAverage * 0.99;
7131
7131
  });
7132
7132
  });
7133
7133
  }
@@ -7307,7 +7307,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7307
7307
  createVNode(unref(ElButton), {
7308
7308
  size: "small",
7309
7309
  type: "primary",
7310
- onClick: _cache[1] || (_cache[1] = ($event) => unref(whiteModel).downloadGlb("test.glb"))
7310
+ onClick: _cache[1] || (_cache[1] = ($event) => unref(whiteModel).downloadGltf("test.glb"))
7311
7311
  }, {
7312
7312
  default: withCtx(() => _cache[7] || (_cache[7] = [
7313
7313
  createTextVNode(" 下载 白模 ", -1)
@@ -23,6 +23,18 @@ export interface OriginalDataItem {
23
23
  };
24
24
  }[];
25
25
  isDoor?: boolean;
26
+ drawDoorData?: {
27
+ start: {
28
+ x: number;
29
+ y: number;
30
+ z: number;
31
+ };
32
+ n: {
33
+ x: number;
34
+ y: number;
35
+ z: number;
36
+ };
37
+ };
26
38
  }
27
39
  /**
28
40
  * [开始点, 结束点, 相交点, 是否是门, 索引]
@@ -61,6 +73,7 @@ export declare class Dxf extends Component<{
61
73
  pointsGroups: Point[][][];
62
74
  wallsGroup: Point[][];
63
75
  doors: DataItem[];
76
+ doorLineSegment: LineSegment[];
64
77
  lineSegments: LineSegment<{
65
78
  isDoor: boolean;
66
79
  }>[];
@@ -108,18 +121,16 @@ export declare class Dxf extends Component<{
108
121
  * @description 处理线路拓扑,使线路有序链接,形成长路径
109
122
  * @param lines
110
123
  */
111
- private lineTopology;
124
+ lineTopology(lines: Point[][]): Point[][];
125
+ /** 合并方向相同的线段
126
+ * @param lines
127
+ * @param errAngle
128
+ */
129
+ private mergeSameDirectionLine;
112
130
  /** etOpenRound 去除毛刺
113
131
  * @description 检查连续的短线段数量,去除合并后产生的毛刺
114
132
  */
115
133
  private squareRemoveBurr;
116
- epsilon: number;
117
- /**
118
- * 移除共线点
119
- * @param path
120
- * @returns
121
- */
122
- removeCollinearPoints(path: Point[]): Point[];
123
134
  /**
124
135
  * 线段矫直, 线段中心突刺
125
136
  * @description 突变长度小于墙体宽度,该线段可能为突起线段,
@@ -128,6 +139,7 @@ export declare class Dxf extends Component<{
128
139
  lineSegmentStraightening(path: Point[]): Point[];
129
140
  /**
130
141
  * 移除短线段
142
+ * @todo 根据线段两端线段长度,选取参照物_|▔▔
131
143
  * @param path
132
144
  */
133
145
  removeShortLine(path: Point[], shortLine?: number): Point[];
@@ -139,6 +151,13 @@ export declare class Dxf extends Component<{
139
151
  * 将点云结构转换为Float32Array
140
152
  */
141
153
  to3DArray(scale: number): Float32Array<ArrayBuffer>;
154
+ /** 获取角度范围
155
+ * @param center
156
+ * @param p1
157
+ * @param p2
158
+ * @returns
159
+ */
160
+ private getArcAngleRange;
142
161
  /**
143
162
  * 将点云结构转换为string
144
163
  */
@@ -64,6 +64,7 @@ export declare class LineAnalysis extends Component {
64
64
  */
65
65
  buildQuadtree(): void;
66
66
  resultList: ProjectionAnalysisResult[];
67
+ mergeWallLines: LineSegment[][];
67
68
  /** 线段分析
68
69
  * @description 判断两条线段距离是否较短且趋近平行,然后查找两条线段的重合部分的投影线,以此判断两根线是否需要合并
69
70
  * @param data
@@ -76,5 +77,12 @@ export declare class LineAnalysis extends Component {
76
77
  * @returns
77
78
  */
78
79
  private projectionAnalysis;
80
+ doorSearchNearAngle: number;
81
+ doorSearchDistance: number;
82
+ doors: LineSegment[];
83
+ /**
84
+ * 门的位置判断
85
+ */
86
+ doorsAnalysis(): void;
79
87
  }
80
88
  export {};
@@ -17,10 +17,37 @@ export declare class WhiteModel extends Component<{
17
17
  material: THREE.MeshBasicMaterial;
18
18
  onAddFromParent(parent: ComponentManager): void;
19
19
  updateModel(): void;
20
+ /**
21
+ * 转为obj
22
+ * @returns
23
+ */
20
24
  toOBJ(): Promise<string>;
21
- toGlb(): Promise<ArrayBuffer | undefined>;
25
+ /**
26
+ * 转为 glb
27
+ * @param binary
28
+ * @returns
29
+ */
30
+ toGltf(binary?: boolean): Promise<string | ArrayBuffer | undefined>;
31
+ /**
32
+ * 转为 OBJBlob
33
+ * @returns
34
+ */
22
35
  toOBJBlob(): Promise<Blob | undefined>;
23
- toGlbBlob(): Promise<Blob | undefined>;
24
- download(filename: string): Promise<void>;
25
- downloadGlb(filename: string): Promise<void>;
36
+ /**
37
+ * 转为 GltfBlob
38
+ * @returns
39
+ */
40
+ toGltfBlob(binary?: boolean): Promise<Blob | undefined>;
41
+ /**
42
+ * 下载 OBJ
43
+ * @param filename
44
+ * @returns
45
+ */
46
+ downloadOBJ(filename: string): Promise<void>;
47
+ /**
48
+ * 下载 Gltf
49
+ * @param filename
50
+ * @returns
51
+ */
52
+ downloadGltf(filename: string, binary?: boolean): Promise<void>;
26
53
  }
@@ -1,4 +1,5 @@
1
1
  import { Point } from './Point';
2
+ import { Rectangle } from './Rectangle';
2
3
  /**
3
4
  * 非轴对称线段
4
5
  */
@@ -9,6 +10,33 @@ export declare class LineSegment<T = Record<string, any>> {
9
10
  get start(): Point;
10
11
  get end(): Point;
11
12
  constructor(p1?: Point, p2?: Point);
13
+ /** 膨胀
14
+ * @description 向线段的两个端点分别膨胀 width
15
+ * @param width
16
+ */
17
+ expansion(width: number, direction?: "start" | "end" | "all"): this;
18
+ /** 向前
19
+ * @description 向前移动 width
20
+ * @param width
21
+ */
22
+ forward(width: number): this;
23
+ /** 向前
24
+ * @description 向前移动 width
25
+ * @param width
26
+ */
27
+ backward(width: number): this;
28
+ /**
29
+ * 向指定方向平移
30
+ * @param direct
31
+ * @param size
32
+ */
33
+ directionMove(direct: Point, size: number): this;
34
+ /** 膨胀为矩形
35
+ *
36
+ * @param width
37
+ * @returns {Rectangle}
38
+ */
39
+ expandToRectangle(width?: number): Rectangle;
12
40
  /**
13
41
  * 计算线段的长度
14
42
  * @returns 线段的长度
@@ -19,6 +47,10 @@ export declare class LineSegment<T = Record<string, any>> {
19
47
  * @returns
20
48
  */
21
49
  direction(): Point;
50
+ /**
51
+ * 获取发向量
52
+ */
53
+ normal(): Point;
22
54
  /**
23
55
  * 线段长度
24
56
  * @returns
@@ -30,6 +62,12 @@ export declare class LineSegment<T = Record<string, any>> {
30
62
  * @returns 投影并裁剪后的线段
31
63
  */
32
64
  projectLineSegment(line: LineSegment): LineSegment;
65
+ /**
66
+ * 计算一条线段在另一条直线上的投影,并裁剪超出目标线段的部分
67
+ * @param line 要投影的线段
68
+ * @returns 投影并裁剪后的线段
69
+ */
70
+ projectPoint(p1: Point): Point | null;
33
71
  /**
34
72
  * 判断线段是与线段相交
35
73
  * @param line
@@ -89,13 +89,20 @@ export declare class Point {
89
89
  * @returns
90
90
  */
91
91
  dot(point: Point): number;
92
+ /** 求两个点叉积
93
+ * @description 如果叉积大于 0,a 到 b 为逆时针方向。
94
+ * @description 如果叉积小于 0,a 到 b 为顺时针方向。
95
+ * @param point
96
+ * @returns
97
+ */
98
+ cross(point: Point): number;
92
99
  /** 计算两个向量夹角
93
100
  * @description 公式:a · b = |a| × |b| × cosθ
94
101
  * @description 结果为0(0度),两个向量方向一致,结果为3.1415926(180度, PI),两个向量方向相反
95
102
  * @param point
96
103
  * @returns
97
104
  */
98
- angleBetween(point: Point): number;
105
+ angleBetween(point: Point, type?: 'radian' | 'cos' | 'angle', angle?: "180" | "360"): number;
99
106
  /** 获取向量长度
100
107
  */
101
108
  length(): number;
@@ -50,6 +50,12 @@ export declare class Quadtree<T = any> {
50
50
  * @returns 相交的节点数组
51
51
  */
52
52
  queryRect(rectangle: Rectangle): QuadtreeNode<T>[];
53
+ /**
54
+ * 查询与线段相交的线段节点
55
+ * @param lineSegment 线段
56
+ * @returns 相交的节点数组
57
+ */
58
+ queryLineSegment(lineSegment: LineSegment): QuadtreeNode<T>[];
53
59
  /**
54
60
  * 包围盒转换为数组
55
61
  * @param array
@@ -7,6 +7,7 @@ import { Point } from './Point';
7
7
  export declare class Rectangle {
8
8
  points: Point[];
9
9
  get path(): number[];
10
+ path2D(callback?: (point1: Point, point2: Point) => void): number[];
10
11
  constructor(points: Point[]);
11
12
  /**
12
13
  * 判断线段是否与矩形相交
@@ -0,0 +1 @@
1
+ export declare function include(path: string, exportDefault?: boolean): Promise<any>;