 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
42 double maxDistance,
double connectivity,
67 NGEdgeList::iterator li;
71 if ((*li)->getStartNode() == node) {
72 ni = (*li)->getEndNode();
74 ni = (*li)->getStartNode();
80 NGEdgeList::iterator lj;
83 if ((*lj)->getStartNode() == node) {
84 ni = (*lj)->getEndNode();
86 ni = (*lj)->getStartNode();
104 bool connectable =
true;
125 NGEdgeList::iterator li;
129 const NGNode*
const start = (*li)->getStartNode();
130 const NGNode*
const end = (*li)->getEndNode();
133 if ((baseNode != start) && (baseNode != end) && (newNode != start) && (newNode != end)) {
134 connectable = !n.intersects(p1, p2);
137 if (connectable && (newNode != start) && (newNode != end)) {
157 NGNodeList::iterator ni;
183 double x = baseNode->
getPosition().
x() + dist * cos(angle);
184 double y = baseNode->
getPosition().
y() + dist * sin(angle);
NGNet & myNet
The network to fill.
RandomDistributor< int > myNeighbourDistribution
The distribution of number of neighbours.
NGEdgeList LinkList
List of connected links.
double myConnectivity
Probability of connecting to a existing node if possible.
std::string getNextFreeID()
Returns the next free id.
void findPossibleOuterNodes(NGNode *node)
finds possible connections between Node and OuterNodes complying with restrictions
bool canConnect(NGNode *baseNode, NGNode *newNode)
Checks whether connecting the given two nodes complies with the set restrictions.
A netgen-representation of an edge.
double myMinLinkAngle
Minimum angle allowed between two links.
double myMinDistance
Minimum distance allowed between two nodes.
bool connected(NGNode *node) const
Returns whether the other node is connected.
double length() const
Returns the length.
static double nearest_offset_on_line_to_point2D(const Position &lineStart, const Position &lineEnd, const Position &p, bool perpendicular=true)
const Position & getPosition() const
Returns this node's position.
T get(std::mt19937 *which=0) const
Draw a sample of the distribution.
bool checkAngles(NGNode *node)
Checks whether the angle of this node's connections are valid.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
The class storing the generated network.
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
void removeOuterNode(NGNode *node)
Removes the given node from the list of outer nodes.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
int nodeNo() const
Returns the number of stored nodes.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
int myNumNodes
Number of nodes to be created.
bool createNewNode(NGNode *baseNode, bool gridMode)
Creates new random node.
int getMaxNeighbours()
Returns this node's maximum neighbour number.
static double angle2D(const Position &p1, const Position &p2)
Returns the angle between two vectors on a plane The angle is from vector 1 to vector 2,...
double y() const
Returns the y-position.
double myMaxDistance
Maximum distance allowed between two nodes.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
NGEdgeList myOuterLinks
The list of outer links.
void createNet(int numNodes, bool gridMode)
Builds a NGNet using the set values.
int myNumTries
Number of tries to create a new node.
void setMaxNeighbours(int value)
Sets this node's maximum neighbour number.
void add(NGNode *node)
Adds the given node to the network.
void setY(double y)
Sets a new value for y-position.
NGNodeList myOuterNodes
The list of outer nodes.
NGRandomNetBuilder(NGNet &net, double minAngle, double minDistance, double maxDistance, double connectivity, int numTries, const RandomDistributor< int > &neighborDist)
Constructor.
A netgen-representation of a node.
void setX(double x)
Sets a new value for x-position.