build-dxf 0.1.19 → 0.1.20

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": "build-dxf",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -4289,7 +4289,6 @@ class DxfDrawPlugin {
4289
4289
  type: ["door"],
4290
4290
  handler: ({ group: group2, drawArc, drawLine, setColor }) => {
4291
4291
  group2.lines.forEach((lineSegment) => {
4292
- if (lineSegment.length() < 0.4) return;
4293
4292
  const line = lineSegment.clone();
4294
4293
  const doorThickness = DEFAULT_WALL_WIDTH * 0.2;
4295
4294
  const list = [];
@@ -5538,6 +5537,7 @@ function modify(reference, cell, opt, appendLines, grid) {
5538
5537
  if (hasParallel) {
5539
5538
  const newLine = createNewLine(cell, reference, opt, appendLines, grid);
5540
5539
  if (hasSameDirection) newLine.userData = cloneUserData(cell[opt[1]].userData?.userData ?? {});
5540
+ newLine.userData.rooftopPz = cell[opt[1]]?.userData?.userData.rooftopPz ?? newLine.userData.rooftopPz;
5541
5541
  return;
5542
5542
  }
5543
5543
  if (hasDifferentDirection) {
@@ -13946,6 +13946,7 @@ class SceneAutoGenerat {
13946
13946
  const zStart = new THREE.Vector3().copy(rectangle[0].toJson(z)), zEnd = zStart.clone();
13947
13947
  zEnd.z += height;
13948
13948
  return {
13949
+ geometry,
13949
13950
  box: lineSegments,
13950
13951
  center,
13951
13952
  category: item.category,
@@ -14471,6 +14472,7 @@ class CorrectionDxf extends Dxf {
14471
14472
  const lines = parent.Dxf.getLineSegments(true);
14472
14473
  this.set(lineDataToOriginalData(lines, parent.Dxf.originalZAverage), {
14473
14474
  trajectory: e.options.trajectory,
14475
+ publicInfo: e.options.publicInfo,
14474
14476
  onBoundExt: e.options.onBoundExt
14475
14477
  });
14476
14478
  this.clearPreProcessor();
@@ -14496,6 +14498,7 @@ class CorrectionDxf extends Dxf {
14496
14498
  data = res.data;
14497
14499
  this.lineSegments = res.lineSegments;
14498
14500
  this.originalData = data;
14501
+ this.lineSegments = PRE_PROCESSOR.WallHeightHandle(this.lineSegments, options);
14499
14502
  }
14500
14503
  const zList = [];
14501
14504
  data.forEach(({ start, end }) => zList.push(start.z ?? 0, end.z ?? 0));
@@ -15,6 +15,10 @@ interface IByTrajAnOriginData {
15
15
  updateDoubleWallGroup?: boolean;
16
16
  findCallBack?: (lines: LineSegment[], trajectory: Point[]) => void;
17
17
  }
18
+ /** 执行纠正更加全面
19
+ * @param line
20
+ * @param grid
21
+ */
18
22
  export declare class BoundExt {
19
23
  /** 通过轨迹点查找外墙
20
24
  * @param lines
@@ -25,6 +25,7 @@ export declare class SceneAutoGenerat {
25
25
  */
26
26
  buildItem(): Promise<void>;
27
27
  static itemParse(item: any): {
28
+ geometry: THREE.ExtrudeGeometry;
28
29
  box: THREE.LineSegments<THREE.EdgesGeometry<THREE.ExtrudeGeometry>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
29
30
  center: THREE.Vector3;
30
31
  category: any;
@@ -0,0 +1,83 @@
1
+ import { Octant, PointData } from 'sparse-octree';
2
+ import { OBB } from 'three/addons/math/OBB.js';
3
+ import * as THREE from 'three';
4
+ /** 查询点是否在obb内,通过gpu计算
5
+ * @param points
6
+ * @param obbs
7
+ * @returns
8
+ */
9
+ export declare function pointInOBBByGpu(points: THREE.Vector3[], obbs: OBBBox[]): Promise<number[]>;
10
+ export declare class OBBBox extends OBB {
11
+ getBoxMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
12
+ getBoxEdge(color?: number): THREE.LineSegments<THREE.EdgesGeometry<THREE.BoxGeometry>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
13
+ toJson(): {
14
+ size: THREE.Vector3Tuple;
15
+ center: THREE.Vector3Tuple;
16
+ quaternion: THREE.QuaternionTuple;
17
+ };
18
+ static fromByBox(box: THREE.Vector3, position: THREE.Vector3, rotation: THREE.Euler | THREE.Quaternion, obb?: OBBBox): OBBBox;
19
+ static fromByPath2D(path: {
20
+ x: number;
21
+ y: number;
22
+ }[], origin: THREE.Vector3, height: number, obb_?: OBBBox): OBBBox;
23
+ }
24
+ export declare class PCSparseOctree<T> {
25
+ private octree;
26
+ bound: THREE.Box3;
27
+ constructor(bound: THREE.Box3);
28
+ /** 插入点 + 数据
29
+ * @param point
30
+ * @param data
31
+ */
32
+ insert(point: THREE.Vector3, data: T): void;
33
+ /** 批量插入(推荐大批量时用)
34
+ * @param points
35
+ * @param datas
36
+ */
37
+ insertBatch(points: THREE.Vector3[], datas: T[]): void;
38
+ /** 查找所有在 oBB 内的盒子
39
+ * @param queryOBB
40
+ * @returns
41
+ */
42
+ findNodeInOBB(queryOBB: OBB): Octant<PointData<T>>[];
43
+ /** 查找所有在 oBB 内的点(带数据)
44
+ * @param queryOBB
45
+ * @returns
46
+ */
47
+ findPointsInOBB(queryOBB: OBB): Array<{
48
+ point: THREE.Vector3;
49
+ data: T;
50
+ }>;
51
+ /** 通过半径查找
52
+ * @param position
53
+ * @param radius
54
+ * @param skipSelf
55
+ * @returns
56
+ */
57
+ findPointsByCircle(position: THREE.Vector3, radius: number, skipSelf?: boolean): import('sparse-octree').PointContainer<T>[];
58
+ /** 查找最近的点
59
+ * @param position
60
+ * @param maxDistance
61
+ * @param skipSelf
62
+ * @returns
63
+ */
64
+ findNearestPoint(position: THREE.Vector3, maxDistance: number, skipSelf?: boolean): import('sparse-octree').PointContainer<T> | null;
65
+ /** 批量查询
66
+ * @param obbList
67
+ * @returns
68
+ */
69
+ findPointsInOBBBatch(obbList: OBBBox[]): {
70
+ point: THREE.Vector3;
71
+ data: T;
72
+ }[][];
73
+ /**
74
+ * @param obbList
75
+ */
76
+ findPointsByGpu(obbList: OBBBox[]): Promise<{
77
+ point: THREE.Vector3;
78
+ data: T;
79
+ }[][]>;
80
+ static fromPoints(points: THREE.Vector3[]): PCSparseOctree<{
81
+ index: number;
82
+ }>;
83
+ }
@@ -0,0 +1,7 @@
1
+ import * as THREE from 'three';
2
+ export declare function encode(points: THREE.Vector3[], colors: number[]): ArrayBuffer;
3
+ export declare function decode(buffer: ArrayBuffer | Blob): Promise<{
4
+ points: Float32Array;
5
+ colors: Float32Array;
6
+ pointCount: number;
7
+ }>;
@@ -0,0 +1 @@
1
+ export declare function download(path: string, file: any): Promise<void>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,48 +0,0 @@
1
- type ValueType = "f32" | "vec2" | "vec3" | "vec4" | "mat3x3" | "mat4x4";
2
- type OptionType = {
3
- workgroup_size?: [number, number, number];
4
- workgroupCount: [number, number?, number?];
5
- globalInvocationIdName?: string;
6
- workgroupIndexName?: string;
7
- synchronize?: string[];
8
- };
9
- type BufferType = {
10
- buffer: number[];
11
- stride: number;
12
- layout: {
13
- name: string;
14
- type: ValueType;
15
- offset: number;
16
- size: number;
17
- }[];
18
- count: number;
19
- };
20
- export declare class GpuComputed {
21
- constructor();
22
- getDevice(): Promise<{
23
- adapter: GPUAdapter | null;
24
- device: GPUDevice;
25
- }>;
26
- createPipleline(code: string, buffers: Record<string, BufferType>): Promise<{
27
- pipeline: GPUComputePipeline;
28
- group: GPUBindGroup;
29
- device: GPUDevice;
30
- bufferInfoList: {
31
- name: string;
32
- buffer: GPUBuffer;
33
- float32Array: Float32Array<ArrayBuffer>;
34
- groupLayoutItem: GPUBindGroupLayoutEntry;
35
- groupItem: {
36
- binding: number;
37
- resource: {
38
- buffer: GPUBuffer;
39
- };
40
- };
41
- }[];
42
- }>;
43
- private buildBuffer;
44
- capitalize(str: string): string;
45
- private buildCode;
46
- computed(code: string, data: Record<string, any[]>, option: OptionType): Promise<number[][]>;
47
- }
48
- export {};