WSF
ZoneUtils.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// The use, dissemination or disclosure of data in this file is subject to
7// limitation or restriction. See accompanying README and LICENSE for details.
8// ****************************************************************************
9#pragma once
11class WsfSimulation;
12#include "WsfGeoPoint.hpp"
13
14namespace ZoneUtils
15{
16 // @return The distance in meters from the point to the zone center.
17 // @param point The point from which to calculate the distance.
18 // @param zone The Zone of interest.
19 double GetDistanceFromPointToZoneCenter(WsfSimulation* sim_ptr, double wcsPoint[3], WsfZoneDefinition& zone);
20
21 // @return true If the calculation was successfully completed
22 // @param point The point from which to calculate the distance.
23 // @param zone The Zone of interest.
24 // @param distance The distance in meters from the point to the nearest point on the zone. If the calculation
25 // fails, will be set to -1.
26 // @note This function assumes that the distance is along the radial from the point to the zone centroid.
27 bool GetDistanceFromPointToZone(WsfSimulation* sim_ptr, double wcsPoint[3], WsfZoneDefinition& zone, double& distance);
28
29 //@return Location of the centroid of zone.
30 //@param zone The zone for which to calculate the centroid. Some of the Zone
31 // methods are non-const, so it is passed as non-const.
32 WsfGeoPoint GetZoneCentroid(WsfSimulation* sim_ptr, WsfZoneDefinition& zone);
33
34 // @return true If any part of the line segment defined by the starting position and velocity lies within the zone.
35 // @param zone The zone of interest.
36 // @param WcsPosition The beginning point of the segment.
37 // @param WcsVelocity The velocity of the point of interest. This will be propagated forward to see if the
38 // point ever lies in the zone.
39 bool isProjectedInsideZonePosVel(WsfSimulation* sim_ptr, WsfZoneDefinition& zone, double wcsPosition[3], double wcsVelocity[3]);
40
41 // @return true If any part of the line segment defined by the two points lies within the zone.
42 // @param zone The zone of interest.
43 // @param WcsPosition1 The beginning point of the segment.
44 // @param WcsPosition2 The end point of the segment.
45 // @note Only the line segment itself is checked for intersection with the zone. We do not attempt to
46 // extrapolate off either end of the segment.
47 bool isProjectedInsideZone2Points(WsfSimulation* sim_ptr, WsfZoneDefinition& zone, double wcsPosition1[3], double wcsPosition2[3]);
48
49 // @return true if any part of the line segment defined by the starting position and compass heading lies within the zone.
50 // @param zone The zone of interest.
51 // @param wcsPosition1 The beginning point of the segment.
52 // @param headingRadians The compass heading (radians, 0 .. 2*PI)
53 bool isProjectedInsideZonePointHeading(WsfSimulation* sim_ptr, WsfZoneDefinition& zone, double WcsPosition[3], double headingRadians);
54
55 // @return true if the closest point was found.
56 // @param zone The zone of interest.
57 // @param wcsPoint The point from which to find the closest in-zone point.
58 // @param wcsZonePoint The closest point in the zone. If the point cannot be found, this will not be overwritten.
59 bool GetClosestPointInZone(WsfSimulation* sim_ptr, double wcsPoint[3], double wcsZonePoint[3], WsfZoneDefinition& zone);
60}
The main controller for a simulation.
Definition WsfSimulation.hpp:109
A class for defining a zone.
Definition WsfZoneDefinition.hpp:32
Definition ZoneUtils.cpp:30
double GetDistanceFromPointToZoneCenter(WsfSimulation *sim_ptr, double wcsPoint[3], WsfZoneDefinition &zone)
Definition ZoneUtils.cpp:405
bool isProjectedInsideZonePosVel(WsfSimulation *sim_ptr, WsfZoneDefinition &zone, double wcsPosition[3], double wcsVelocity[3])
Definition ZoneUtils.cpp:475
bool isProjectedInsideZone2Points(WsfSimulation *sim_ptr, WsfZoneDefinition &zone, double WcsPosition1[3], double WcsPosition2[3])
Definition ZoneUtils.cpp:514
bool GetDistanceFromPointToZone(WsfSimulation *sim_ptr, double wcsPoint[3], WsfZoneDefinition &zone, double &distance)
Definition ZoneUtils.cpp:351
bool GetClosestPointInZone(WsfSimulation *sim_ptr, double wcsPoint[3], double wcsZonePoint[3], WsfZoneDefinition &zone)
Definition ZoneUtils.cpp:561
WsfGeoPoint GetZoneCentroid(WsfSimulation *sim_ptr, WsfZoneDefinition &zone)
Definition ZoneUtils.cpp:178
bool isProjectedInsideZonePointHeading(WsfSimulation *sim_ptr, WsfZoneDefinition &zone, double wcsPosition[3], double headingRadians)
Definition ZoneUtils.cpp:535
Copyrights Multiple, All Rights Reserved