forked from vccheng2001/DeepVCP-Pointcloud-Registration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
30 lines (26 loc) · 898 Bytes
/
utils.py
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
''' Utility functions '''
import itertools
import torch
import numpy as np
import math
# rotation about x axis
def RotX(theta):
Rx = np.matrix([[ 1, 0 , 0 ],
[ 0, math.cos(theta),-math.sin(theta)],
[ 0, math.sin(theta), math.cos(theta)]])
return Rx
# rotation about y axis
def RotY(theta):
Ry = np.matrix([[ math.cos(theta), 0, math.sin(theta)],
[ 0 , 1, 0 ],
[-math.sin(theta), 0, math.cos(theta)]])
return Ry
# rotation about z axis
def RotZ(theta):
Rz = np.matrix([[ math.cos(theta), -math.sin(theta), 0 ],
[ math.sin(theta), math.cos(theta) , 0 ],
[ 0 , 0 , 1 ]])
return Rz
# euclidean distance between two points
def euclidean_dist(a,b):
return torch.linalg.norm(a-b)