Commit 3e264b97 authored by LEFEBVREJP email's avatar LEFEBVREJP email
Browse files

Fixing aabb for grid.

parent 9a61f924
Pipeline #7089 skipped
......@@ -61,7 +61,7 @@ Grid::Grid(const Grid& orig)
Grid::Grid(Point3D lowerLeftCorner
, Real deltaX, Real deltaY, Real deltaZ
, int numX, int numY, int numZ)
: mTranslation(0, 0, 0)
: mTranslation(-lowerLeftCorner.x, -lowerLeftCorner.y, -lowerLeftCorner.z)
, mXPlanes(numX+1)
, mYPlanes(numY+1)
, mZPlanes(numZ+1)
......@@ -71,9 +71,9 @@ Grid::Grid(Point3D lowerLeftCorner
radix_check(mZPlanes.size() >= 2);
//
// Initialize first planes with lower left corner
mXPlanes[0] = lowerLeftCorner.x;
mYPlanes[0] = lowerLeftCorner.y;
mZPlanes[0] = lowerLeftCorner.z;
mXPlanes[0] = 0;
mYPlanes[0] = 0;
mZPlanes[0] = 0;
//
// auto populate grid with delta#
for(size_t i = 1; i < mXPlanes.size(); ++i)
......@@ -91,9 +91,9 @@ Grid::Grid(Point3D lowerLeftCorner
//
// Set bounds
mBounds = AABB(lowerLeftCorner
, Point3D(mXPlanes[mXPlanes.size()-1]
, mYPlanes[mYPlanes.size()-1]
, mZPlanes[mZPlanes.size()-1]));
, Point3D(lowerLeftCorner.x + mXPlanes[mXPlanes.size()-1]
, lowerLeftCorner.y + mYPlanes[mYPlanes.size()-1]
, lowerLeftCorner.z + mZPlanes[mZPlanes.size()-1]));
}
Grid::Grid(const std::vector<Real>&xplanes
......
......@@ -18,17 +18,6 @@ TEST(Grid, Constructor)
Real deltaX = 0.05, deltaY = 0.05;
Point3D point(-116.15, 37.16667, 0);
Grid grid(point, deltaX, deltaY, 1000, 40, 20, 5);
EXPECT_EQ(grid.xcount(), 41);
EXPECT_EQ(grid.ycount(), 21);
EXPECT_EQ(grid.zcount(), 6);
EXPECT_FLOAT_EQ(grid.xplanes()[0], point.x);
EXPECT_FLOAT_EQ(grid.yplanes()[0], point.y);
EXPECT_FLOAT_EQ(grid.zplanes()[0], point.z);
EXPECT_FLOAT_EQ(grid.xplanes()[40], point.x+(40*deltaX));
EXPECT_FLOAT_EQ(grid.yplanes()[20], point.y+(20*deltaY));
EXPECT_FLOAT_EQ(grid.zplanes()[5], point.z+5000);
// override the zplanes
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment