rm-gxf-computing-rusts 0.0.18 → 0.0.19

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": "rm-gxf-computing-rusts",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "",
5
5
  "author": "初秋",
6
6
  "type": "commonjs",
@@ -19,6 +19,16 @@
19
19
  "types": "./src/index.d.ts",
20
20
  "default": "./src/main.js"
21
21
  }
22
+ },
23
+ "./utils": {
24
+ "import": {
25
+ "types": "./src/index.d.ts",
26
+ "default": "./src/main.js"
27
+ },
28
+ "require": {
29
+ "types": "./src/index.d.ts",
30
+ "default": "./src/main.js"
31
+ }
22
32
  }
23
33
  }
24
34
  }
Binary file
package/src/index.d.ts CHANGED
@@ -22,15 +22,12 @@ export interface CheckResult {
22
22
  offsets?: Array<number>
23
23
  }
24
24
 
25
- export interface CheckResult {
26
- originalVertices: Array<Square>
27
- allCenterPoints: Array<Point>
28
- offsets?: Array<number>
25
+ export interface Index {
26
+ index: number
29
27
  }
30
28
 
31
- export interface Line {
32
- start: Vector3F64
33
- end: Vector3F64
29
+ export interface Index {
30
+ index: number
34
31
  }
35
32
 
36
33
  export interface Line {
@@ -54,17 +51,27 @@ export interface LineData {
54
51
  checkResults: Array<CheckResult>
55
52
  }
56
53
 
57
- export interface LineData {
58
- start: Vector3F64
59
- end: Vector3F64
60
- checkResults: Array<CheckResult>
54
+ export interface ParseLineResult {
55
+ start?: Vector3F64
56
+ end?: Vector3F64
57
+ missingCheckResults: Array<Quads>
58
+ existSegments: Array<Quads>
59
+ intersectionSegments: Array<Array<Index>>
60
+ }
61
+
62
+ export interface ParseLineResult {
63
+ start?: Vector3F64
64
+ end?: Vector3F64
65
+ missingCheckResults: Array<Quads>
66
+ existSegments: Array<Quads>
67
+ intersectionSegments: Array<Array<Index>>
61
68
  }
62
69
 
63
70
  export interface PcBackfaceTestOptions {
64
71
  view?: boolean
65
72
  pcdDir: string
66
73
  lines: LineDataList
67
- trajectorys: Record<string, Vector3F64>
74
+ trajectorys: Record<string, Trajectory>
68
75
  distProjection: boolean
69
76
  }
70
77
 
@@ -72,7 +79,7 @@ export interface PcBackfaceTestOptions {
72
79
  view?: boolean
73
80
  pcdDir: string
74
81
  lines: LineDataList
75
- trajectorys: Record<string, Vector3F64>
82
+ trajectorys: Record<string, Trajectory>
76
83
  distProjection: boolean
77
84
  }
78
85
 
@@ -81,6 +88,7 @@ export interface PcObjectEcognizerOption {
81
88
  pcdUrl: string
82
89
  imageUrls: Array<string>
83
90
  groundZ: number
91
+ version?: string
84
92
  }
85
93
 
86
94
  export interface PcObjectEcognizerOption {
@@ -88,17 +96,43 @@ export interface PcObjectEcognizerOption {
88
96
  pcdUrl: string
89
97
  imageUrls: Array<string>
90
98
  groundZ: number
99
+ version?: string
91
100
  }
92
101
 
93
102
  export declare function pointCloudObjectEcognizer(option: PcObjectEcognizerOption): Array<Array<Array<number>>>
94
103
 
104
+ export interface Quads {
105
+ originalVertices: Array<Array<Vector3F64>>
106
+ allCenterPoints: Array<Vector3F64>
107
+ }
108
+
109
+ export interface Quads {
110
+ originalVertices: Array<Array<Vector3F64>>
111
+ allCenterPoints: Array<Vector3F64>
112
+ }
113
+
95
114
  export declare function squareBackfacePointCloudTest(option: PcBackfaceTestOptions): Array<number>
96
115
 
97
- /** 三维向量,包含 x、y、z 分量 */
98
- export interface Vector3F64 {
116
+ export declare function squareBackfaceSquareTest(option: SquareBackfaceTestOptions): Array<number>
117
+
118
+ export interface SquareBackfaceTestOptions {
119
+ view?: boolean
120
+ lines: Array<ParseLineResult>
121
+ }
122
+
123
+ export interface SquareBackfaceTestOptions {
124
+ view?: boolean
125
+ lines: Array<ParseLineResult>
126
+ }
127
+
128
+ export interface Trajectory {
99
129
  x: number
100
130
  y: number
101
131
  z: number
132
+ qx: number
133
+ qy: number
134
+ qz: number
135
+ qw: number
102
136
  }
103
137
 
104
138
  /** 三维向量,包含 x、y、z 分量 */
package/src/index.js CHANGED
@@ -590,3 +590,4 @@ module.exports = nativeBinding
590
590
  module.exports.checkLineSideVisibility = nativeBinding.checkLineSideVisibility
591
591
  module.exports.pointCloudObjectEcognizer = nativeBinding.pointCloudObjectEcognizer
592
592
  module.exports.squareBackfacePointCloudTest = nativeBinding.squareBackfacePointCloudTest
593
+ module.exports.squareBackfaceSquareTest = nativeBinding.squareBackfaceSquareTest
package/src/main.js CHANGED
@@ -120,6 +120,46 @@ function squareBackfacePointCloudTest(params) {
120
120
  return gxf.squareBackfacePointCloudTest(params)
121
121
  }
122
122
 
123
+ /**
124
+ *
125
+ * @param {import("./index").SquareBackfaceTestOptions} params
126
+ * @returns
127
+ */
128
+ function squareBackfaceSquareTest(params) {
129
+ // params.lines 参数验证
130
+ if (!Array.isArray(params.lines)) {
131
+ throw new Error("params.lines must be an array");
132
+ }
133
+
134
+ for (let i = 0; i < params.lines.length; i++) {
135
+ const line = params.lines[i]
136
+ if (!line || typeof line !== "object") {
137
+ throw new Error(`params.lines[${i}] must be an object`)
138
+ }
139
+
140
+ // start
141
+ if (!isVector3(line.start)) {
142
+ throw new Error(`params.lines[${i}].start must be {x,y,z}`)
143
+ }
144
+
145
+ // end
146
+ if (!isVector3(line.end)) {
147
+ throw new Error(`params.lines[${i}].start must be {x,y,z}`)
148
+ }
149
+
150
+ // missingCheckResults
151
+ if (line.missingCheckResults == undefined) {
152
+ line.missingCheckResults = []
153
+ }
154
+
155
+ if (line.existSegments == undefined) {
156
+ line.existSegments = []
157
+ }
158
+ }
159
+
160
+ return gxf.squareBackfaceSquareTest(params)
161
+ }
162
+
123
163
  /**
124
164
  *
125
165
  * @param {import("./index").PcObjectEcognizerOption} params
@@ -129,6 +169,17 @@ function pointCloudObjectEcognizer(params) {
129
169
  return gxf.pointCloudObjectEcognizer(params)
130
170
  }
131
171
 
172
+ /**
173
+ *
174
+ * @param {import("./index").PcObjectEcognizerOption} params
175
+ * @returns
176
+ */
177
+ function pointCloudObjectEcognizer2_0(params) {
178
+ return gxf.pointCloudObjectEcognizer2_0(params)
179
+ }
180
+
132
181
  module.exports.checkLineSideVisibility = checkLineSideVisibility
133
182
  module.exports.squareBackfacePointCloudTest = squareBackfacePointCloudTest
134
- module.exports.pointCloudObjectEcognizer = pointCloudObjectEcognizer
183
+ module.exports.pointCloudObjectEcognizer = pointCloudObjectEcognizer
184
+ module.exports.squareBackfaceSquareTest = squareBackfaceSquareTest
185
+ module.exports.pointCloudObjectEcognizer2_0 = pointCloudObjectEcognizer2_0