Pathfinder
|
Classes | |
struct | AABB |
This struct models an AABB. More... | |
struct | GraphEdge |
This struct declares all infromation that shall be stored for each edge of a graph. More... | |
struct | GraphVertex |
This struct declares all infroamtion that shall be stored for each vertex of a graph. More... | |
struct | Line2 |
This struct represents a vertical 2D line or a line of the form y = mx + b. More... | |
struct | Line3 |
This struct represents a 3D line of the form u = v + rw. More... | |
struct | Line3Norm |
This struct represents a line of the form u = v + rw where w is normalized to length 1. More... | |
struct | Line3Unnorm |
This struct represents a line of the form u = v + rw where ||w|| = 1 does not neccessarily hold. More... | |
class | MeshAccessor |
This class is used to simplify the accessing of meshes, their vertices and polygons. More... | |
struct | Octree |
This struct implements the octree data structure. More... | |
struct | Plane |
This struct models a plane of the form ax + by + cz + d = 0. More... | |
struct | Polygon |
A struct that represents a single polygon. More... | |
Typedefs | |
typedef std::function< void(EScript::Namespace *lib)> | EScriptInitFunction_t |
using | Graph = boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, GraphVertex, GraphEdge > |
Shorthand notation for the graph used. More... | |
using | Vertex = boost::graph_traits< Graph >::vertex_descriptor |
Shorthand notation for the graph vertices. More... | |
using | Edge = boost::graph_traits< Graph >::edge_descriptor |
Shorthand notation for the graph edges. More... | |
Enumerations | |
enum | relativePosition : short { below, online, above, below, online, above } |
Easier description of a point being above, below or on a line. More... | |
enum | relativePosition : short { below, online, above, below, online, above } |
enum | drivable : short { person, bicycle, car, truck, none } |
This indicates the passability of edges. More... | |
enum | coordinate : short { x, y, z } |
Easier notation of coordinates. More... | |
Functions | |
bool | AABBintersection (const AABB &a, const AABB &b) |
Check if two AABBs intersect. More... | |
std::string | createOutputDirs () |
Create a directory where all output is written to. More... | |
std::vector< Graph * > | sceneAnalysis (const MinSG::ListNode &root) |
Perform the static analysis of the scene. More... | |
boost::optional< Vertex > | nextSuccessor (const Graph *graph, const Vertex &v, const Vertex &goal, const short &agent, const std::vector< Vertex > &considered) |
This function yields the next vertex that shall be processed by A*. More... | |
float | cost (const Graph *graph, const Vertex &ni, const Vertex &nj) |
Return the edge weight of the edge {ni, nj} in graph. More... | |
std::vector< Vertex > | astar (const Graph *graph, const Vertex &start, const Vertex &goal, const short &agent) |
Find a path from start to goal using A*. More... | |
std::vector< MinSG::GeometryNode * > | extractGeometryNodes (const MinSG::ListNode &root) |
Build a list of all GeometryNodes in the scene graph. More... | |
std::vector< MeshAccessor * > | createMeshAccessors (const std::vector< MinSG::GeometryNode * > &nodes) |
Create MeshAccessor objects for the given GeometryNodes. More... | |
short | determineDrivability (const Geometry::Vec3 &v, const Geometry::Vec3 &w) |
Determine which agent is able to traverse the direct connection between the two points. More... | |
std::vector< Graph * > | buildGraphList (const std::vector< MinSG::GeometryNode * > &nodes, const std::vector< MeshAccessor * > &meshAccessors) |
Build a graph for every mesh of a scene graph. More... | |
bool | allVisited (const std::vector< bool > &boolVec) |
Check whether all entries in boolVec are true. More... | |
size_t | getNextUnvisited (const std::vector< bool > &boolVec) |
Search in boolVec for the first value equal to false and return its index. More... | |
std::vector< std::vector< Graph * > > | buildGroups (const std::vector< MinSG::GeometryNode * > &nodes, const std::vector< Graph * > &graphList) |
Compute the groups of possibly intersecting meshes. More... | |
bool | compareSmallerVec3 (const Geometry::Vec3 &l, const Geometry::Vec3 &r) |
Compare two Vec3 instances for a lexicographic < relation. More... | |
bool | compareEqualVec3 (const Geometry::Vec3 &l, const Geometry::Vec3 &r) |
Compare two Vec3 instances for equality. More... | |
bool | compareSmallerEqualVec3 (const Geometry::Vec3 &l, const Geometry::Vec3 &r) |
Compare two Vec3 instances for a lexicographic <= relation. More... | |
bool | compareSmallerVec3Tuple (const std::tuple< Geometry::Vec3, Geometry::Vec3 > &l, const std::tuple< Geometry::Vec3, Geometry::Vec3 > &r) |
Compare two tuples that contain Vec3 instances, for a lexicographic < relation. More... | |
bool | compareEqualVec3Tuple (const std::tuple< Geometry::Vec3, Geometry::Vec3 > &l, const std::tuple< Geometry::Vec3, Geometry::Vec3 > &r) |
Compare two tuples that contain Vec3 instances, for equality. More... | |
bool | compareSmallerVec3TupleTuple (const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> &l, const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> &r) |
Compare two tuples which contain tuples, for a lexicographic < relation. More... | |
bool | compareEqualVec3TupleTuple (const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> &l, const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> &r) |
Compare two tuples which contain tulpes, for equality. More... | |
bool | compareEqualFloat (const float &l, const float &r) |
Compare two float values for equality. More... | |
bool | compareSmallerFloat (const float &l, const float &r) |
Compare two float values for a < relation. More... | |
bool | registerEScriptInit (const EScriptInitFunction_t &initFn) |
Register the initializer method. More... | |
short | coordToDrop (const Polygon *tri) |
Decide which coordinate shall be dropped for flattening this polygon. More... | |
std::tuple< Geometry::Vec2, Geometry::Vec2, Geometry::Vec2 > | flattenTri (const Polygon *tri, const short &coord) |
Flatten the given polygon onto the xy/xz/yz plane. More... | |
Geometry::Vec2 | flattenVec3 (const Geometry::Vec3 &a, const short &coord) |
Flatten the given vector onto the xy/xz/yz plane. More... | |
std::tuple< short, short, short > | determineRelativePos (Geometry::Vec2 point, const std::tuple< Line2, Line2, Line2 > &tri) |
Determine the relative position of a point to three lines. More... | |
std::vector< bool > | pointVecInsideTri (const std::vector< Geometry::Vec3 > &pointVec, const std::tuple< Line2, Line2, Line2 > &tri, const short &droppedCoord, const std::tuple< short, short, short > &relPosCenter) |
For a vector of points in three-dimensional space, determine if the inidividual points lie inside or outside a polygon. More... | |
std::vector< bool > | pointVecInsideTri (const std::vector< Geometry::Vec2 > &pointVec, const std::tuple< Line2, Line2, Line2 > &tri, const std::tuple< short, short, short > &relPosCenter) |
For a vector of points in two-dimensional space, determine if the individual points lie inside or outside a polygon. More... | |
bool | pointInsideTri (const Geometry::Vec3 &point, const std::tuple< Line2, Line2, Line2 > &tri, const short &droppedCoord, const std::tuple< short, short, short > &relPosCenter) |
For a point in three-dimensional space, determine if it lies inside or outside a given polygon. More... | |
bool | pointInsideTri (const Geometry::Vec2 &point, const std::tuple< Line2, Line2, Line2 > &tri, const std::tuple< short, short, short > &relPosCenter) |
For a point in two-dimensional space, determine if it lies inside or outside a given polygon. More... | |
bool | pointInRectangle (Geometry::Vec2 &p, Geometry::Vec2 &lowerLeft, Geometry::Vec2 &upperRight) |
Given a rectangle defined by two points, check if p lies inside it. More... | |
std::tuple< Geometry::Vec2, Geometry::Vec2 > | buildRectangle (Geometry::Vec2 &pi, Geometry::Vec2 &pj) |
Given two points, construct a tuple of points that describe the lower left and upper right corner of the rectangle defined by the two points. More... | |
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. More... | |
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. More... | |
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. More... | |
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 computation. More... | |
short | endpoints2tIndex (const std::tuple< short, short > &e) |
Translate a pair of endpoint indices into the corresponding index of the tValue vector. More... | |
short | getEquivalenttValueIndex (const short &id) |
For a given index of the tValues tuple, return the index of the tValues tuple which contains the t value that was comuputed by the same vertices but in reverse order. More... | |
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) |
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. More... | |
float | distanceToNewPoint (const Line3Norm &lij, const short &droppedCoord, const float &pointX, const float &pointY) |
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) |
std::vector< std::vector< Geometry::Vec3 > > | cutPlaneIntersectionsToPolygon (const Polygon *tri, const std::vector< std::vector< Geometry::Vec3 >> &intersections) |
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. More... | |
std::vector< uint32_t > | polygonInAABBIds (MeshAccessor *ma, AABB aabb) |
Compute which polygons of the mesh managed by ma intersect with the AABB aabb. More... | |
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. More... | |
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. More... | |
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 2ii. More... | |
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. More... | |
std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 > > > | intersection (Graph *smaller, Graph *bigger) |
Compute the intersection between the meshes. More... | |
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< bool, bool, bool > ¢erAbove) |
For a given tuple of found intersections, determine if these are valid. More... | |
float | distanceToNewPoint (const Line3 &lij, const short &droppedCoord, const float &pointX, const float &pointY) |
When calculating the point on a line that corresponds to a 2D point, determine the distance this new point has from the support vector of the line. More... | |
boost::optional< Geometry::Vec3 > | cutPointToPolygon (const Geometry::Vec3 &pi, const Geometry::Vec3 &pj, const short &droppedCoord, const std::vector< bool > &inside, const std::tuple< Line2, Line2, Line2 > &tri) |
For a given polygon and a pair of endpoints, determine a new endpoint for this intersection line which lies inside tri. More... | |
std::vector< std::vector< boost::optional< Geometry::Vec3 > > > | cutPlaneIntersectionsToPolygon (const std::vector< Geometry::Vec3 > &tri, const std::vector< std::vector< Geometry::Vec3 >> &intersections) |
For a given polygon and a list of intersections with the plane defined by that polygon, edit these intersections to fit the size of the actual polygon. More... | |
boost::optional< float > | line2Intersection (const Line2 &a, const Line2 &b) |
Compute the x value of the intersection of two lines. More... | |
std::vector< std::pair< Vertex, Graph * > > | determineMergePoints (const Geometry::Vec3 &p, Graph *graphA, Graph *graphB, const Octree *octree, AABB &aabb) |
Get the points to which a intersection point shall be connected. More... | |
Graph * | merge (const std::vector< Graph * > &group, Octree *octree) |
Create one big graph out of the given group. More... | |
bool | operator== (const MeshAccessor &l, const MeshAccessor &r) |
Overload operator==. More... | |
std::tuple< size_t, size_t, size_t > | getOBJIndices (const std::list< Geometry::Vec3 > &vertices, const Geometry::Vec3 &a, const Geometry::Vec3 &b, const Geometry::Vec3 &c) |
Given three points, get their names for an OBJ file. More... | |
void | writeOBJFromMesh (const MinSG::GeometryNode *geoNodePtr, const std::string &path) |
Go through the mesh associated with geoNodePtr and print the appropriate OBJ commands. More... | |
void | writeOBJFromGraph (const Graph *graph, const std::string &path) |
Go through graph and output appropriate OBJ commands. More... | |
void | appendPointcloudOBJFile (const std::vector< Geometry::Vec3 > &points, const std::string &path) |
Given a list of points, append all of these points onto the file at location path. More... | |
void | writeIntersectionOBJFiles (const std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 >> > &intersections, const std::string &path) |
void | writeIntersectionOBJFiles (const std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 >>> &intersections, const std::string &path) |
Given a list of intersections, write all convex hulls of the intersections to OBJ files at the specified path. More... | |
Octree * | createOctree (const std::vector< Graph * > &graphList) |
Given the output of buildGraphList, create an octree containing all polygons and vertices. More... | |
void | printOctree (const Octree *octree, const std::string &indent) |
Output a graphical representation of an octree to the console. More... | |
void | disableOutput () |
Prevents any output from being printed onto the terminal. More... | |
void | enableOutput () |
Permits all output to be printed onto the terminal. More... | |
void | disableLogging () |
Prevents the creation of log files. More... | |
void | enableLogging () |
Permits the creation of log files. More... | |
void | createLoggers (const std::string &dir) |
Create all logger objects used throughout the code. More... | |
void | disableOBJ () |
Prevent any OBJ files from being created. More... | |
boost::optional< std::pair< Vertex, Vertex > > | findStartGoal (const Geometry::Vec3 &start, const Geometry::Vec3 &goal, const Graph *graph) |
Given 2 points in 3D space, approximate these points by nodes in the graph while adhering to a maximum distance threshold. More... | |
EScript::Array * | findPath (const MinSG::ListNode &root, const Geometry::Vec3 &start, const Geometry::Vec3 &goal, const short &agent) |
Do the scene analysis and pathfinding. More... | |
void | sortSizeTTuple (std::tuple< size_t, size_t, size_t > &t) |
TODO. More... | |
void | sortVec3Tuple (std::tuple< Geometry::Vec3, Geometry::Vec3 > &t) |
TODO. More... | |
void | sortVec3TupleTuple (std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 > > &t) |
void | sortVec3TupleTuple (std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> &t) |
TODO. More... | |
float | gettValue (const std::tuple< float, float, float, float, float, float > &tValues, const short &idx) |
Access the element at index idx. More... | |
std::vector< short > | gettValueIndexCategoryVector (const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> &categorizedtValueIndices, const short &idx) |
Access the element at index idx. More... | |
Line2 | getLine2 (const std::tuple< Line2, Line2, Line2 > &lines, const short &idx) |
Access the element at index idx. More... | |
bool * | getBoolPtr (std::tuple< bool, bool, bool > &boolTuple, const short &idx) |
Access the element at index idx and return a pointer to it. More... | |
short * | getShortPtr (std::tuple< short, short, short > &shortTuple, const short &idx) |
Access the element at index idx and return a pointer to it. More... | |
boost::optional< float > | getOptionalFloat (const std::tuple< boost::optional< float >, boost::optional< float >, boost::optional< float >> &optionalFloatTuple, const short &idx) |
Access the element at index idx. More... | |
bool | getBool (const std::tuple< bool, bool, bool > &boolTuple, const short &idx) |
Access the element at index idx. More... | |
Geometry::Vec3 | getTriVertex (const std::tuple< Geometry::Vec3, Geometry::Vec3, Geometry::Vec3 > &tri, const short &idx) |
Access the vertex at index idx. More... | |
Geometry::Vec2 | getFlatTriVertex (const std::tuple< Geometry::Vec2, Geometry::Vec2, Geometry::Vec2 > &tri, const short &idx) |
Access the vertex at index idx. More... | |
const std::string | red ("\3[0;31m") |
Color definition for prettier console output. More... | |
const std::string | green ("\3[1;32m") |
Color definition for prettier console output. More... | |
const std::string | yellow ("\3[1;33m") |
Color definition for prettier console output. More... | |
const std::string | cyan ("\3[0;36m") |
Color definition for prettier console output. More... | |
const std::string | magenta ("\3[0;35m") |
Color definition for prettier console output. More... | |
const std::string | reset ("\3[0m") |
Color definition for prettier console output. More... | |
Geometry::Vec3 | crossProduct (const Geometry::Vec3 &a, const Geometry::Vec3 &b) |
Compute the cross product of two vectors. More... | |
float | dotProduct (const Geometry::Vec3 &a, const Geometry::Vec3 &b) |
Compute the dot product of two vectors. More... | |
Geometry::Vec3 | scalarMultiplication (const float &a, const Geometry::Vec3 &b) |
Scale a vector by a scalar. More... | |
bool | operator< (const Geometry::Vec3 &l, const Geometry::Vec3 &r) |
Overload operator<. More... | |
float | distance2 (Geometry::Vec2 &p1, Geometry::Vec2 &p2) |
Compute the euclidean distance between two points in 2D. More... | |
float | distance3 (const Geometry::Vec3 &v1, const Geometry::Vec3 &v2) |
Compute the euclidean distance between two nodes. More... | |
Variables | |
const short | threshold = 10 |
If this threshold is reached, stop octree recursion. More... | |
bool | objOutput = true |
Indicate whether OBJ files shall be created. More... | |
const float | allowedStartEndDistance = 5 |
using Pathfinder::Edge = typedef boost::graph_traits<Graph>::edge_descriptor |
Shorthand notation for the graph edges.
typedef std::function<void (EScript::Namespace* lib)> Pathfinder::EScriptInitFunction_t |
using Pathfinder::Graph = typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, GraphVertex, GraphEdge> |
Shorthand notation for the graph used.
using Pathfinder::Vertex = typedef boost::graph_traits<Graph>::vertex_descriptor |
Shorthand notation for the graph vertices.
enum Pathfinder::coordinate : short |
enum Pathfinder::drivable : short |
enum Pathfinder::relativePosition : short |
enum Pathfinder::relativePosition : short |
bool Pathfinder::allVisited | ( | const std::vector< bool > & | boolVec | ) |
Check whether all entries in boolVec are true.
boolVec | A vector of boolean values. |
void Pathfinder::appendPointcloudOBJFile | ( | const std::vector< Geometry::Vec3 > & | points, |
const std::string & | path | ||
) |
Given a list of points, append all of these points onto the file at location path.
points | A vector which contains the points that shall be written to a file. |
path | The path to OBJ file. |
std::vector< Vertex > Pathfinder::astar | ( | const Graph * | graph, |
const Vertex & | start, | ||
const Vertex & | goal, | ||
const short & | agent | ||
) |
Find a path from start to goal using A*.
This path must be passable by agent.
This is the IDA* algorithm presented in 4.4.
graph | A pointer to the graph that is worked on. |
start | The vertex description of the starting point. |
goal | The vertex description of the goal point. |
agent | The agent that shall traverse the graph. |
std::vector< Graph * > Pathfinder::buildGraphList | ( | const std::vector< MinSG::GeometryNode * > & | nodes, |
const std::vector< MeshAccessor * > & | meshAccessors | ||
) |
Build a graph for every mesh of a scene graph.
Given a list of GeometryNodes, get the meshes stored in them and convert these meshes into graphs. This is done by taking the vertices of the mesh and translating them into the vertices of a graph. The edges of the graph correspond to the connections of the mesh's vertices that form the polygons.
nodes | A vector of pointers to the GeometryNodes of the scene graph. |
meshAccessors | A vector of pointers to the MeshAccessors created for the GeometryNodes of nodes. |
std::vector< std::vector< Graph * > > Pathfinder::buildGroups | ( | const std::vector< MinSG::GeometryNode * > & | nodes, |
const std::vector< Graph * > & | graphList | ||
) |
Compute the groups of possibly intersecting meshes.
Two meshes have the possibility of intersection of their AABBs intersect. If the AABBs of A and B and the AABBs of B and C intersect, A, B, and C all end up in the same group.
nodes | A vector of pointers to GeometryNodes. |
graphList | A vector of pointers to graphs. |
std::tuple< Geometry::Vec2, Geometry::Vec2 > Pathfinder::buildRectangle | ( | Geometry::Vec2 & | pi, |
Geometry::Vec2 & | pj | ||
) |
Given two points, construct a tuple of points that describe the lower left and upper right corner of the rectangle defined by the two points.
A rectangle can be defined by any two points. This function computes two points that define the same rectangle but are the lower left and upper right corner of the rectangle.
pi | The first point. |
pj | The second point. |
std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short > > Pathfinder::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.
Each vector stores the indices of those values in tValues which fall into the interval represented by that vector. The intervals are: 0 = (-infinity,0), 1 = [0,0], 2 = (0,1), 3 = [1,1], 4 = (1,infinity).
tValues | A vector of 6 elements which contains the computed t values for one poylgon. |
boost::optional< short > Pathfinder::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.
This point should be the intersection which is valid and the closest to the point which shall be moved.
tri | The current polygon described by a tuple of bounding lines. |
intersections | A tuple that contains the computed intersections of an intersection line with tri. |
valid | A tuple that indicates which of the intersections in intersections are valid. |
pjFlat | The flattened version of the point that is to be moved. |
bool Pathfinder::compareEqualFloat | ( | const float & | l, |
const float & | r | ||
) |
Compare two float values for equality.
The given values are not compared by the use of ==. This function computes the distance of l and r and checks if this lies within some epsilon. If so, the two values are considered equal.
l | The first float value. |
r | The second float value. |
bool Pathfinder::compareEqualVec3 | ( | const Geometry::Vec3 & | l, |
const Geometry::Vec3 & | r | ||
) |
Compare two Vec3 instances for equality.
Two Vec3s are equal if their contents are the same.
l | The first Vec3. |
r | The second Vec3. |
bool Pathfinder::compareEqualVec3Tuple | ( | const std::tuple< Geometry::Vec3, Geometry::Vec3 > & | l, |
const std::tuple< Geometry::Vec3, Geometry::Vec3 > & | r | ||
) |
Compare two tuples that contain Vec3 instances, for equality.
Two such tuples are equal if their contents are the same.
l | The first tuple. |
r | The second tuple. |
bool Pathfinder::compareEqualVec3TupleTuple | ( | const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> & | l, |
const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> & | r | ||
) |
Compare two tuples which contain tulpes, for equality.
Two such tuples are equal if their contents are the same.
l | The first tuple. |
r | The second tuple. |
bool Pathfinder::compareSmallerEqualVec3 | ( | const Geometry::Vec3 & | l, |
const Geometry::Vec3 & | r | ||
) |
Compare two Vec3 instances for a lexicographic <= relation.
l | The first Vec3. |
r | The second Vec3. |
bool Pathfinder::compareSmallerFloat | ( | const float & | l, |
const float & | r | ||
) |
Compare two float values for a < relation.
This function first checks if l and r are the same by the use of compareEqualFloat. If so, this function returns false. Otherwise it returns what is returned by l < r.
l | The first float value. |
r | The second float value. |
bool Pathfinder::compareSmallerVec3 | ( | const Geometry::Vec3 & | l, |
const Geometry::Vec3 & | r | ||
) |
Compare two Vec3 instances for a lexicographic < relation.
l | The first Vec3. |
r | The second Vec3. |
bool Pathfinder::compareSmallerVec3Tuple | ( | const std::tuple< Geometry::Vec3, Geometry::Vec3 > & | l, |
const std::tuple< Geometry::Vec3, Geometry::Vec3 > & | r | ||
) |
Compare two tuples that contain Vec3 instances, for a lexicographic < relation.
l | The first tuple. |
r | The second tuple. |
bool Pathfinder::compareSmallerVec3TupleTuple | ( | const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> & | l, |
const std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> & | r | ||
) |
Compare two tuples which contain tuples, for a lexicographic < relation.
l | The first tuple. |
r | The second tuple. |
std::tuple< float, float, float, float, float, float > Pathfinder::computetValues | ( | const Plane & | p, |
const Polygon * | tri | ||
) |
Given a plane and a polygon, compute the six possible t values.
p | The plane. |
tri | The polygon. |
short Pathfinder::coordToDrop | ( | const Polygon * | tri | ) |
Decide which coordinate shall be dropped for flattening this polygon.
The component that shall be dropped is the component that has the greatest absolut value in the normal vector of the polygon.
tri | The polygon. |
Return the edge weight of the edge {ni, nj} in graph.
graph | A pointer to the graph that is worked on. |
ni | The first endpoint of the edge. |
nj | The second endpoint of the edge. |
void Pathfinder::createLoggers | ( | const std::string & | dir | ) |
Create all logger objects used throughout the code.
dir | The directory where the log files shall be written to. |
std::vector< MeshAccessor * > Pathfinder::createMeshAccessors | ( | const std::vector< MinSG::GeometryNode * > & | nodes | ) |
Create MeshAccessor objects for the given GeometryNodes.
Go through the list of GeometryNodes and create one MeshAccessor object per node.
nodes | A vector of pointers to GeometryNodes. |
Given the output of buildGraphList, create an octree containing all polygons and vertices.
graphList | The output of the builGraphList function. |
std::string Pathfinder::createOutputDirs | ( | ) |
Create a directory where all output is written to.
This function will create a directory in ../Output. The directory will be named after the current timestamp.
Geometry::Vec3 Pathfinder::crossProduct | ( | const Geometry::Vec3 & | a, |
const Geometry::Vec3 & | b | ||
) |
Compute the cross product of two vectors.
a | The first vector. |
b | The second vector. |
std::vector<std::vector<boost::optional<Geometry::Vec3> > > Pathfinder::cutPlaneIntersectionsToPolygon | ( | const std::vector< Geometry::Vec3 > & | tri, |
const std::vector< std::vector< Geometry::Vec3 >> & | intersections | ||
) |
For a given polygon and a list of intersections with the plane defined by that polygon, edit these intersections to fit the size of the actual polygon.
This might involve discarding intersections or cutting them to the appropriate size.
tri | A polygon defined by three vertices. |
intersections | A vector of vectors which contain the endpoints of the intersections with plane defined by tri. |
std::vector<std::vector<Geometry::Vec3> > Pathfinder::cutPlaneIntersectionsToPolygon | ( | const Polygon * | tri, |
const std::vector< std::vector< Geometry::Vec3 >> & | intersections | ||
) |
boost::optional<Geometry::Vec3> Pathfinder::cutPointToPolygon | ( | const Geometry::Vec3 & | pi, |
const Geometry::Vec3 & | pj, | ||
const short & | droppedCoord, | ||
const std::vector< bool > & | inside, | ||
const std::tuple< Line2, Line2, Line2 > & | tri | ||
) |
For a given polygon and a pair of endpoints, determine a new endpoint for this intersection line which lies inside tri.
pi | The first endpoint of the intersection line. |
pj | The second endpoint of the intersection line. |
droppedCoord | The coordinate that was dropped while flattening the tri. |
inside | The vector which holds the information on which points lie inside tri. |
tri | The current flattened polygon described by three bounding lines. |
boost::optional<Geometry::Vec3> Pathfinder::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 | ||
) |
const std::string Pathfinder::cyan | ( | "\0;36m" | ) |
Color definition for prettier console output.
short Pathfinder::determineDrivability | ( | const Geometry::Vec3 & | v, |
const Geometry::Vec3 & | w | ||
) |
Determine which agent is able to traverse the direct connection between the two points.
Determine the slope of the direct connecton between the two points. Which agent corresponds to which slope is mentioned in the thesis.
v | The first point. |
w | The second point. |
short Pathfinder::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.
Given the computed t values for an intersection, a case distinction can be made. The details are provided in the thesis.
categorizedtValueIndices | A tuple of 5 vectors which shows how many t values fall into which interval. |
std::vector< std::pair< Vertex, Graph * > > Pathfinder::determineMergePoints | ( | const Geometry::Vec3 & | p, |
Graph * | graphA, | ||
Graph * | graphB, | ||
const Octree * | octree, | ||
AABB & | aabb | ||
) |
Get the points to which a intersection point shall be connected.
The point p shall be connected to the two nearest points in either graph that are outside the given AABB.
p | The point that shall be connected. |
graphA | The first graph. |
graphB | The second graph. |
octree | An octree that encompasses the whole scene. |
aabb | An AABB that defines a volume where no connections shall be made. |
std::tuple< short, short, short > Pathfinder::determineRelativePos | ( | Geometry::Vec2 | point, |
const std::tuple< Line2, Line2, Line2 > & | tri | ||
) |
Determine the relative position of a point to three lines.
For a given point and a triangle described by three lines in two-dimensional space, compute a tuple which contains the information on whether the given point lies above, on or below the individual bounding lines of the triangle. If a bounding line is vertical, above means that point is right of the line. If the value is set to below, this means that point is left of the line.
point | The point for which it shall be evaluated if it lies above, on or below the individual lines. |
tri | A triangle described by a tuple of three Line2 objects. |
void Pathfinder::disableLogging | ( | ) |
Prevents the creation of log files.
void Pathfinder::disableOBJ | ( | ) |
Prevent any OBJ files from being created.
void Pathfinder::disableOutput | ( | ) |
Prevents any output from being printed onto the terminal.
float Pathfinder::distance2 | ( | Geometry::Vec2 & | p1, |
Geometry::Vec2 & | p2 | ||
) |
Compute the euclidean distance between two points in 2D.
p1 | The first point. |
p2 | The second point. |
float Pathfinder::distance3 | ( | const Geometry::Vec3 & | v1, |
const Geometry::Vec3 & | v2 | ||
) |
Compute the euclidean distance between two nodes.
Given three points in 3D, compute the length of the straight line between the two points.
v1 | The position of the first node. |
v2 | The position of the second node. |
float Pathfinder::distanceToNewPoint | ( | const Line3 & | lij, |
const short & | droppedCoord, | ||
const float & | pointX, | ||
const float & | pointY | ||
) |
When calculating the point on a line that corresponds to a 2D point, determine the distance this new point has from the support vector of the line.
lij | The 3D line for which a distance from the support vector to a point shall be calculated. |
droppedCoord | The component that was dropped while flattening in the current step. |
pointX | The x position of the 2D point. |
pointY | The y position of the 2D point. |
float Pathfinder::distanceToNewPoint | ( | const Line3Norm & | lij, |
const short & | droppedCoord, | ||
const float & | pointX, | ||
const float & | pointY | ||
) |
float Pathfinder::dotProduct | ( | const Geometry::Vec3 & | a, |
const Geometry::Vec3 & | b | ||
) |
Compute the dot product of two vectors.
a | The first vector. |
b | The second vector. |
void Pathfinder::enableLogging | ( | ) |
Permits the creation of log files.
void Pathfinder::enableOutput | ( | ) |
Permits all output to be printed onto the terminal.
short Pathfinder::endpoints2tIndex | ( | const std::tuple< short, short > & | e | ) |
Translate a pair of endpoint indices into the corresponding index of the tValue vector.
Every possible combination of two different vertices of a polygon has a certain index in the t values tuple. This function provides a convenient way to obtain the t value tuple index computed from the two given endpoints.
e | An edge represented by a vector of two endpoint indices. |
std::vector< MinSG::GeometryNode * > Pathfinder::extractGeometryNodes | ( | const MinSG::ListNode & | root | ) |
Build a list of all GeometryNodes in the scene graph.
Given the root node of a scene graph, traverse the scene graph and store all GeometryNodes that have been found in a vector.
root | The root node of the scene graph. |
EScript::Array * Pathfinder::findPath | ( | const MinSG::ListNode & | root, |
const Geometry::Vec3 & | start, | ||
const Geometry::Vec3 & | goal, | ||
const short & | agent | ||
) |
Do the scene analysis and pathfinding.
root | The root node of the scene graph. |
start | The start point of the pathfinding. |
goal | The goal point of the pathfinding. |
agent | The agent that shall be used for pathfinding. |
boost::optional< std::pair< Vertex, Vertex > > Pathfinder::findStartGoal | ( | const Geometry::Vec3 & | start, |
const Geometry::Vec3 & | goal, | ||
const Graph * | graph | ||
) |
Given 2 points in 3D space, approximate these points by nodes in the graph while adhering to a maximum distance threshold.
start | The start point. |
goal | The goal point. |
graph | The graph in which adequate start and goal vertices shall be searched. |
std::tuple< Geometry::Vec2, Geometry::Vec2, Geometry::Vec2 > Pathfinder::flattenTri | ( | const Polygon * | tri, |
const short & | coord | ||
) |
Flatten the given polygon onto the xy/xz/yz plane.
This is done by deleting all coord elements from the polygon's vertices.
tri | The polygon. |
coord | The coordinate which shall be dropped. |
Geometry::Vec2 Pathfinder::flattenVec3 | ( | const Geometry::Vec3 & | a, |
const short & | coord | ||
) |
Flatten the given vector onto the xy/xz/yz plane.
This is done by deleting the coord element from a.
a | The vector to flatten. |
coord | The coordinate which shall be dropped. |
bool Pathfinder::getBool | ( | const std::tuple< bool, bool, bool > & | boolTuple, |
const short & | idx | ||
) |
Access the element at index idx.
boolTuple | The tuple containing tree bool values. |
idx | The index on which access shall be performed. |
bool * Pathfinder::getBoolPtr | ( | std::tuple< bool, bool, bool > & | boolTuple, |
const short & | idx | ||
) |
Access the element at index idx and return a pointer to it.
boolTuple | The tuple containing three bool values. |
idx | The index on which access shall be performed. |
short Pathfinder::getEquivalenttValueIndex | ( | const short & | id | ) |
For a given index of the tValues tuple, return the index of the tValues tuple which contains the t value that was comuputed by the same vertices but in reverse order.
Example: t value 0 and 2 are computed by the same two vertices of a given poylgon. However, the order of vertices is switched in the computations of the two t values.
id | The index of the tValues tuple. |
Geometry::Vec2 Pathfinder::getFlatTriVertex | ( | const std::tuple< Geometry::Vec2, Geometry::Vec2, Geometry::Vec2 > & | tri, |
const short & | idx | ||
) |
Access the vertex at index idx.
tri | A tuple describing a flattened polygon. |
idx | The index on which access shall be performed. |
size_t Pathfinder::getNextUnvisited | ( | const std::vector< bool > & | boolVec | ) |
Search in boolVec for the first value equal to false and return its index.
boolVec | A vector of boolean values. |
std::tuple< size_t, size_t, size_t > Pathfinder::getOBJIndices | ( | const std::list< Geometry::Vec3 > & | vertices, |
const Geometry::Vec3 & | a, | ||
const Geometry::Vec3 & | b, | ||
const Geometry::Vec3 & | c | ||
) |
Given three points, get their names for an OBJ file.
Search through the vertex list and return the indices of the
vertices | A list of all vertices. |
a | The first point. |
b | The second point. |
c | The third point. |
boost::optional< float > Pathfinder::getOptionalFloat | ( | const std::tuple< boost::optional< float >, boost::optional< float >, boost::optional< float >> & | optionalFloatTuple, |
const short & | idx | ||
) |
Access the element at index idx.
optionalFloatTuple | The tuple containing boost::optional<float> values. |
idx | The index on which access shall be performed. |
short * Pathfinder::getShortPtr | ( | std::tuple< short, short, short > & | shortTuple, |
const short & | idx | ||
) |
Access the element at index idx and return a pointer to it.
shortTuple | The tuple containing three short values. |
idx | The index on which access shall be performed. |
Geometry::Vec3 Pathfinder::getTriVertex | ( | const std::tuple< Geometry::Vec3, Geometry::Vec3, Geometry::Vec3 > & | tri, |
const short & | idx | ||
) |
Access the vertex at index idx.
tri | A tuple describing a polygon. |
idx | The index on which access shall be performed. |
float Pathfinder::gettValue | ( | const std::tuple< float, float, float, float, float, float > & | tValues, |
const short & | idx | ||
) |
Access the element at index idx.
tValues | The tValues tuple containing 6 float values. |
idx | The index on which access shall be performed. |
std::vector< short > Pathfinder::gettValueIndexCategoryVector | ( | const std::tuple< std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >, std::vector< short >> & | categorizedtValueIndices, |
const short & | idx | ||
) |
Access the element at index idx.
categorizedtValueIndices | The tuple containing 5 vectors which represent the intervals used for case distinction. |
idx | The index on which access shall be performed. |
const std::string Pathfinder::green | ( | "\1;32m" | ) |
Color definition for prettier console output.
std::vector< Geometry::Vec3 > Pathfinder::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.
tri | The polygon that intersects the current plane. |
tValues | The computed t values for the intersection of tri and the current plane. |
categorizedtValueIndices | The tuple containing the assignment of the indices in the tValues vector to the different value intervals. |
std::vector< Geometry::Vec3 > Pathfinder::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.
This includes the computation of the endpoint that lies on the current plane as well as deciding if case 2i. or 2ii. is present.
tri | The polygon that intersects the current plane. |
tValues | The computed t values for the intersection of tri and the current plane. |
categorizedtValueIndices | The tuple containing the assignment of the indices in the tValues vector to the different value intervals. |
Geometry::Vec3 Pathfinder::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 2ii.
tri | The polygon that intersects the current plane. |
vertexOnPlane | The index of the vertex which lies on the current plane. |
tValues | The computed t values for the intersection of tri and the current plane. |
std::vector< Geometry::Vec3 > Pathfinder::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.
tri | The polygon that intersects the current plane. |
categorizedtValueIndices | The tuple containing the assignment of the indices in the tValues vector to the different value intervals. |
std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 > > > Pathfinder::intersection | ( | Graph * | smaller, |
Graph * | bigger | ||
) |
Compute the intersection between the meshes.
smaller | The smaller mesh. |
bigger | The bigger mesh. |
std::tuple<bool, bool, bool> Pathfinder::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 | ||
) |
std::tuple<bool, bool, bool> Pathfinder::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< bool, bool, bool > & | centerAbove | ||
) |
For a given tuple of found intersections, determine if these are valid.
An intersection is valid if its x position lies between the x positions of the two points pi and pj.
pi | The first endpoint of the common intersection line. |
pj | The second endpoint of the common intersection line. |
intersections | A tuple of three optional values representing the x positions of the intersections of the line through pi and pj and the three bounding lines of the polygon. If an intersection was found, a float value will reside at the corresponding position. If two lines were found to be parallel, a boost::none value will be placed at the corresponding index. |
tri | The triangle with which the intersections were computed. |
centerAbove | A tulpe describing the relative position of the center point of tri to its bounding lines. |
Compute the x value of the intersection of two lines.
a | The first line. |
b | The second line. |
const std::string Pathfinder::magenta | ( | "\0;35m" | ) |
Color definition for prettier console output.
Create one big graph out of the given group.
group | The group whose graphs shall be merged. |
octree | A pointer to the octree that stores all information of the scene. |
boost::optional< Vertex > Pathfinder::nextSuccessor | ( | const Graph * | graph, |
const Vertex & | v, | ||
const Vertex & | goal, | ||
const short & | agent, | ||
const std::vector< Vertex > & | considered | ||
) |
This function yields the next vertex that shall be processed by A*.
The function looks at all incident edges of v. Only those edges that are passable by agent are considered. The function then selects a candidate vertex that was not considered before.
graph | A pointer to the graph that is worked on. |
v | The vertex whose successors shall be found. |
goal | The goal node of the search. |
agent | Only edges that are passable by agent shall be considered. |
considered | A vector containing all already considered vertices. |
bool Pathfinder::operator< | ( | const Geometry::Vec3 & | l, |
const Geometry::Vec3 & | r | ||
) |
Overload operator<.
l | The left operand. |
r | The right operand. |
bool Pathfinder::operator== | ( | const MeshAccessor & | l, |
const MeshAccessor & | r | ||
) |
Overload operator==.
Two MeshAccessor objects are considered the same if both objects describe the same GeometryNode.
l | The left operand. |
r | The right operand. |
bool Pathfinder::pointInRectangle | ( | Geometry::Vec2 & | p, |
Geometry::Vec2 & | lowerLeft, | ||
Geometry::Vec2 & | upperRight | ||
) |
Given a rectangle defined by two points, check if p lies inside it.
The point p lies inside the rectangle if its components are greater or equal to the lower left corner of the rectangle and smaller or equal to the upper right corner of the rectangle.
p | The point which shall be checked. |
lowerLeft | The lower left corner of the rectangle. |
upperRight | The lower left corner of the rectangle. |
bool Pathfinder::pointInsideTri | ( | const Geometry::Vec3 & | point, |
const std::tuple< Line2, Line2, Line2 > & | tri, | ||
const short & | droppedCoord, | ||
const std::tuple< short, short, short > & | relPosCenter | ||
) |
For a point in three-dimensional space, determine if it lies inside or outside a given polygon.
A point lies inside a poylgon, if its relative positions to the polygon's bounding lines are the same as the relative positions of the polygon's center point to the polygon's bounding lines. If a point lies on a bounding line, it can be interpreted either way: as being above or below.
point | The point which is to be checked. |
tri | A polygon described by a tuple of three 2D lines. |
droppedCoord | The component which was dropped in the flattening of tri. |
relPosCenter | A tuple which describes the relative position of the center point of tri to the three bounding lines of tri. |
bool Pathfinder::pointInsideTri | ( | const Geometry::Vec2 & | point, |
const std::tuple< Line2, Line2, Line2 > & | tri, | ||
const std::tuple< short, short, short > & | relPosCenter | ||
) |
For a point in two-dimensional space, determine if it lies inside or outside a given polygon.
A point lies inside a poylgon, if its relative positions to the polygon's bounding lines are the same as the relative positions of the polygon's center point to the polygon's bounding lines. If a point lies on a bounding line, it can be interpreted either way: as being above or below.
point | The point which is to be checked. |
tri | A polygon described by a tuple of three 2D lines. |
relPosCenter | A tuple which describes the relative position of the center point of tri to the three bounding lines of tri. |
std::vector< bool > Pathfinder::pointVecInsideTri | ( | const std::vector< Geometry::Vec3 > & | pointVec, |
const std::tuple< Line2, Line2, Line2 > & | tri, | ||
const short & | droppedCoord, | ||
const std::tuple< short, short, short > & | relPosCenter | ||
) |
For a vector of points in three-dimensional space, determine if the inidividual points lie inside or outside a polygon.
A point lies inside a poylgon, if its relative positions to the polygon's bounding lines are the same as the relative positions of the polygon's center point to the polygon's bounding lines. If a point lies on a bounding line, it can be interpreted either way: as being above or below.
pointVec | A vector of points where each point shall be cheked for its position. |
tri | A polygon described ba a tuple of three 2D lines. |
droppedCoord | The component which was dropped in the flattening of tri. |
relPosCenter | A tuple which describes the relative position of the center point of tri to the three bounding lines of tri. |
std::vector< bool > Pathfinder::pointVecInsideTri | ( | const std::vector< Geometry::Vec2 > & | pointVec, |
const std::tuple< Line2, Line2, Line2 > & | tri, | ||
const std::tuple< short, short, short > & | relPosCenter | ||
) |
For a vector of points in two-dimensional space, determine if the individual points lie inside or outside a polygon.
A point lies inside a poylgon, if its relative positions to the polygon's bounding lines are the same as the relative positions of the polygon's center point to the polygon's bounding lines. If a point lies on a bounding line, it can be interpreted either way: as being above or below.
pointVec | A vector of points where each point shall be cheked for its position. |
tri | A polygon described ba a tuple of three 2D lines. |
relPosCenter | A tuple which describes the relative position of the center point of tri to the three bounding lines of tri. |
std::vector< uint32_t > Pathfinder::polygonInAABBIds | ( | MeshAccessor * | ma, |
AABB | aabb | ||
) |
Compute which polygons of the mesh managed by ma intersect with the AABB aabb.
ma | The MeshAccessor of the mesh whose polygons shall be checked for intersection. |
aabb | The AABB that shall be used for checking intersection. |
void Pathfinder::printOctree | ( | const Octree * | octree, |
const std::string & | indent | ||
) |
Output a graphical representation of an octree to the console.
octree | The octree that shall be printed. |
indent | The indentation that is prepended to every output to signal depth. |
const std::string Pathfinder::red | ( | "\0;31m" | ) |
Color definition for prettier console output.
bool Pathfinder::registerEScriptInit | ( | const EScriptInitFunction_t & | initFn | ) |
Register the initializer method.
Implementation of the 'registerEScriptInit' function declared in 'EScriptHelper.h'.
const std::string Pathfinder::reset | ( | "\0m" | ) |
Color definition for prettier console output.
Geometry::Vec3 Pathfinder::scalarMultiplication | ( | const float & | a, |
const Geometry::Vec3 & | b | ||
) |
Scale a vector by a scalar.
a | The scaling factor. |
b | The vector. |
std::vector< Graph * > Pathfinder::sceneAnalysis | ( | const MinSG::ListNode & | root | ) |
Perform the static analysis of the scene.
Given the root node of a scene graph, get all GeometryNodes, build groups and the graphs of each group.
root | The root node of the scene. |
void Pathfinder::sortSizeTTuple | ( | std::tuple< size_t, size_t, size_t > & | t | ) |
TODO.
TODO
void Pathfinder::sortVec3Tuple | ( | std::tuple< Geometry::Vec3, Geometry::Vec3 > & | t | ) |
TODO.
TODO
void Pathfinder::sortVec3TupleTuple | ( | std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 >> & | t | ) |
TODO.
TODO
void Pathfinder::sortVec3TupleTuple | ( | std::tuple< std::tuple< Geometry::Vec3, Geometry::Vec3 >, std::tuple< Geometry::Vec3, Geometry::Vec3 > > & | t | ) |
float Pathfinder::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.
The computation of the t value is decribed in the thesis. It describes the distance of the intersection point of the plane with the line formed by p1 and p2, from one of the endpoints.
p | The plane. |
p1 | The first endpoint of the line. |
p2 | The second endpoint of the line. |
std::tuple< short, short > Pathfinder::tIndex2endpoints | ( | const short & | id | ) |
Translate the index of the tValues vector to the endpoints which were involved in the t value computation.
Every possible combination of two different vertices of a polygon has a certain index in the t values tuple. This function provides a convenient way to obtain the two endpoints involved in the computation of a certain t value.
id | The index of the tValues vector. |
void Pathfinder::writeIntersectionOBJFiles | ( | const std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 >>> & | intersections, |
const std::string & | path | ||
) |
Given a list of intersections, write all convex hulls of the intersections to OBJ files at the specified path.
intersections | A vector containing all intersections for a group. |
path | The path to the directory where the OBJ files shall be written to. |
void Pathfinder::writeIntersectionOBJFiles | ( | const std::vector< std::tuple< Graph *, Graph *, std::vector< Geometry::Vec3 >> > & | intersections, |
const std::string & | path | ||
) |
void Pathfinder::writeOBJFromGraph | ( | const Graph * | graph, |
const std::string & | path | ||
) |
Go through graph and output appropriate OBJ commands.
graph | The graph which shall be transformed. |
path | The path to the file where the data shall be written to. |
void Pathfinder::writeOBJFromMesh | ( | const MinSG::GeometryNode * | geoNodePtr, |
const std::string & | path | ||
) |
Go through the mesh associated with geoNodePtr and print the appropriate OBJ commands.
geoNodePtr | A pointer to the GeometryNode. |
path | The path to the file where the data shall be written to. |
const std::string Pathfinder::yellow | ( | "\1;33m" | ) |
Color definition for prettier console output.
const float Pathfinder::allowedStartEndDistance = 5 |
bool Pathfinder::objOutput = true |
Indicate whether OBJ files shall be created.
const short Pathfinder::threshold = 10 |
If this threshold is reached, stop octree recursion.