Merge pull request #342 from addtheice/data_bundling2

Looks fine on initial review.
This commit is contained in:
JJ
2015-01-18 18:04:33 -05:00
23 changed files with 201 additions and 196 deletions
+58
View File
@@ -148,6 +148,13 @@ float ComparativeDistance(const xyz_location& point1, const xyz_location& point2
return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z;
}
/**
* Produces the non square root'ed distance between the two points.
*/
float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2) {
ComparativeDistance(static_cast<xyz_location>(point1), static_cast<xyz_location>(point2));
}
/**
* Produces the distance between the two points.
*/
@@ -155,6 +162,13 @@ float Distance(const xyz_location& point1, const xyz_location& point2) {
return sqrt(ComparativeDistance(point1, point2));
}
/**
* Produces the distance between the two points.
*/
float Distance(const xyz_heading& point1, const xyz_heading& point2) {
Distance(static_cast<xyz_location>(point1), static_cast<xyz_location>(point2));
}
/**
* Produces the distance between the two points within the XY plane.
*/
@@ -162,6 +176,13 @@ float DistanceNoZ(const xyz_location& point1, const xyz_location& point2) {
return Distance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
}
/**
* Produces the distance between the two points within the XY plane.
*/
float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) {
return Distance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
}
/**
* Produces the non square root'ed distance between the two points within the XY plane.
*/
@@ -169,6 +190,13 @@ float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& poi
return ComparativeDistance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
}
/**
* Produces the non square root'ed distance between the two points within the XY plane.
*/
float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) {
return ComparativeDistance(static_cast<xy_location>(point1),static_cast<xy_location>(point2));
}
/**
* Determines if 'position' is within (inclusive) the axis aligned
* box (3 dimensional) formed from the points minimum and maximum.
@@ -197,3 +225,33 @@ bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &mini
return xcheck && ycheck;
}
/**
* Gives the heading directly 180 degrees from the
* current heading.
* Takes the EQfloat from the xyz_heading and returns
* an EQFloat.
*/
float GetReciprocalHeading(const xyz_heading& point1) {
return GetReciprocalHeading(point1.m_Heading);
}
/**
* Gives the heading directly 180 degrees from the
* current heading.
* Takes an EQfloat and returns an EQFloat.
*/
float GetReciprocalHeading(const float heading) {
float result = 0;
// Convert to radians
float h = (heading / 256.0f) * 6.283184f;
// Calculate the reciprocal heading in radians
result = h + 3.141592f;
// Convert back to eq heading from radians
result = (result / 6.283184f) * 256.0f;
return result;
}