5 from pypointmatcher
import pointmatcher
as pm
9 Generator = pm.PointCloudGenerator
14 output_base_directory =
"tests/generator/"
17 number_of_points = 10000
25 ref =
DP(DP.load(
'../data/car_cloud400.csv'))
26 data =
DP(DP.load(
'../data/car_cloud401.csv'))
28 translation = np.array([[0], [0], [0]])
29 rotation = np.array([1, 0, 0, 0], dtype=np.float32)
31 raise Exception(
"The Point Cloud Generator only supports 3D shapes")
33 box = Generator.generateUniformlySampledBox(1.0, 2.0, 3.0, number_of_points, translation, rotation)
34 circle = Generator.generateUniformlySampledCircle(1.0, number_of_points, translation, rotation)
35 cylinder = Generator.generateUniformlySampledCylinder(1.0, 2.0, number_of_points, translation, rotation)
36 plane = Generator.generateUniformlySampledPlane(np.array([1.0, 2.0, 3.0]), number_of_points, translation, rotation)
37 sphere = Generator.generateUniformlySampledSphere(1.0, number_of_points, translation, rotation)
41 if not os.path.exists(output_base_directory):
42 os.makedirs(output_base_directory)
44 box.save(f
"{output_base_directory}box.vtk")
45 circle.save(f
"{output_base_directory}circle.vtk")
46 cylinder.save(f
"{output_base_directory}cylinder.vtk")
47 plane.save(f
"{output_base_directory}plane.vtk")
48 sphere.save(f
"{output_base_directory}sphere.vtk")
50 print(f
"Saved generated shapes into {output_base_directory}")