Sweetspot module
ray
A ray \(R\) in three-dimensional space ( \(\mathbb{R}^3\) ).
Author: Audun Skau Hansen (audunsh4@gmail.com), 2022
Defined as the set of all points \(\mathbf{P}\) on a line segment extending to infinity from the cartesian origin vector \(\mathbf{O}\) in the normalized direction \(\mathbf{D}\): $$ \mathbf{P} = \mathbf{O} + a \mathbf{D}, ag{1} $$ where \(a\) is a real, positive number.
| Arguments | Description |
|---|---|
| origin | a 3-component numpy-array defining the rays origin |
| direction | a 3-component numpy array defining the direction of the ray (will be normalized automatically) |
Source code in sweetspot/core.py
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 | |
get_point_at(a)
Returns the point:
Source code in sweetspot/core.py
26 27 28 29 30 31 32 33 34 | |
triangle
A triangle in three-dimensional space ( \(\mathbb{R}^3\) ).
Author: Audun Skau Hansen (audunsh4@gmail.com), 2022
| Arguments | Description |
|---|---|
| x1,x2,x3 | 3-component numpy-arrays defining the vertices of the triangle |
Source code in sweetspot/core.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
compute_area(points=None)
Computes the area of the triangle.
Source code in sweetspot/core.py
69 70 71 72 73 74 75 76 77 | |
compute_barycentric_coordinates(point)
Compute the barycentric coordinates of point, assuming it is on the plane spanned by triangle using Cramer's rule [http://lavalle.pl/vr/node206.html]
Source code in sweetspot/core.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
compute_barycentric_coordinates_area(point)
Compute the barycentric coordinates of point, assuming it is on the plane spanne by triangle using the area method [https://en.wikipedia.org/wiki/Barycentric_coordinate_system#Barycentric_coordinates_on_triangles]
Source code in sweetspot/core.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
compute_distance_to_origin()
Compute distance from (0,0,0) to the plane spanned by the triangle.
Source code in sweetspot/core.py
57 58 59 60 61 | |
compute_edge_vector(i, j)
Computes the edge-vector between vertex \(i\) and \(j\).
Source code in sweetspot/core.py
63 64 65 66 67 | |
compute_norm()
computes the norm (normalized) of the triangle
Source code in sweetspot/core.py
50 51 52 53 54 55 | |
get_corner(i)
Returns the corner \(i\).
Source code in sweetspot/core.py
123 124 125 126 127 | |