forked from s_ranjbar/city_retrofit
20 lines
479 B
Python
20 lines
479 B
Python
import math
|
|
import numpy as np
|
|
|
|
|
|
class Geometry:
|
|
def __init__(self, delta=0.5):
|
|
self._delta = delta
|
|
|
|
def almost_equal(self, v1, v2):
|
|
delta = math.sqrt(pow((v1[0]-v2[0]), 2) + pow((v1[1]-v2[1]), 2) + pow((v1[2]-v2[2]), 2))
|
|
return delta <= self._delta
|
|
|
|
@staticmethod
|
|
def to_points_matrix(points, remove_last=False):
|
|
rows = points.size//3
|
|
points = points.reshape(rows, 3)
|
|
if remove_last:
|
|
points = np.delete(points, rows-1, 0)
|
|
return points
|