build-dxf 0.1.145 → 0.1.146

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.145",
3
+ "version": "0.1.146",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -8570,14 +8570,16 @@ class CheckPointCloudContinuity {
8570
8570
  * @param points
8571
8571
  */
8572
8572
  static checkByProjectionContinuity(points, opt) {
8573
- const { ratio = 0.6, axisLine } = opt ?? {};
8574
- let xline = axisLine;
8575
- if (!xline) {
8573
+ let { ratio = 0.6, axisLine } = opt ?? {};
8574
+ if (!axisLine) {
8576
8575
  const rectangle = new Polygon(
8577
8576
  points.map((p2) => new Point(p2.x, p2.y))
8578
8577
  ).toRectangle();
8579
- xline = rectangleToLine(rectangle);
8578
+ axisLine = rectangleToLine(rectangle);
8579
+ } else if (!(axisLine instanceof LineSegment)) {
8580
+ axisLine = new LineSegment(Point.from(axisLine.start), Point.from(axisLine.end));
8580
8581
  }
8582
+ const xline = axisLine;
8581
8583
  const start = new Vector3(), end = new Vector3();
8582
8584
  start.set(xline.start.x, xline.start.y, 0);
8583
8585
  end.set(xline.end.x, xline.end.y, 0);
@@ -8600,7 +8602,15 @@ class CheckPointCloudContinuity {
8600
8602
  * @returns
8601
8603
  */
8602
8604
  static checkByVoxelDensity(points, opt) {
8603
- const { gridSize = 0.08, xRatio = 0.5, yRatio = 0.4, overallRatio = 0.5, axisLine } = opt ?? {};
8605
+ let { gridSize = 0.08, xRatio = 0.5, yRatio = 0.4, overallRatio = 0.5, axisLine } = opt ?? {};
8606
+ if (!axisLine) {
8607
+ const rectangle = new Polygon(
8608
+ points.map((p2) => new Point(p2.x, p2.y))
8609
+ ).toRectangle();
8610
+ axisLine = rectangleToLine(rectangle);
8611
+ } else if (!(axisLine instanceof LineSegment)) {
8612
+ axisLine = new LineSegment(Point.from(axisLine.start), Point.from(axisLine.end));
8613
+ }
8604
8614
  let xline = axisLine;
8605
8615
  if (!xline) {
8606
8616
  const rectangle = new Polygon(points.map((p2) => new Point(p2.x, p2.y))).toRectangle();
@@ -1,10 +1,21 @@
1
- import { LineSegment } from './LineSegment';
2
1
  import { Vector3 } from 'three';
3
2
  type Point3D = {
4
3
  x: number;
5
4
  y: number;
6
5
  z: number;
7
6
  };
7
+ type LineSegmentType = {
8
+ start: {
9
+ x: number;
10
+ y: number;
11
+ z?: number;
12
+ };
13
+ end: {
14
+ x: number;
15
+ y: number;
16
+ z?: number;
17
+ };
18
+ };
8
19
  /**
9
20
  * 检测点云在分部轴上的连续性,z朝上
10
21
  */
@@ -15,7 +26,7 @@ export declare class CheckPointCloudContinuity {
15
26
  */
16
27
  static checkByProjectionContinuity(points: Point3D[], opt?: {
17
28
  ratio?: number;
18
- axisLine?: LineSegment;
29
+ axisLine?: LineSegmentType;
19
30
  }): boolean;
20
31
  /** 通过区域投影面积占比检测
21
32
  * @param points
@@ -38,7 +49,7 @@ export declare class CheckPointCloudContinuity {
38
49
  * 总占比比例
39
50
  */
40
51
  overallRatio?: number;
41
- axisLine?: LineSegment;
52
+ axisLine?: LineSegmentType;
42
53
  }): boolean;
43
54
  /** 获取投影值
44
55
  * @param points