INET Framework for OMNeT++/OMNEST
|
Class for storing 3D coordinates. More...
#include <Coord.h>
Public Member Functions | |
Coord () | |
Default constructor. More... | |
Coord (double x, double y, double z=0.0) | |
Initializes a coordinate. More... | |
Coord (const Coord &other) | |
Initializes coordinate from other coordinate. More... | |
std::string | info () const override |
Returns a string with the value of the coordinate. More... | |
Coord & | operator*= (double f) |
Multiplies this coordinate vector by a real number. More... | |
Coord & | operator/= (double f) |
Divides this coordinate vector by a real number. More... | |
Coord & | operator+= (const Coord &a) |
Adds coordinate vector 'a' to this. More... | |
float | operator* (const Coord &v) const |
Dot product. More... | |
Coord | operator% (const Coord &v) const |
Cross product. More... | |
Coord & | operator= (const Coord &other) |
Assigns coordinate vector 'other' to this. More... | |
Coord & | operator-= (const Coord &a) |
Subtracts coordinate vector 'a' from this. More... | |
double | distance (const Coord &a) const |
Returns the distance to Coord 'a'. More... | |
double | sqrdist (const Coord &a) const |
Returns distance^2 to Coord 'a' (omits calling square root). More... | |
double | sqrTorusDist (const Coord &b, const Coord &size) const |
Returns the squared distance on a torus of this to Coord 'b' (omits calling square root). More... | |
double | squareLength () const |
Returns the square of the length of this Coords position vector. More... | |
double | length () const |
Returns the length of this Coords position vector. More... | |
void | normalize () |
Updates the length of this position vector to be 1. More... | |
bool | isInBoundary (const Coord &lowerBound, const Coord &upperBound) const |
Checks if this coordinate is inside a specified rectangle. More... | |
bool | isNil () const |
bool | isUnspecified () const |
Returns true if this coordinate is unspecified. More... | |
Coord | min (const Coord &a) |
Returns the minimal coordinates. More... | |
Coord | max (const Coord &a) |
Returns the maximal coordinates. More... | |
double | angle (const Coord &a) |
Returns the angle between the two vectors. More... | |
Public Attributes | |
x, y and z coordinate of the position. | |
double | x |
double | y |
double | z |
Static Public Attributes | |
static const Coord | NIL = Coord(NaN, NaN, NaN) |
Constant with all values set to 0. More... | |
static const Coord | ZERO = Coord(0.0, 0.0, 0.0) |
static const Coord | X_AXIS = Coord(1.0, 0.0, 0.0) |
static const Coord | Y_AXIS = Coord(0.0, 1.0, 0.0) |
static const Coord | Z_AXIS = Coord(0.0, 0.0, 1.0) |
Private Member Functions | |
void | copy (const Coord &other) |
Friends | |
Coord | operator+ (const Coord &a, const Coord &b) |
Adds two coordinate vectors. More... | |
Coord | operator- (const Coord &a, const Coord &b) |
Subtracts two coordinate vectors. More... | |
Coord | operator* (const Coord &a, double f) |
Multiplies a coordinate vector by a real number. More... | |
Coord | operator/ (const Coord &a, double f) |
Divides a coordinate vector by a real number. More... | |
bool | operator== (const Coord &a, const Coord &b) |
Tests whether two coordinate vectors are equal. More... | |
bool | operator!= (const Coord &a, const Coord &b) |
Tests whether two coordinate vectors are not equal. More... | |
Class for storing 3D coordinates.
Some comparison and basic arithmetic operators are implemented.
|
inline |
Default constructor.
|
inline |
Initializes a coordinate.
|
inline |
Initializes coordinate from other coordinate.
|
inline |
Returns the angle between the two vectors.
|
inlineprivate |
|
inline |
Returns the distance to Coord 'a'.
Referenced by inet::physicallayer::ConstantSpeedPropagation::computeArrival(), inet::BonnMotionMobility::computeMaxSpeed(), inet::ANSimMobility::computeMaxSpeed(), inet::physicallayer::PathLossBase::computePathLoss(), inet::physicallayer::IdealAnalogModel::computeReception(), inet::physicallayer::DimensionalAnalogModelBase::computeReceptionPower(), inet::physicallayer::TwoRayInterference::computeTwoRayInterference(), inet::visualizer::TracingObstacleLossCanvasVisualizer::createObstacleLossVisualization(), inet::TurtleMobility::executeStatement(), inet::visualizer::MediumVisualizerBase::initialize(), inet::physicallayer::RadioMedium::isInCommunicationRange(), inet::physicallayer::RadioMedium::isInInterferenceRange(), inet::LineSegment::length(), inet::visualizer::PathCanvasVisualizerBase::refreshDisplay(), inet::RandomWPMobility::setTargetPosition(), inet::Ns2MotionMobility::setTargetPosition(), and inet::MoBANCoordinator::setTargetPosition().
|
inlineoverride |
Returns a string with the value of the coordinate.
Referenced by inet::PostureTransition::getMatrix().
Checks if this coordinate is inside a specified rectangle.
lowerBound | The upper bound of the rectangle. |
upperBound | The lower bound of the rectangle. |
Referenced by inet::PostureTransition::findAreaType(), and inet::MoBANCoordinator::isInsideWorld().
|
inline |
Referenced by inet::Cuboid::computeIntersection().
|
inline |
Returns true if this coordinate is unspecified.
Referenced by inet::Cuboid::computeIntersection(), inet::Box::isUnspecified(), inet::Plane::isUnspecified(), and inet::LineSegment::isUnspecified().
|
inline |
Returns the length of this Coords position vector.
Referenced by angle(), inet::Sphere::computeIntersection(), inet::physicallayer::AnalogModelBase::computeTransmissionDirection(), inet::visualizer::TracingObstacleLossCanvasVisualizer::createObstacleLossVisualization(), distance(), inet::Polygon::getNormalUnitVector(), inet::ConstSpeedMobility::setTargetPosition(), inet::ChiangMobility::setTargetPosition(), and inet::MoBANLocal::setTargetPosition().
Returns the maximal coordinates.
Referenced by inet::Box::computeBoundingBox(), inet::Prism::computeBoundingBoxSize(), inet::Polyhedron::computeBoundingBoxSize(), inet::physicallayer::MediumLimitCache::computeMaxConstreaintArea(), inet::Polygon::computeSize(), and inet::visualizer::SceneVisualizerBase::getPlaygroundBounds().
Returns the minimal coordinates.
Referenced by inet::Box::computeBoundingBox(), inet::Prism::computeBoundingBoxSize(), inet::Polyhedron::computeBoundingBoxSize(), inet::physicallayer::MediumLimitCache::computeMinConstraintArea(), and inet::Polygon::computeSize().
|
inline |
Updates the length of this position vector to be 1.
Referenced by inet::visualizer::VisualizerBase::getContactPosition(), inet::visualizer::LineManager::getLineShift(), and inet::MovingMobilityBase::moveAndUpdate().
Cross product.
|
inline |
Dot product.
|
inline |
Multiplies this coordinate vector by a real number.
Adds coordinate vector 'a' to this.
Subtracts coordinate vector 'a' from this.
|
inline |
Divides this coordinate vector by a real number.
Assigns coordinate vector 'other' to this.
This operator can change the dimension of the coordinate.
|
inline |
Returns distance^2 to Coord 'a' (omits calling square root).
Referenced by inet::QuadTree::strictRangeQuery(), and inet::physicallayer::NeighborListNeighborCache::updateNeighborList().
Returns the squared distance on a torus of this to Coord 'b' (omits calling square root).
|
inline |
Tests whether two coordinate vectors are not equal.
Negation of the operator==.
Multiplies a coordinate vector by a real number.
Adds two coordinate vectors.
Subtracts two coordinate vectors.
Divides a coordinate vector by a real number.
Tests whether two coordinate vectors are equal.
Because coordinates are of type double, this is done through the math::close function.
Constant with all values set to 0.
Referenced by inet::Box::computeBoundingBox(), inet::Cuboid::computeIntersection(), inet::Plane::computeIntersection(), inet::Polygon::computeIntersection(), inet::Prism::computeIntersection(), inet::Polyhedron::computeIntersection(), inet::physicallayer::MediumLimitCache::computeMaxConstreaintArea(), inet::physicallayer::MediumLimitCache::computeMinConstraintArea(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), and inet::PolyhedronFace::PolyhedronFace().
double inet::Coord::x |
Referenced by inet::MobilityBase::checkPosition(), inet::BVHTree::computeBoundingBox(), inet::SpatialGrid::computeBoundingVoxels(), inet::CanvasProjection::computeCanvasPoint(), inet::SpatialGrid::computeConstraintAreaSideLengths(), inet::SimpleGeographicCoordinateSystem::computeGeographicCoordinate(), inet::Cuboid::computeIntersection(), inet::BonnMotionMobility::computeMaxSpeed(), inet::SpatialGrid::computeNumberOfVoxels(), inet::physicallayer::AnalogModelBase::computeTransmissionDirection(), inet::Cuboid::computeVisibleFaces(), inet::SpatialGrid::coordToMatrixIndices(), copy(), inet::QuadTree::doesIntersectWithQuadrant(), inet::TurtleMobility::executeStatement(), inet::ANSimMobility::extractDataFrom(), inet::GPSR::findPerimeterRoutingNextHop(), inet::LinearNodeDistributionMobility::finish(), inet::Polygon::getEdgeOutwardNormalVector(), inet::Polygon::getNormalVector(), inet::MobilityBase::getRandomPosition(), inet::TurtleMobility::getValue(), inet::GPSR::getVectorAngle(), inet::physicalenvironment::GridObjectCache::initialize(), inet::RectangleMobility::initialize(), inet::physicallayer::GridNeighborCache::initialize(), inet::physicalenvironment::PhysicalEnvironment::initialize(), inet::MobilityBase::initialize(), inet::visualizer::MediumCanvasVisualizer::initialize(), inet::QuadTree::insert(), inet::SpatialGrid::insertObject(), inet::GPSR::intersectSections(), inet::BVHTree::intersectWithLineSegment(), isInBoundary(), inet::QuadTree::isInRectangleRange(), inet::Cuboid::isInsideX(), inet::MobilityBase::isOutside(), inet::visualizer::isPointOnSegment(), inet::SpatialGrid::LineSegmentIterator::LineSegmentIterator(), inet::Rotation::matrixMultiplication(), inet::Rotation::matrixTransposeMultiplication(), max(), min(), inet::VehicleMobility::move(), inet::RectangleMobility::move(), inet::CircleMobility::move(), inet::QuadTree::move(), inet::MovingMobilityBase::moveAndUpdate(), operator%(), inet::BVHTree::AxisComparator::operator()(), operator*(), operator+=(), operator-=(), inet::operator<<(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), inet::physicalenvironment::PhysicalEnvironment::parseShapes(), inet::PolyhedronPoint::PolyhedronPoint(), inet::GaussMarkovMobility::preventBorderHugging(), inet::MobilityBase::raiseErrorIfOutside(), inet::MoBANCoordinator::readConfigurationFile(), inet::VehicleMobility::readWaypointsFromFile(), inet::NetAnimTrace::receiveSignal(), inet::visualizer::MediumCanvasVisualizer::receptionStarted(), inet::MobilityBase::reflectIfOutside(), inet::visualizer::PathCanvasVisualizerBase::refreshDisplay(), inet::QuadTree::remove(), inet::QuadTree::setBoundary(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), inet::VehicleMobility::setInitialPosition(), inet::BonnMotionMobility::setInitialPosition(), inet::TractorMobility::setInitialPosition(), inet::LinearNodeDistributionMobility::setInitialPosition(), inet::Ns2MotionMobility::setInitialPosition(), inet::MobilityBase::setInitialPosition(), inet::BonnMotionMobility::setTargetPosition(), inet::TractorMobility::setTargetPosition(), inet::Ns2MotionMobility::setTargetPosition(), inet::MoBANCoordinator::setTargetPosition(), inet::SpatialGrid::SpatialGrid(), sqrTorusDist(), inet::MoBANLocal::updateVisualRepresentation(), inet::QuadTree::whichQuadrant(), and inet::MobilityBase::wrapIfOutside().
Referenced by inet::visualizer::LineManager::getLineShift().
double inet::Coord::y |
Referenced by inet::MobilityBase::checkPosition(), inet::BVHTree::computeBoundingBox(), inet::SpatialGrid::computeBoundingVoxels(), inet::CanvasProjection::computeCanvasPoint(), inet::SpatialGrid::computeConstraintAreaSideLengths(), inet::SimpleGeographicCoordinateSystem::computeGeographicCoordinate(), inet::Cuboid::computeIntersection(), inet::BonnMotionMobility::computeMaxSpeed(), inet::SpatialGrid::computeNumberOfVoxels(), inet::physicallayer::AnalogModelBase::computeTransmissionDirection(), inet::Cuboid::computeVisibleFaces(), inet::SpatialGrid::coordToMatrixIndices(), copy(), inet::QuadTree::doesIntersectWithQuadrant(), inet::TurtleMobility::executeStatement(), inet::ANSimMobility::extractDataFrom(), inet::LinearNodeDistributionMobility::finish(), inet::Polygon::getEdgeOutwardNormalVector(), inet::Polygon::getNormalVector(), inet::MobilityBase::getRandomPosition(), inet::TurtleMobility::getValue(), inet::GPSR::getVectorAngle(), inet::physicalenvironment::GridObjectCache::initialize(), inet::RectangleMobility::initialize(), inet::physicallayer::GridNeighborCache::initialize(), inet::physicalenvironment::PhysicalEnvironment::initialize(), inet::MobilityBase::initialize(), inet::visualizer::MediumCanvasVisualizer::initialize(), inet::QuadTree::insert(), inet::SpatialGrid::insertObject(), inet::GPSR::intersectSections(), inet::BVHTree::intersectWithLineSegment(), isInBoundary(), inet::QuadTree::isInRectangleRange(), inet::Cuboid::isInsideY(), inet::MobilityBase::isOutside(), inet::visualizer::isPointOnSegment(), inet::SpatialGrid::LineSegmentIterator::LineSegmentIterator(), inet::Rotation::matrixMultiplication(), inet::Rotation::matrixTransposeMultiplication(), max(), min(), inet::VehicleMobility::move(), inet::RectangleMobility::move(), inet::CircleMobility::move(), inet::QuadTree::move(), inet::MovingMobilityBase::moveAndUpdate(), operator%(), inet::BVHTree::AxisComparator::operator()(), operator*(), operator+=(), operator-=(), inet::operator<<(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), inet::physicalenvironment::PhysicalEnvironment::parseShapes(), inet::PolyhedronPoint::PolyhedronPoint(), inet::GaussMarkovMobility::preventBorderHugging(), inet::MobilityBase::raiseErrorIfOutside(), inet::MoBANCoordinator::readConfigurationFile(), inet::VehicleMobility::readWaypointsFromFile(), inet::NetAnimTrace::receiveSignal(), inet::visualizer::MediumCanvasVisualizer::receptionStarted(), inet::MobilityBase::reflectIfOutside(), inet::visualizer::PathCanvasVisualizerBase::refreshDisplay(), inet::QuadTree::remove(), inet::QuadTree::setBoundary(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), inet::VehicleMobility::setInitialPosition(), inet::TractorMobility::setInitialPosition(), inet::BonnMotionMobility::setInitialPosition(), inet::LinearNodeDistributionMobility::setInitialPosition(), inet::Ns2MotionMobility::setInitialPosition(), inet::MobilityBase::setInitialPosition(), inet::BonnMotionMobility::setTargetPosition(), inet::TractorMobility::setTargetPosition(), inet::Ns2MotionMobility::setTargetPosition(), inet::MoBANCoordinator::setTargetPosition(), inet::SpatialGrid::SpatialGrid(), sqrTorusDist(), inet::MoBANLocal::updateVisualRepresentation(), inet::QuadTree::whichQuadrant(), and inet::MobilityBase::wrapIfOutside().
Referenced by inet::visualizer::LineManager::getLineShift().
double inet::Coord::z |
Referenced by inet::MobilityBase::checkPosition(), inet::BVHTree::computeBoundingBox(), inet::SpatialGrid::computeBoundingVoxels(), inet::SpatialGrid::computeConstraintAreaSideLengths(), inet::SimpleGeographicCoordinateSystem::computeGeographicCoordinate(), inet::Cuboid::computeIntersection(), inet::BonnMotionMobility::computeMaxSpeed(), inet::SpatialGrid::computeNumberOfVoxels(), inet::physicallayer::AnalogModelBase::computeTransmissionDirection(), inet::physicallayer::TwoRayInterference::computeTwoRayInterference(), inet::Cuboid::computeVisibleFaces(), inet::SpatialGrid::coordToMatrixIndices(), copy(), inet::Prism::genereateFaces(), inet::Polygon::getEdgeOutwardNormalVector(), inet::Polygon::getNormalVector(), inet::MobilityBase::getRandomPosition(), inet::physicalenvironment::GridObjectCache::initialize(), inet::physicallayer::GridNeighborCache::initialize(), inet::physicalenvironment::PhysicalEnvironment::initialize(), inet::MobilityBase::initialize(), inet::QuadTree::insert(), inet::SpatialGrid::insertObject(), inet::BVHTree::intersectWithLineSegment(), isInBoundary(), inet::Cuboid::isInsideZ(), inet::MobilityBase::isOutside(), inet::SpatialGrid::LineSegmentIterator::LineSegmentIterator(), inet::Rotation::matrixMultiplication(), inet::Rotation::matrixTransposeMultiplication(), max(), min(), inet::CircleMobility::move(), inet::QuadTree::move(), inet::MovingMobilityBase::moveAndUpdate(), operator%(), inet::BVHTree::AxisComparator::operator()(), operator*(), operator+=(), operator-=(), inet::operator<<(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), inet::physicalenvironment::PhysicalEnvironment::parseShapes(), inet::PolyhedronPoint::PolyhedronPoint(), inet::MobilityBase::raiseErrorIfOutside(), inet::MoBANCoordinator::readConfigurationFile(), inet::VehicleMobility::readWaypointsFromFile(), inet::MobilityBase::reflectIfOutside(), inet::QuadTree::remove(), inet::MoBANCoordinator::selectDestination(), inet::StaticGridMobility::setInitialPosition(), inet::StaticConcentricMobility::setInitialPosition(), inet::LinearNodeDistributionMobility::setInitialPosition(), inet::MobilityBase::setInitialPosition(), inet::BonnMotionMobility::setTargetPosition(), inet::MoBANCoordinator::setTargetPosition(), inet::SpatialGrid::SpatialGrid(), sqrTorusDist(), inet::QuadTree::whichQuadrant(), and inet::MobilityBase::wrapIfOutside().
Referenced by inet::visualizer::LineManager::getLineShift().
Referenced by inet::physicalenvironment::PhysicalEnvironment::convertPoints(), inet::visualizer::VisualizerBase::getContactPosition(), inet::StationaryMobility::getCurrentSpeed(), inet::visualizer::LineManager::getLineShift(), inet::visualizer::SceneVisualizerBase::getPlaygroundBounds(), inet::visualizer::MediumCanvasVisualizer::initialize(), inet::visualizer::SceneCanvasVisualizer::initializeAxis(), inet::LineSegmentsMobilityBase::LineSegmentsMobilityBase(), inet::MoBANLocal::MoBANLocal(), inet::physicalenvironment::PhysicalEnvironment::parseObjects(), inet::ChiangMobility::setTargetPosition(), and inet::TractorMobility::setTargetPosition().