12#ifndef WSFZONEROUTEFINDER_HPP
13#define WSFZONEROUTEFINDER_HPP
17#include "UtScriptClassDefine.hpp"
38 static std::unique_ptr<UtScriptClass> CreateScriptClass(
const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
40 void ClearAvoidanceZones();
42 void DrawGraph(
double aDuration,
const UtVec3d& aColor);
43 void DrawAvoidances(
double aDuration,
const UtVec3d& aColor);
47 void AvoidZone(
WsfZone* aZonePtr);
51 const WsfZone* GetAvoidanceZone(
size_t aIndex)
const noexcept;
66 Line2d(
const UtVec2d& a,
const UtVec2d& b)
72 UtVec2d IntoVec()
const {
return (mEnd - mBeg); }
81 ZoneGraphNode() =
delete;
82 ZoneGraphNode(
const UtVec2d& aLocation)
91 std::vector<ZoneGraphNode*> mEdges;
98 UtVec2d GetLocal(
const WsfGeoPoint& pt);
99 void GetGlobal(
const UtVec2d& pt,
double wcs[3]);
100 WsfGeoPoint GetGlobal(
const UtVec2d& pt);
103 bool Intersection(
const Line2d& line1,
const Line2d& line2, UtVec2d& point);
106 double ClosestPointOnLineSegment(
const UtVec2d& aPoint,
const UtVec2d& aLine1,
const UtVec2d& aLine2, UtVec2d& aClosest);
110 bool Intersects(
const Line2d& aLine, std::vector<UtVec2d> aPolygon);
111 bool Intersects(
const Line2d& aLine, std::vector<std::vector<UtVec2d>> aPolygons);
113 UtVec2d NearestSafePoint(
const UtVec2d& aPt);
115 void DrawPolygon(
double aDuration,
const UtVec3d& aColor, std::vector<UtVec2d>& aPolygon);
117 void ShortestZoneGraphPathRecursive(ZoneGraphNode* aNodePtr, UtVec2d& aTarget,
double aDist = 0);
120 WsfGeoPoint mGeoStart;
130 WsfSimulation* mSimulationPtr;
134 std::vector<ZoneGraphNode*> mZoneGraph;
135 std::vector<WsfZoneDefinition*> mAvoidZones;
136 std::vector<std::vector<UtVec2d>> mLocalZones;
137 double mBestZonePathDist;
138 std::vector<ZoneGraphNode*> mBestZonePath;
139 std::vector<ZoneGraphNode*> mZonePathStack;
150 void*
Create(
const UtScriptContext& aContext)
override;
151 void*
Clone(
void* aObjectPtr)
override;
152 void Destroy(
void* aObjectPtr)
override;
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfGeoPoint.hpp:29
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
A collection of WsfWaypoint objects that represent a path to be followed.
Definition WsfRoute.hpp:40
UT_DECLARE_SCRIPT_METHOD(NumberOfAvoidanceZones)
void Destroy(void *aObjectPtr) override
Definition WsfZoneRouteFinder.cpp:567
UT_DECLARE_SCRIPT_METHOD(RouteAroundZones)
WsfScriptZoneRouteFinderClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfZoneRouteFinder.cpp:532
UT_DECLARE_SCRIPT_METHOD(DrawAvoidances)
UT_DECLARE_SCRIPT_METHOD(DrawGraph)
UT_DECLARE_SCRIPT_METHOD(ClearAvoidanceZones)
void * Create(const UtScriptContext &aContext) override
Definition WsfZoneRouteFinder.cpp:553
UT_DECLARE_SCRIPT_METHOD(AvoidZone_1)
UT_DECLARE_SCRIPT_METHOD(AvoidZone_2)
UT_DECLARE_SCRIPT_METHOD(GetAvoidanceZone)
The main controller for a simulation.
Definition WsfSimulation.hpp:109
A class for defining a zone.
Definition WsfZoneDefinition.hpp:32
size_t NumberOfAvoidanceZones() const noexcept
Definition WsfZoneRouteFinder.hpp:54
WsfZoneRouteFinder & operator=(const WsfZoneRouteFinder &)=delete
WsfZoneRouteFinder * Clone() const override
Definition WsfZoneRouteFinder.hpp:36
WsfSimulation * GetSimulation() const
Definition WsfZoneRouteFinder.hpp:45
WsfZoneRouteFinder(WsfSimulation *aSimulationPtr)
Definition WsfZoneRouteFinder.cpp:28
Definition WsfZone.hpp:63