10 #include <Atoms/Agent.h>
11 #include <AtomsCore/AtomsMath.h>
18 inline float distSqPointLineSegment(
const AtomsMath::Vector2f& a,
const AtomsMath::Vector2f& b,
const AtomsMath::Vector2f& c)
20 const float r = ((c - a).dot(b - a)) / (b - a).length2();
23 return (c - a).length2();
26 return (c - b).length2();
29 return (c - (a + (b - a) * r)).length2();
33 inline float distSqPointLineSegment(
const AtomsMath::Vector3f& a,
const AtomsMath::Vector3f& b,
const AtomsMath::Vector3f& c)
35 const float r = ((c - a).dot(b - a)) / (b - a).length2();
38 return (c - a).length2();
41 return (c - b).length2();
44 return (c - (a + (b - a) * r)).length2();
48 inline float det(
const AtomsMath::Vector2f& vector1,
const AtomsMath::Vector2f& Vector2f)
50 return vector1.x * Vector2f.y - vector1.y * Vector2f.x;
53 inline float leftOf(
const AtomsMath::Vector2f& a,
const AtomsMath::Vector2f& b,
const AtomsMath::Vector2f& c)
55 return det(a - c, b - a);
58 inline float sqr(
float a)
63 class ATOMS_EXPORT Obstacle;
68 AtomsMath::Vector2f point;
70 AtomsMath::Vector2f direction;
90 void buildObstacleTree(std::vector<Obstacle*>& simObstacles);
92 ObstacleTreeNode* buildObstacleTreeRecursive(std::vector<Obstacle*>& simObstacles,
const std::vector<Obstacle*>& copyObstacles);
98 void queryObstacleTreeRecursive(
99 const AtomsMath::Vector3f& agentPosition,
103 std::vector<std::pair<float, const Obstacle*>>& obstacleNeighbors)
const;
105 void insertObstacleNeighbor(
107 const AtomsMath::Vector3f& agentPosition,
110 std::vector<std::pair<float, const Obstacle*>>& obstacleNeighbors)
const;
116 static const size_t MAX_LEAF_SIZE = 10;
124 enum NearTypeEnum { FIRST, MIDDLE, LAST };
126 AtomsMath::Vector2f getP1()
const;
128 Obstacle::NearTypeEnum distanceSqToPoint(
const AtomsMath::Vector2f& pt, AtomsMath::Vector2f& nearPt,
float& distSq)
const;
132 AtomsMath::Vector3f pointW_;
133 AtomsMath::Vector2f point_;
135 AtomsMath::Vector2f unitDir_;
136 AtomsMath::Vector3f unitDirW_;
142 ATOMS_EXPORT
size_t computeORCALinesTurning(
146 const std::vector<const Atoms::Agent*>& agentNeighbors,
147 const std::vector<std::pair<float, const Atoms::RVO2::Obstacle*>>& obstacleNeighbors,
149 float timeHorizonObst,
155 float radiusMultiplier,
156 float obstacleRadiusMultiplier,
161 std::vector<Atoms::RVO2::Line>& orcaLines,
162 AtomsMath::Vector2f& optVel,
163 AtomsMath::Vector2f& prefDir,
170 const std::vector<const Atoms::Agent*>& neighbors,
171 const std::vector<std::pair<float, const Atoms::RVO2::Obstacle*>>& obstacleNeighbors,
173 float timeHorizonObst,
179 float radiusMultiplier,
180 float obstacleRadiusMultiplier,
187 ATOMS_EXPORT
void adaptPreferredVelocity(
190 const std::vector<const Atoms::Agent*>& agentNeighbors,
191 const std::vector<std::pair<float, const Atoms::RVO2::Obstacle*>>& obstacleNeighbors,
207 ATOMS_EXPORT
bool linearProgram1(
208 const std::vector<Line>& lines,
211 const AtomsMath::Vector2f& optVelocity,
215 AtomsMath::Vector2f& result);
227 ATOMS_EXPORT
size_t linearProgram2(
228 const std::vector<Line>& lines,
230 const AtomsMath::Vector2f& optVelocity,
234 AtomsMath::Vector2f& result);
245 ATOMS_EXPORT
void linearProgram3(
246 const std::vector<Line>& lines,
252 AtomsMath::Vector2f& result);
AtomsMath::Vector2f Vector2f
Vector2 class.
Definition: AtomsMath.h:55
Atoms namespace.
Definition: Agent.h:29