File: test-cpp

package info (click to toggle)
open3d 0.19.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 83,496 kB
  • sloc: cpp: 206,543; python: 27,254; ansic: 8,356; javascript: 1,883; sh: 1,527; makefile: 259; xml: 69
file content (44 lines) | stat: -rwxr-xr-x 1,160 bytes parent folder | download | duplicates (3)
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
39
40
41
42
43
44
#!/bin/bash
set -e
cd "$AUTOPKGTEST_TMP"

cat > "CMakeLists.txt" << EOF
cmake_minimum_required(VERSION 3.10)
project(open3d_test)
find_package(Open3D REQUIRED)
add_executable(\${PROJECT_NAME} open3d_test.cpp)
target_link_libraries(\${PROJECT_NAME} PRIVATE Open3D::Open3D)
EOF
cat > "open3d_test.cpp" << EOF
#include <open3d/Open3D.h>
#include <iostream>
#include <memory>

int main (int argc, char** argv)
{
	auto cloud_ptr = std::make_shared<open3d::geometry::PointCloud>();
	if (!open3d::io::ReadPointCloud(argv[1], *cloud_ptr))
		return 1;
	if (cloud_ptr->points_.size() != 4) return 1;
	if ((cloud_ptr->points_[0] - Eigen::Vector3d(0, 1, 2)).norm() > 1e-4) return 1;
	if ((cloud_ptr->points_[1] - Eigen::Vector3d(3, 4, 5)).norm() > 1e-4) return 1;
	if ((cloud_ptr->points_[2] - Eigen::Vector3d(6, 7, 8)).norm() > 1e-4) return 1;
	if ((cloud_ptr->points_[3] - Eigen::Vector3d(9, 0, 1)).norm() > 1e-4) return 1;
	std::cout << "OK\n";
	return 0;
}
EOF
cat > "cloud.xyz" << EOF
0 1 2
3 4 5
6 7 8
9 0 1
EOF

echo '$' cmake .
cmake . -DCMAKE_CXX_FLAGS=-Wno-psabi
echo '$' make VERBOSE=ON
make VERBOSE=ON
echo '$' ./open3d_test cloud.xyz
./open3d_test cloud.xyz