MCPcopy
hub / github.com/PiLiDAR/PiLiDAR / transform

Function transform

lib/pointcloud.py:537–554  ·  view source on GitHub ↗
(pcd, transformation=None, translate=None, scale=None, euler_rotate_deg=None, pivot=(0,0,0))

Source from the content-addressed store, hash-verified

535
536# apply translation and rotation to open3d point cloud
537def transform(pcd, transformation=None, translate=None, scale=None, euler_rotate_deg=None, pivot=(0,0,0)):
538 pcd_temp = copy.deepcopy(pcd)
539
540 if transformation is not None:
541 pcd_temp.transform(transformation)
542
543 if translate is not None:
544 pcd_temp.translate(translate)
545
546 if euler_rotate_deg is not None:
547 euler_rotate_rad = np.deg2rad(euler_rotate_deg)
548 rotation_matrix = pcd_temp.get_rotation_matrix_from_xyz(euler_rotate_rad)
549 pcd_temp.rotate(rotation_matrix, center=pivot)
550
551 if scale is not None:
552 pcd_temp.scale(scale, center=pivot)
553
554 return pcd_temp
555
556
557#------------------------------------------------------------------------------------------------

Callers 4

visualizeFunction · 0.90
registration.pyFile · 0.90
postprocess_3DFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected