#include <Math.h>
Static Public Member Functions | |
template<typename T > | |
static T | Clamp (T a, T min=T(0), T max=T(1)) |
static auto | Cross (const Vector3D &a, const Vector3D &b) |
static auto | Distance (const Vector3D &a, const Vector3D &b) |
static auto | Distance2D (const Vector3D &a, const Vector3D &b) |
static std::pair< float, float > | DistanceArcToPoint (Vector3D p, Vector3D start_pos, float length, float heading, float curvature) |
Returns a pair containing: More... | |
static std::pair< float, float > | DistanceSegmentToPoint (const Vector3D &p, const Vector3D &v, const Vector3D &w) |
Returns a pair containing: More... | |
static auto | DistanceSquared (const Vector3D &a, const Vector3D &b) |
static auto | DistanceSquared2D (const Vector3D &a, const Vector3D &b) |
static auto | Dot (const Vector3D &a, const Vector3D &b) |
static auto | Dot2D (const Vector3D &a, const Vector3D &b) |
static std::vector< int > | GenerateRange (int a, int b) |
static Vector3D | GetForwardVector (const Rotation &rotation) |
Compute the unit vector pointing towards the X-axis of rotation. More... | |
static Vector3D | GetRightVector (const Rotation &rotation) |
Compute the unit vector pointing towards the Y-axis of rotation. More... | |
static Vector3D | GetUpVector (const Rotation &rotation) |
Compute the unit vector pointing towards the Y-axis of rotation. More... | |
static double | GetVectorAngle (const Vector3D &a, const Vector3D &b) |
Returns the angle between 2 vectors in radians. More... | |
static float | LinearLerp (float a, float b, float f) |
template<typename T > | |
static constexpr T | Pi () |
template<typename T > | |
static constexpr T | Pi2 () |
static Vector3D | RotatePointOnOrigin2D (Vector3D p, float angle) |
template<typename T > | |
static T | Square (const T &a) |
template<typename T > | |
static constexpr T | ToDegrees (T rad) |
template<typename T > | |
static constexpr T | ToRadians (T deg) |
|
inlinestatic |
Definition at line 49 of file Math.h.
References min().
Referenced by carla::road::MapBuilder::AddSignalReference(), carla::traffic_manager::LocalizationStage::AssignLaneChange(), DistanceSegmentToPoint(), carla::road::Road::GetDirectedPointIn(), carla::road::Road::GetDirectedPointInNoLaneOffset(), carla::road::element::GeometryLine::PosFromDist(), carla::road::element::GeometryArc::PosFromDist(), carla::road::element::GeometrySpiral::PosFromDist(), carla::traffic_manager::Parameters::SetPercentageIgnoreVehicles(), carla::traffic_manager::Parameters::SetPercentageIgnoreWalkers(), carla::traffic_manager::Parameters::SetPercentageRunningLight(), and carla::traffic_manager::Parameters::SetPercentageRunningSign().
Definition at line 58 of file Math.h.
References carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.
Definition at line 78 of file Math.h.
References DistanceSquared().
Referenced by carla::geom::ComputeVertexWeight(), carla::geom::Location::Distance(), carla::road::Road::GetNearestLane(), and TEST().
Definition at line 82 of file Math.h.
References DistanceSquared2D().
Referenced by DistanceArcToPoint(), DistanceSegmentToPoint(), and carla::road::Map::GetWaypoint().
|
static |
Returns a pair containing:
Definition at line 33 of file Math.cpp.
References DEBUG_ASSERT, Distance2D(), RotatePointOnOrigin2D(), carla::geom::Vector3D::x, and carla::geom::Vector3D::y.
Referenced by carla::road::element::GeometryArc::DistanceTo(), LinearLerp(), and TEST().
|
static |
Returns a pair containing:
p | point to calculate distance |
v | first point of the segment |
w | second point of the segment |
Definition at line 18 of file Math.cpp.
References Clamp(), Distance2D(), DistanceSquared2D(), and Dot2D().
Referenced by carla::road::element::GeometryLine::DistanceTo(), carla::road::Map::GetClosestWaypointOnRoad(), LinearLerp(), and TEST().
|
inlinestatic |
Definition at line 70 of file Math.h.
References Square(), carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.
Referenced by carla::traffic_manager::LocalizationStage::AssignLaneChange(), carla::traffic_manager::LocalizationStage::ComputeActionBuffer(), carla::traffic_manager::LocalizationStage::ComputeNextAction(), Distance(), carla::geom::Location::DistanceSquared(), carla::traffic_manager::SimpleWaypoint::DistanceSquared(), carla::traffic_manager::CollisionStage::NegotiateCollision(), carla::traffic_manager::MotionPlanStage::SafeAfterJunction(), carla::traffic_manager::InMemoryMap::SetUp(), carla::traffic_manager::VehicleLightStage::Update(), carla::traffic_manager::LocalizationStage::Update(), carla::traffic_manager::CollisionStage::Update(), and carla::traffic_manager::ALSM::UpdateData().
|
inlinestatic |
Definition at line 74 of file Math.h.
References Square(), carla::geom::Vector3D::x, and carla::geom::Vector3D::y.
Referenced by Distance2D(), and DistanceSegmentToPoint().
Definition at line 62 of file Math.h.
References carla::geom::Vector3D::x, carla::geom::Vector3D::y, and carla::geom::Vector3D::z.
Referenced by carla::traffic_manager::LocalizationStage::AssignLaneChange(), carla::traffic_manager::MotionPlanStage::CollisionHandling(), carla::traffic_manager::DeviationDotProduct(), carla::traffic_manager::CollisionStage::GetBoundingBoxExtention(), carla::traffic_manager::CollisionStage::GetGeodesicBoundary(), GetVectorAngle(), carla::traffic_manager::CollisionStage::NegotiateCollision(), and carla::client::detail::Client::SpawnActorWithParent().
Definition at line 66 of file Math.h.
References carla::geom::Vector3D::x, and carla::geom::Vector3D::y.
Referenced by DistanceSegmentToPoint().
|
static |
Definition at line 151 of file Math.cpp.
Referenced by ACarlaGameModeBase::DebugShowSignals(), and LinearLerp().
Compute the unit vector pointing towards the X-axis of rotation.
Definition at line 117 of file Math.cpp.
References carla::geom::Rotation::pitch, ToRadians(), and carla::geom::Rotation::yaw.
Referenced by carla::geom::Rotation::GetForwardVector(), and LinearLerp().
Compute the unit vector pointing towards the Y-axis of rotation.
Definition at line 125 of file Math.cpp.
References carla::geom::Rotation::pitch, carla::geom::Rotation::roll, ToRadians(), and carla::geom::Rotation::yaw.
Referenced by carla::geom::Rotation::GetRightVector(), and LinearLerp().
Compute the unit vector pointing towards the Y-axis of rotation.
Definition at line 138 of file Math.cpp.
References carla::geom::Rotation::pitch, carla::geom::Rotation::roll, ToRadians(), and carla::geom::Rotation::yaw.
Referenced by carla::geom::Rotation::GetUpVector(), and LinearLerp().
Returns the angle between 2 vectors in radians.
Definition at line 14 of file Math.cpp.
References Dot(), and carla::geom::Vector3D::Length().
Referenced by carla::road::Map::CreateRtree(), LinearLerp(), and carla::traffic_manager::InMemoryMap::SetUp().
|
inlinestatic |
Definition at line 86 of file Math.h.
References DistanceArcToPoint(), DistanceSegmentToPoint(), GenerateRange(), GetForwardVector(), GetRightVector(), GetUpVector(), GetVectorAngle(), and RotatePointOnOrigin2D().
|
inlinestatic |
|
inlinestatic |
Definition at line 111 of file Math.cpp.
References carla::geom::Vector3D::x, and carla::geom::Vector3D::y.
Referenced by carla::nav::Navigation::AddOrUpdateVehicle(), DistanceArcToPoint(), and LinearLerp().
|
inlinestatic |
Definition at line 54 of file Math.h.
Referenced by DistanceSquared(), and DistanceSquared2D().
|
inlinestatic |
Definition at line 37 of file Math.h.
Referenced by carla::road::MapBuilder::AddSignalPositionInertial(), carla::road::MapBuilder::ComputeSignalTransform(), carla::road::Lane::ComputeTransform(), and ARayCastSemanticLidar::SimulateLidar().
|
inlinestatic |
Definition at line 43 of file Math.h.
Referenced by carla::nav::Navigation::AddOrUpdateVehicle(), GetForwardVector(), carla::geom::Transform::GetInverseMatrix(), carla::geom::Transform::GetMatrix(), GetRightVector(), GetUpVector(), carla::geom::Rotation::InverseRotateVector(), carla::geom::LatLonToMercator(), carla::geom::LatToScale(), carla::geom::Rotation::RotateVector(), and ARayCastSemanticLidar::SimulateLidar().