DHART
|
A point in space with an ID. More...
#include <node.h>
Public Member Functions | |||
Node () | |||
Default constructor. Every element contained is defaulted to NAN. More... | |||
Node (float x, float y, float z, int ID=-1) | |||
Create a node without an ID. More... | |||
Node (const std::array< float, 3 > &position) | |||
Create a node from an array. More... | |||
Node (const std::array< float, 3 > &position, NODE_TYPE t, int id) | |||
Constructor to create a node with a different NODE_TYPE. More... | |||
float | distanceTo (const Node &n2) const | ||
Calculate the distance between this node and n2. More... | |||
float | angleTo (const Node &n2) const | ||
Calculate the angle between node 1 and n2 More... | |||
std::array< float, 3 > | directionTo (const Node &n2) const | ||
Get the direction between this node and another node More... | |||
std::array< float, 3 > | getArray () const | ||
Returns the x,y,z of this node as an array of 3 floats. More... | |||
float & | operator[] (int i) | ||
Directly access a nodes's position as if it were an array of 3 floats, More... | |||
float | operator[] (int i) const | ||
Access a nodes's position, by value. More... | |||
bool | operator== (const Node &n2) const | ||
Check if this node occupies the same space as n2. More... | |||
bool | operator!= (const Node &n2) const | ||
See operator==, checks if this node does NOT occupy the same space as n2.
| |||
Node | operator- (const Node &n2) const | ||
Creates a node from the vector subtraction of this node and n2's position. More... | |||
Node | operator+ (const Node &n2) const | ||
Creates a new node from the vector addition of this node and n2. More... | |||
Node | operator* (const Node &n2) const | ||
Creates a new node from the dot product of this node and n2. More... | |||
bool | operator< (const Node &n2) const | ||
Determines if this node's id (an integer) is less than n2's id. More... | |||
bool | operator< (const Node &n2) | ||
Determines if this node's id (an integer) is less than n2's id. const qualification omitted for std::sort. More... | |||
bool | operator> (const Node &n2) const | ||
Determines if this node's id (an integer) is greater than n2's id More... | |||
Public Attributes | |
float | x |
float | y |
float | z |
Cartesian coordinates x, y, z. More... | |
short | type = GRAPH |
Unused. More... | |
int | id |
Node identifier. More... | |
HF::SpatialStructures::Node::Node | ( | ) |
Default constructor. Every element contained is defaulted to NAN.
Definition at line 15 of file node.cpp.
Referenced by operator*(), operator+(), and operator-().
HF::SpatialStructures::Node::Node | ( | float | x, |
float | y, | ||
float | z, | ||
int | ID = -1 |
||
) |
Create a node without an ID.
x | X coordinate. |
y | Y coordinate. |
z | Z coordinate. |
id | ID of the node |
HF::SpatialStructures::Node::Node | ( | const std::array< float, 3 > & | position | ) |
Create a node from an array.
position | An array of 3 floats for x,y,z. |
Definition at line 24 of file node.cpp.
References HF::SpatialStructures::GRAPH, type, x, y, and z.
HF::SpatialStructures::Node::Node | ( | const std::array< float, 3 > & | position, |
NODE_TYPE | t, | ||
int | id | ||
) |
Constructor to create a node with a different NODE_TYPE.
float HF::SpatialStructures::Node::angleTo | ( | const Node & | n2 | ) | const |
Calculate the angle between node 1 and n2
n2 | Node to calculate direction to |
std::array< float, 3 > HF::SpatialStructures::Node::directionTo | ( | const Node & | n2 | ) | const |
Get the direction between this node and another node
n2 | The node to get the direction to |
Definition at line 131 of file node.cpp.
References HF::SpatialStructures::Normalize(), x, y, and z.
Referenced by HF::SpatialStructures::CostAlgorithms::CalculateEnergyExpenditure(), HF::SpatialStructures::CostAlgorithms::GetPerpendicularEdges(), and HF::VisibilityGraph::IsOcclusionBetween().
float HF::SpatialStructures::Node::distanceTo | ( | const Node & | n2 | ) | const |
Calculate the distance between this node and n2.
n2 | Note to calculate the distance to. |
Definition at line 40 of file node.cpp.
Referenced by HF::VisibilityGraph::AllToAll(), HF::VisibilityGraph::AllToAllUndirected(), HF::SpatialStructures::CostAlgorithms::CalculateEnergyExpenditure(), HF::VisibilityGraph::GroupToGroup(), and HF::VisibilityGraph::IsOcclusionBetween().
std::array< float, 3 > HF::SpatialStructures::Node::getArray | ( | ) | const |
Returns the x,y,z of this node as an array of 3 floats.
bool HF::SpatialStructures::Node::operator!= | ( | const Node & | n2 | ) | const |
See operator==, checks if this node does NOT occupy the same space as n2.
n2 | Node to compare with this node. |
Definition at line 96 of file node.cpp.
References operator==().
Creates a new node from the dot product of this node and n2.
n2 | Second factor of dot product, N1 (dot) N2 |
Definition at line 114 of file node.cpp.
References Node(), x, y, and z.
Creates a new node from the vector addition of this node and n2.
n2 | Node to add to n1 |
Definition at line 104 of file node.cpp.
References Node(), x, y, and z.
Creates a node from the vector subtraction of this node and n2's position.
n2 | Node to subtract from this node. |
Definition at line 100 of file node.cpp.
References Node(), x, y, and z.
bool HF::SpatialStructures::Node::operator< | ( | const Node & | n2 | ) |
Determines if this node's id (an integer) is less than n2's id. const qualification omitted for std::sort.
n2 | Node whose id will be compared with n1 |
Definition at line 119 of file node.cpp.
References id.
bool HF::SpatialStructures::Node::operator< | ( | const Node & | n2 | ) | const |
Determines if this node's id (an integer) is less than n2's id.
n2 | Node to compare against. |
Definition at line 118 of file node.cpp.
References id.
bool HF::SpatialStructures::Node::operator== | ( | const Node & | n2 | ) | const |
Check if this node occupies the same space as n2.
n2 | Node to compare with n1 |
Definition at line 83 of file node.cpp.
References HF::SpatialStructures::ROUNDING_PRECISION, x, y, and z.
Referenced by operator!=().
bool HF::SpatialStructures::Node::operator> | ( | const Node & | n2 | ) | const |
Determines if this node's id (an integer) is greater than n2's id
n2 | Node whose id will be compared with n1 |
Definition at line 120 of file node.cpp.
References id.
float & HF::SpatialStructures::Node::operator[] | ( | int | i | ) |
Directly access a nodes's position as if it were an array of 3 floats,
i | Index. 0 = x, 1 = y, 2 = z |
std::exception | i was greater than 2 or less than 0. |
float HF::SpatialStructures::Node::operator[] | ( | int | i | ) | const |
Access a nodes's position, by value.
i | Index. 0 = x, 1 = y, 2 = z |
std::exception | i was greater than 2 or less than 0. |
int HF::SpatialStructures::Node::id |
Node identifier.
Definition at line 42 of file node.h.
Referenced by HF::SpatialStructures::CostAlgorithms::CalculateCrossSlope(), HF::SpatialStructures::CostAlgorithms::CalculateEnergyExpenditure(), operator<(), and operator>().
short HF::SpatialStructures::Node::type = GRAPH |
float HF::SpatialStructures::Node::x |
Definition at line 40 of file node.h.
Referenced by Node(), directionTo(), distanceTo(), getArray(), operator*(), operator+(), operator-(), std::operator<<(), operator==(), and operator[]().
float HF::SpatialStructures::Node::y |
Definition at line 40 of file node.h.
Referenced by Node(), directionTo(), distanceTo(), getArray(), operator*(), operator+(), operator-(), std::operator<<(), operator==(), and operator[]().
float HF::SpatialStructures::Node::z |
Cartesian coordinates x, y, z.
Definition at line 40 of file node.h.
Referenced by Node(), HF::SpatialStructures::CostAlgorithms::CalculateCrossSlope(), directionTo(), distanceTo(), getArray(), operator*(), operator+(), operator-(), std::operator<<(), operator==(), and operator[]().