![]() |
SUMO - Simulation of Urban MObility
|
A class that builds random network using an algorithm by Markus Hartinger. More...
#include <NGRandomNetBuilder.h>
Public Member Functions | |
void | createNet (int numNodes) |
Builds a NGNet using the set values. More... | |
NGRandomNetBuilder (NGNet &net, SUMOReal minAngle, SUMOReal minDistance, SUMOReal maxDistance, SUMOReal connectivity, int numTries, const TNeighbourDistribution &neighborDist) | |
Constructor. More... | |
Private Member Functions | |
bool | canConnect (NGNode *baseNode, NGNode *newNode) |
Checks whether connecting the given two nodes complies with the set restrictions. More... | |
bool | checkAngles (NGNode *node) |
Checks whether the angle of this node's connections are valid. More... | |
bool | createNewNode (NGNode *baseNode) |
Creates new random node. More... | |
void | findPossibleOuterNodes (NGNode *node) |
finds possible connections between Node and OuterNodes complying with restrictions More... | |
NGRandomNetBuilder (const NGRandomNetBuilder &) | |
Invalidated copy constructor. More... | |
NGRandomNetBuilder & | operator= (const NGRandomNetBuilder &) |
Invalidated assignment operator. More... | |
void | removeOuterNode (NGNode *node) |
Removes the given node from the list of outer nodes. More... | |
Private Attributes | |
NGNodeList | myConNodes |
TNeighbourDistribution | myNeighbourDistribution |
The distrubtion of number of neighbours. More... | |
NGNet & | myNet |
The network to fill. More... | |
int | myNumNodes |
Number of nodes to be created. More... | |
int | myNumTries |
Number of tries to create a new node. More... | |
NGEdgeList | myOuterLinks |
The list of outer links. More... | |
NGNodeList | myOuterNodes |
The list of outer nodes. More... | |
restrictions | |
SUMOReal | myMinLinkAngle |
Minimum angle allowed between two links. More... | |
SUMOReal | myMinDistance |
Minimum distance allowed between two nodes. More... | |
SUMOReal | myMaxDistance |
Maximum distance allowed between two nodes. More... | |
SUMOReal | myConnectivity |
Probability of connecting to a existing node if possible. More... | |
A class that builds random network using an algorithm by Markus Hartinger.
Definition at line 80 of file NGRandomNetBuilder.h.
NGRandomNetBuilder::NGRandomNetBuilder | ( | NGNet & | net, |
SUMOReal | minAngle, | ||
SUMOReal | minDistance, | ||
SUMOReal | maxDistance, | ||
SUMOReal | connectivity, | ||
int | numTries, | ||
const TNeighbourDistribution & | neighborDist | ||
) |
Constructor.
[in] | net | The network to fill with generated structures |
[in] | minAngle | The minimum allowed angle between two streets |
[in] | minDistance | The minimum allowed distance between two nodes |
[in] | maxDistance | The maximum allowed distance between two nodes |
[in] | connectivity | The connectivity factor |
[in] | numTries | ? |
Definition at line 81 of file NGRandomNetBuilder.cpp.
|
private |
Invalidated copy constructor.
Checks whether connecting the given two nodes complies with the set restrictions.
Checks whether the distance, the angle, and the connectivity is within the defined range when both nodes would be connected
[in] | baseNode | The first node of the combination to check |
[in] | newNode | The second node of the combination to check |
Definition at line 143 of file NGRandomNetBuilder.cpp.
References checkAngles(), Position::distanceTo2D(), NGNode::getPosition(), GeomHelper::INVALID_OFFSET, myMaxDistance, myMinDistance, myOuterLinks, GeomHelper::nearest_offset_on_line_to_point2D(), PositionVector::positionAtOffset2D(), and SUMOReal.
Referenced by createNet(), createNewNode(), and findPossibleOuterNodes().
|
private |
Checks whether the angle of this node's connections are valid.
Checks whether the connections of the nodes are in common with the value of myMinLinkAngle.
[in] | node | The node to check connections of |
Definition at line 102 of file NGRandomNetBuilder.cpp.
References GeomHelper::angle2D(), NGNode::getPosition(), NGNode::LinkList, myMinLinkAngle, Position::x(), and Position::y().
Referenced by canConnect().
void NGRandomNetBuilder::createNet | ( | int | numNodes | ) |
Builds a NGNet using the set values.
[in] | numNodes | Number of iterations (node insertions) to perform |
Definition at line 244 of file NGRandomNetBuilder.cpp.
References NGNet::add(), canConnect(), createNewNode(), findPossibleOuterNodes(), NGNode::getMaxNeighbours(), NGNet::getNextFreeID(), NGNode::LinkList, myConnectivity, myConNodes, myNet, myNumNodes, myNumTries, myOuterLinks, myOuterNodes, NGNet::nodeNo(), RandHelper::rand(), removeOuterNode(), NGNode::setMaxNeighbours(), NGNode::setX(), NGNode::setY(), and SUMOReal.
Referenced by buildNetwork().
|
private |
Creates new random node.
Returns true, if creation was successfull.
[in] | baseNode | ? |
Definition at line 213 of file NGRandomNetBuilder.cpp.
References NGNet::add(), canConnect(), NGNode::getMaxNeighbours(), NGNet::getNextFreeID(), NGNode::getPosition(), NGNode::LinkList, M_PI, myMaxDistance, myMinDistance, myNeighbourDistribution, myNet, myOuterLinks, myOuterNodes, TNeighbourDistribution::num(), RandHelper::rand(), removeOuterNode(), NGNode::setMaxNeighbours(), NGNode::setX(), NGNode::setY(), SUMOReal, Position::x(), and Position::y().
Referenced by createNet().
|
private |
finds possible connections between Node and OuterNodes complying with restrictions
[in] | node | ? |
Definition at line 195 of file NGRandomNetBuilder.cpp.
References canConnect(), NGNode::connected(), NGNode::getMaxNeighbours(), NGNode::LinkList, myConNodes, and myOuterNodes.
Referenced by createNet().
|
private |
Invalidated assignment operator.
|
private |
Removes the given node from the list of outer nodes.
[in] | node | The node to remove |
Definition at line 91 of file NGRandomNetBuilder.cpp.
References myOuterNodes.
Referenced by createNet(), and createNewNode().
|
private |
Probability of connecting to a existing node if possible.
Definition at line 180 of file NGRandomNetBuilder.h.
Referenced by createNet().
|
private |
Definition at line 164 of file NGRandomNetBuilder.h.
Referenced by createNet(), and findPossibleOuterNodes().
|
private |
Maximum distance allowed between two nodes.
Definition at line 177 of file NGRandomNetBuilder.h.
Referenced by canConnect(), and createNewNode().
|
private |
Minimum distance allowed between two nodes.
Definition at line 174 of file NGRandomNetBuilder.h.
Referenced by canConnect(), and createNewNode().
|
private |
Minimum angle allowed between two links.
Definition at line 171 of file NGRandomNetBuilder.h.
Referenced by checkAngles().
|
private |
The distrubtion of number of neighbours.
Definition at line 191 of file NGRandomNetBuilder.h.
Referenced by createNewNode().
|
private |
The network to fill.
Definition at line 155 of file NGRandomNetBuilder.h.
Referenced by createNet(), and createNewNode().
|
private |
Number of nodes to be created.
Definition at line 188 of file NGRandomNetBuilder.h.
Referenced by createNet().
|
private |
Number of tries to create a new node.
Definition at line 185 of file NGRandomNetBuilder.h.
Referenced by createNet().
|
private |
The list of outer links.
Definition at line 161 of file NGRandomNetBuilder.h.
Referenced by canConnect(), createNet(), and createNewNode().
|
private |
The list of outer nodes.
Definition at line 158 of file NGRandomNetBuilder.h.
Referenced by createNet(), createNewNode(), findPossibleOuterNodes(), and removeOuterNode().