Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
cleaned up some comments and varible names
Browse files Browse the repository at this point in the history
  • Loading branch information
jpatton-USGS committed Jan 23, 2020
1 parent ff477bd commit 271f02d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
15 changes: 8 additions & 7 deletions glasscore/traveltime/include/TravelTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,21 @@ class CTravelTime {
*
* Compute a bilinear interpolation from the provided values
*
* \param v11 - A double containing the interpolation value for (x1, y1)
* \param v12 - A double containing the interpolation value for (x1, y2)
* \param v21 - A double containing the interpolation value for (x2, y1)
* \param v22 - A double containing the interpolation value for (x2, y2)
* \param q_x1y1 - A double containing the interpolation value for (x1, y1)
* \param q_x1y2 - A double containing the interpolation value for (x1, y2)
* \param q_x2y1 - A double containing the interpolation value for (x2, y1)
* \param q_x2y2 - A double containing the interpolation value for (x2, y2)
* \param x1 - A double containing first x interpolation coordinate
* \param x2 - A double containing second x interpolation coordinate
* \param y1 - A double containing first y interpolation coordinate
* \param x2 - A double containing second x interpolation coordinate
* \param y2 - A double containing second y interpolation coordinate
* \param x - A double containing the given x coordinate
* \param y - A double containing the given y coordinate
* \return Returns a double containing the resulting bilinear interpolation
*/
double bilinearInterpolation(double v11, double v12, double v21,
double v22, double x1, double x2, double y1, double y2, double x, double y);
double bilinearInterpolation(double q_x1y1, double q_x1y2, double q_x2y1,
double q_x2y2, double x1, double y1, double x2, double y2, double x,
double y);

/**
* \brief Compute interpolation grid distance index
Expand Down
21 changes: 11 additions & 10 deletions glasscore/traveltime/src/TravelTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ double CTravelTime::T(double delta) {
// input distance/depth
double outTravelTime = bilinearInterpolation(
travelTime11, travelTime12, travelTime21, travelTime22,
distance1, distance2, depth1, depth2,
distance1, depth1, distance2, depth2,
inDistance, inDepth);

// check final trave ltime
// check final travel time
if (outTravelTime < 0) {
// no traveltime
return (k_dTravelTimeInvalid);
Expand Down Expand Up @@ -378,7 +378,7 @@ int CTravelTime::getIndexFromDistance(double distance) {
}
}

// ------------------------------------------------------getDepthFromIndex
// ------------------------------------------------------getDistanceFromIndex
double CTravelTime::getDistanceFromIndex(int index) {
if (m_dDistanceStep < 0) {
return (0);
Expand Down Expand Up @@ -433,9 +433,10 @@ double CTravelTime::getDepthFromIndex(int index) {
}

// -------------------------------------------------------bilinearInterpolation
double CTravelTime::bilinearInterpolation(double v11, double v12, double v21,
double v22, double x1, double x2, double y1, double y2, double x, double y) {
// check values
double CTravelTime::bilinearInterpolation(double q_x1y1, double q_x1y2,
double q_x2y1, double q_x2y2, double x1, double y1, double x2, double y2,
double x, double y) {
// check values to avoid div by 0
if ((x1 == x2) || (y1 == y2)) {
return(-1.0);
}
Expand All @@ -448,10 +449,10 @@ double CTravelTime::bilinearInterpolation(double v11, double v12, double v21,
double xx1 = x - x1;

return 1.0 / (x2x1 * y2y1) * (
v11 * x2x * y2y +
v21 * xx1 * y2y +
v12 * x2x * yy1 +
v22 * xx1 * yy1);
q_x1y1 * x2x * y2y +
q_x2y1 * xx1 * y2y +
q_x1y2 * x2x * yy1 +
q_x2y2 * xx1 * yy1);
}

// ---------------------------------------------------------T
Expand Down

0 comments on commit 271f02d

Please sign in to comment.