Belle II Software
release-08-01-10
|
The TriangularInterpolation class. More...
Public Member Functions | |
const vector< xy_t > & | getPoints () const |
returns list of verticies | |
const vector< triangle_t > & | getTriangles () const |
returns list of triangles | |
TriangularInterpolation ()=default | |
Default constructor. | |
TriangularInterpolation (vector< xy_t > &pc, vector< triangle_t > &ts, double d) | |
More complex constructor. | |
~TriangularInterpolation ()=default | |
Destructor. | |
void | init (vector< xy_t > &points, vector< triangle_t > &triangles, double d) |
Calculate extents of a triangular mesh and build spatial index. More... | |
xy_t | triangleCenter (const triangle_t &p) const |
Calculate triangle center. More... | |
void | makeIndex (int nx, double xmin, double xmax, int ny, double ymin, double ymax) |
Make spatial index. More... | |
short int | sideCross (short int prev, short int curr, const xy_t &r, const xy_t &v0) const |
Determine which triangle side is crossed by a line segment defined by r and v0 points. More... | |
void | weights (short int i, const xy_t &r, double &w0, double &w1, double &w2) const |
Calculate barycentric coordinates of a point inside triangle. More... | |
short int | findTriangle (const xy_t &r0) const |
Find the triangle which contain the point. More... | |
Protected Attributes | |
vector< triangle_t > | m_triangles |
Triangle list. | |
vector< xy_t > | m_points |
Vertex list. | |
vector< xy_t > | m_triangleCenters |
Triangle centers. | |
vector< double > | m_triangleAreas |
Triangle areas. | |
vector< short int > | m_spatialIndex |
Spatial index. | |
double | m_xmin |
Border of the region where the spatial index is constructed. | |
double | m_xmax |
Border of the region where the spatial index is constructed. | |
double | m_ymin |
Border of the region where the spatial index is constructed. | |
double | m_ymax |
Border of the region where the spatial index is constructed. | |
unsigned int | m_nx |
Spatial index grid size. | |
unsigned int | m_ny |
Spatial index grid size. | |
double | m_ixnorm {1} |
Reciprocals to speedup the index calculation. | |
double | m_iynorm {1} |
Reciprocals to speedup the index calculation. | |
The TriangularInterpolation class.
This class travers triangular meshes which satisfies the Delaunay condition. In other meshes it may give a wrong result. The mesh is represented by a list of triangles coupled to a list of xy-points. To speed up the traverse a sort of spatial index is constructed where on a regular cartesian grid the closeses triangle center is memorized.
Definition at line 61 of file BFieldComponentBeamline.cc.
|
inline |
Find the triangle which contain the point.
If not returns the closest one. First using the spatial index locate triangle close to the point and then traverse the mesh using Delaunay triangulation properties.
r0 | 2d cartesian point |
Definition at line 232 of file BFieldComponentBeamline.cc.
|
inline |
Calculate extents of a triangular mesh and build spatial index.
Moves vector contents inside the class.
points | List of verticies |
triangles | List of triangles |
d | Hint how close spatial index should be built |
Definition at line 88 of file BFieldComponentBeamline.cc.
|
inline |
Make spatial index.
nx | Grid size in X axis |
xmin | Low border on in X |
xmax | Upper border on in X |
ny | Grid size in Y axis |
ymin | Low border on in Y |
ymax | Upper border on in Y |
Definition at line 136 of file BFieldComponentBeamline.cc.
|
inline |
Determine which triangle side is crossed by a line segment defined by r and v0 points.
prev | Triangle number which has been already checked |
curr | Triangle number which is being checked |
r | Starting point of the line segment |
v0 | Ending point of the line segment |
Definition at line 181 of file BFieldComponentBeamline.cc.
|
inline |
Calculate triangle center.
p | Triangle |
Definition at line 120 of file BFieldComponentBeamline.cc.
|
inline |
Calculate barycentric coordinates of a point inside triangle.
i | Triangle index in the list |
r | 2d cartesian point |
w0 | Weight of 0 vertex |
w1 | Weight of 1 vertex |
w2 | Weight of 2 vertex |
Definition at line 211 of file BFieldComponentBeamline.cc.