Pathfinder
Intersection.h
Go to the documentation of this file.
1 
10 #ifndef INTERSECTION_H
11 #define INTERSECTION_H
12 
13 #include <boost/optional/optional_io.hpp>
14 
15 #include "Plane.h"
16 #include "Line2.h"
17 #include "Line3Norm.h"
18 #include "Line3Unnorm.h"
19 
20 namespace Pathfinder {
21 
34  float
35  t(
36  const Plane& p,
37  const Geometry::Vec3& p1,
38  const Geometry::Vec3& p2
39  );
40 
41 
60  std::tuple<std::vector<short>,
61  std::vector<short>,
62  std::vector<short>,
63  std::vector<short>,
64  std::vector<short>>
66  const std::tuple<float, float, float, float, float, float>& tValues
67  );
68 
69 
82  short
84  const std::tuple<std::vector<short>,
85  std::vector<short>,
86  std::vector<short>,
87  std::vector<short>,
88  std::vector<short>>& categorizedtValueIndices
89  );
90 
91 
106  std::tuple<short, short>
108  const short& id
109  );
110 
111 
124  short
126  const std::tuple<short, short>& e
127  );
128 
129 
144  short
146  const short& id
147  );
148 
149 
174  std::tuple<bool, bool, bool>
176  Geometry::Vec2& pi,
177  Geometry::Vec2& pj,
178  const std::tuple<boost::optional<float>,
179  boost::optional<float>,
180  boost::optional<float>>& intersections,
181  const std::tuple<Line2, Line2, Line2>& tri,
182  const std::tuple<bool, bool, bool>& centerAbove
183  );
184 
185 
205  boost::optional<short>
207  const std::tuple<Line2, Line2, Line2>& tri,
208  const std::tuple<boost::optional<float>,
209  boost::optional<float>,
210  boost::optional<float>>& intersections,
211  const std::tuple<bool, bool, bool>& valid,
212  Geometry::Vec2& pjFlat
213  );
214 
215 
231  float
233  const Line3& lij,
234  const short& droppedCoord,
235  const float& pointX,
236  const float& pointY
237  );
238 
239 
256  boost::optional<Geometry::Vec3>
258  const Geometry::Vec3& pi,
259  const Geometry::Vec3& pj,
260  const short& droppedCoord,
261  const std::vector<bool>& inside,
262  const std::tuple<Line2, Line2, Line2>& tri
263  );
264 
265 
282  std::vector<std::vector<boost::optional<Geometry::Vec3>>>
284  const std::vector<Geometry::Vec3>& tri,
285  const std::vector<std::vector<Geometry::Vec3>>& intersections
286  );
287 
288 
304  std::tuple<float, float, float, float, float, float>
306  const Plane& p,
307  const Polygon* tri
308  );
309 
310 
322  std::vector<uint32_t>
324  MeshAccessor* ma,
325  AABB aabb
326  );
327 
328 
344  std::vector<Geometry::Vec3>
346  Polygon* tri,
347  const std::tuple<float, float, float, float, float, float>& tValues,
348  const std::tuple<std::vector<short>,
349  std::vector<short>,
350  std::vector<short>,
351  std::vector<short>,
352  std::vector<short>>& categorizedtValueIndices
353  );
354 
355 
373  std::vector<Geometry::Vec3>
375  const Polygon* tri,
376  const std::tuple<float, float, float, float, float, float>& tValues,
377  const std::tuple<std::vector<short>,
378  std::vector<short>,
379  std::vector<short>,
380  std::vector<short>,
381  std::vector<short>>& categorizedtValueIndices
382  );
383 
384 
397  Geometry::Vec3
399  const Polygon* tri,
400  const short& vertexOnPlane,
401  const std::tuple<float, float, float, float, float, float>& tValues
402  );
403 
404 
417  std::vector<Geometry::Vec3>
419  Polygon* tri,
420  const std::tuple<std::vector<short>,
421  std::vector<short>,
422  std::vector<short>,
423  std::vector<short>,
424  std::vector<short>>& categorizedtValueIndices
425  );
426 
427 
436  std::vector<std::tuple<Graph*, Graph*, std::vector<Geometry::Vec3>>>
437  intersection(
438  Graph* smaller,
439  Graph* bigger
440  );
441 
442 
443 }
444 
445 #endif
short determineIntersectionCase(const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> &categorizedtValueIndices)
Determine which intersection case should be considered for the computed t values. ...
Definition: Intersection.cpp:83
boost::optional< Geometry::Vec3 > cutPointToPolygon(const Geometry::Vec3 &pi, const Geometry::Vec3 &pj, const short &droppedCoord, const std::vector< bool > &inside, const Polygon *tri, const std::tuple< Line2, Line2, Line2 > &triLines, const std::tuple< short, short, short > &relPosCenter)
Definition: Intersection.cpp:316
This file declares the struct Plane that represents a plane in three-dimensional space.
std::tuple< short, short > tIndex2endpoints(const short &id)
Translate the index of the tValues vector to the endpoints which were involved in the t value computa...
Definition: Intersection.cpp:108
short endpoints2tIndex(const std::tuple< short, short > &e)
Translate a pair of endpoint indices into the corresponding index of the tValue vector.
Definition: Intersection.cpp:122
std::tuple< float, float, float, float, float, float > computetValues(const Plane &p, const Polygon *tri)
Given a plane and a polygon, compute the six possible t values.
Definition: Intersection.cpp:485
Definition: AABB.cpp:21
boost::optional< short > chooseIntersection(const std::tuple< Line2, Line2, Line2 > &tri, const std::tuple< boost::optional< float >, boost::optional< float >, boost::optional< float >> &intersections, const std::tuple< bool, bool, bool > &valid, Geometry::Vec2 &pjFlat)
When moving a point on an intersection line, determine which intersection to use as a new endpoint...
Definition: Intersection.cpp:225
std::vector< uint32_t > polygonInAABBIds(MeshAccessor *ma, AABB aabb)
Compute which polygons of the mesh managed by ma intersect with the AABB aabb.
Definition: Intersection.cpp:498
std::vector< Geometry::Vec3 > handleIntersectionCase1(Polygon *tri, const std::tuple< float, float, float, float, float, float > &tValues, const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> &categorizedtValueIndices)
Do the necessary computations to obtain the intersection endpoints for intersection case 1...
Definition: Intersection.cpp:517
Geometry::Vec3 handleIntersectionCase2ii(const Polygon *tri, const short &vertexOnPlane, const std::tuple< float, float, float, float, float, float > &tValues)
Do the necessary computations to obtain the additional intersection endpoint for intersection case 2i...
Definition: Intersection.cpp:630
short getEquivalenttValueIndex(const short &id)
For a given index of the tValues tuple, return the index of the tValues tuple which contains the t va...
Definition: Intersection.cpp:145
float t(const Plane &p, const Geometry::Vec3 &p1, const Geometry::Vec3 &p2)
Compute the t value for a plane and two points that form a line.
Definition: Intersection.cpp:30
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, GraphVertex, GraphEdge > Graph
Shorthand notation for the graph used.
Definition: Using.h:42
std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 > > > intersection(Graph *smaller, Graph *bigger)
Compute the intersection between the meshes.
Definition: Intersection.cpp:707
std::vector< std::vector< Geometry::Vec3 > > cutPlaneIntersectionsToPolygon(const Polygon *tri, const std::vector< std::vector< Geometry::Vec3 >> &intersections)
Definition: Intersection.cpp:374
This file declares the struct Line2 that represents a two-dimensional line.
std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short > > categorizetValueIndices(const std::tuple< float, float, float, float, float, float > &tValues)
Sort each computed t into a tuple of vectors where each vector corresponds to one specific interval...
Definition: Intersection.cpp:45
This file declares the struct Line3Norm that inherits from Line3.
std::vector< Geometry::Vec3 > handleIntersectionCase3(Polygon *tri, const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> &categorizedtValueIndices)
Do the necessary computations to obtain the intersection endpoints for intersection case 3...
Definition: Intersection.cpp:669
std::vector< Geometry::Vec3 > handleIntersectionCase2(const Polygon *tri, const std::tuple< float, float, float, float, float, float > &tValues, const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> &categorizedtValueIndices)
Do the necessary computations to obtain the intersection endpoints for intersection case 2...
Definition: Intersection.cpp:565
float distanceToNewPoint(const Line3Norm &lij, const short &droppedCoord, const float &pointX, const float &pointY)
Definition: Intersection.cpp:261
std::tuple< bool, bool, bool > intersectionTupleValid(Geometry::Vec2 &pi, Geometry::Vec2 &pj, const std::tuple< boost::optional< float >, boost::optional< float >, boost::optional< float >> &intersections, const std::tuple< Line2, Line2, Line2 > &tri, const std::tuple< short, short, short > &relPosCenter)
Definition: Intersection.cpp:159
This file declares the struct Line3Unnorm that inherits from Line3.