forked from luoxuhai/pcl.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsavePCDFile.test.ts
38 lines (29 loc) · 981 Bytes
/
savePCDFile.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as PCL from '../../';
let cloud: any;
beforeAll(async () => {
const points = [
[0.352222, -0.151883, -0.106395],
[-0.397406, -0.473106, 1.292602],
[-0.731898, 0.667105, 0.441304],
[-0.734766, 0.854581, -0.0361733],
[-0.4607, -0.277468, -0.916762],
];
cloud = new PCL.PointCloud<PCL.PointXYZ>(PCL.PointXYZ);
for (let i = 0; i < points.length; i++) {
cloud.addPoint(new PCL.PointXYZ(...points[i]));
}
});
describe('savePCDFile', () => {
it('should save a ascii PCD file', () => {
const result = PCL.savePCDDataASCII(cloud) as ArrayBuffer;
expect(result.byteLength).toBe(326);
});
it('should save a binary PCD file', () => {
const result = PCL.savePCDDataBinary(cloud) as ArrayBuffer;
expect(result.byteLength).toBe(224);
});
it('should save a binary_compressed PCD file', () => {
const result = PCL.savePCDDataBinaryCompressed(cloud) as ArrayBuffer;
expect(result.byteLength).toBe(245);
});
});