An error occurred while loading the file. Please try again.
-
Pierre-Antoine Rouby authoredd22ab3bb
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
# -*- coding: utf-8 -*-
import numpy as np
from Model.Geometry.PointXYZ import PointXYZ
class Vector1d:
def __init__(self, a: PointXYZ, b: PointXYZ):
self.A = a
self.B = b
def __repr__(self):
return "vecteur AB = ({}, {}, {})".format(
self.B.x - self.A.x,
self.B.y - self.A.y,
self.B.z - self.A.z
)
def vector1d(self):
return np.array([
self.B.x - self.A.x,
self.B.y - self.A.y,
self.B.z - self.A.z
])
def direction_vector(self):
return np.array([
self.B.x - self.A.x,
self.B.y - self.A.y,
0
])
def norm_vector(self):
return np.linalg.norm(self.vector1d())
def norm_direction_vector(self):
return np.linalg.norm(self.direction_vector())
def normalized_direction_vector(self):
return self.direction_vector() / self.norm_direction_vector()