Skip to content

Commit

Permalink
Removed outdated comments and verbose output from PhysicsEngine_test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mankarse committed Sep 19, 2017
1 parent 001b96c commit 2b59221
Showing 1 changed file with 6 additions and 64 deletions.
70 changes: 6 additions & 64 deletions src/PhysicsEngine_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,34 +218,6 @@ Rectangle Collision
(in this case,
I can't see any good reason to make the edges non-inclusive
and making the edges also inclusive seem the most natural, to me;
))
*/



bool testGetRaytraceRectangleCollision() {

/*
Rectanlge is half-open range:
*_______o
| :
| :
| :
| :
o- - - -o
All shots that originate within the rectangle should hit the rectangle at their start-point
All shots aimed diagonally into any corner should hit that corner.
All completely horizontal shots aimed at the top-right corner should hit this corner
All completely vertical shots aimed at the bottom-left corner should hit this corner
All shots aimed at the top-left corner from any direction should hit the
top-left corner.
For glancing shots, imagine a set of tangent lines (that continues around corners, including all directions between the two sides adjacent to the corner).
For the top-left corner, and the top and left sides, the tangent line should hit the rectangle, for all other sides/corners, the tangent line should miss the rectangle.
Rounding:
Should always be exactly on line in one dimension (no rounding here)
Expand All @@ -267,9 +239,12 @@ Rectangle Collision
+x -y -> floor x, floor y
-x +y -> ceil x, ceil y
-x -y -> floor x, ceil y
*/
))
*/



bool testGetRaytraceRectangleCollision() {
//TODO
//Foreach 8 starting points (midpoints of edges/corners)
// Foreach 16 shooting directions
Expand Down Expand Up @@ -339,8 +314,8 @@ Rectangle Collision
//For each corner, test horizontal/vertical shots starting from outside the corner
//and aimed beyond the other side of the rectangle (inline with the horizontal/vertical edge starting from the given corner)
//
//This test is checking the handling of the half-open range edge condition for exactly horizontal/vertical lines that go exactly along the edge of the rectangle.
//The top/left edges should be hit and the bottom/right edges should not be hit
//This test is checking the handling of the edge condition for exactly horizontal/vertical lines that go exactly along the edge of the rectangle.
//The all edges should be hit

for (int xpos = -1; xpos <= 1; xpos += 2) {
for (int ypos = -1; ypos <= 1; ypos += 2) {
Expand Down Expand Up @@ -444,15 +419,6 @@ Rectangle Collision
int const aimx = sx + xdir * 5000;
int const aimy = sy + ydir * 5000;

if (xpos == 0 &&
ypos == 1 &&
xdir == -1 &&
ydir == -2 &&
startInside == 0)
{
std::cout << "Here\n";
}

//TODO: test a whole bunch of different aim lengths
auto const collisionResult = getRaytraceRectangleCollision(
sx, sy,
Expand Down Expand Up @@ -558,13 +524,6 @@ Rectangle Collision
int const aimx = sx - (verticalLine ? 0 : xpos * (segmentSize + rectanglewidth));
int const aimy = sy - (!verticalLine ? 0 : ypos * (segmentSize + rectangleheight));

if (xpos == -1
&& ypos == 1
&& verticalLine == 0)
{
std::cout << "Here\n";
}

auto const collisionResult = doGunWallRaytrace(
actualWall,
sx, sy,
Expand Down Expand Up @@ -598,14 +557,6 @@ Rectangle Collision
auto const sx = aimx + xstartdir * segmentSize/2;
auto const sy = aimy + ystartdir * segmentSize/2;

if (xpos == -1
&& ypos == 1
&& xstartdir == 1
&& ystartdir == 0)
{
std::cout << "Here\n";
}

//TODO: test a whole bunch of different aim lengths
auto const collisionResult = doGunWallRaytrace(
actualWall,
Expand Down Expand Up @@ -653,15 +604,6 @@ Rectangle Collision
int const aimx = sx + xdir * 5000;
int const aimy = sy + ydir * 5000;

if (xpos == 0 &&
ypos == -1 &&
xdir == -1 &&
ydir == 2 &&
startInside == 0)
{
std::cout << "Here\n";
}

//TODO: test a whole bunch of different aim lengths
auto const collisionResult = doGunWallRaytrace(
actualWall,
Expand Down

0 comments on commit 2b59221

Please sign in to comment.