Correct how filterIntersections work, seems c++ don't like how thing were done.
This commit is contained in:
@@ -34,7 +34,7 @@ protected:
|
|||||||
|
|
||||||
bool intersectionAllowed(bool leftHit, bool inLeft, bool inRight);
|
bool intersectionAllowed(bool leftHit, bool inLeft, bool inRight);
|
||||||
|
|
||||||
Intersect filterIntersections(Intersect &xs);
|
void filterIntersections(Intersect &xs, Intersect &ret);
|
||||||
|
|
||||||
void updateBoundingBox();
|
void updateBoundingBox();
|
||||||
BoundingBox getBounds();
|
BoundingBox getBounds();
|
||||||
|
|||||||
@@ -101,13 +101,11 @@ bool CSG::intersectionAllowed(bool leftHit, bool inLeft, bool inRight)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intersect CSG::filterIntersections(Intersect &xs)
|
void CSG::filterIntersections(Intersect &xs, Intersect &ret)
|
||||||
{
|
{
|
||||||
bool inl = false;
|
bool inl = false;
|
||||||
bool inr = false;
|
bool inr = false;
|
||||||
|
|
||||||
Intersect ret = Intersect();
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < xs.count(); i++)
|
for(i = 0; i < xs.count(); i++)
|
||||||
@@ -128,8 +126,6 @@ Intersect CSG::filterIntersections(Intersect &xs)
|
|||||||
inr = !inr;
|
inr = !inr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSG::dumpMe(FILE *fp)
|
void CSG::dumpMe(FILE *fp)
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public:
|
|||||||
return this->intersectionAllowed(leftHit, inLeft, inRight);
|
return this->intersectionAllowed(leftHit, inLeft, inRight);
|
||||||
};
|
};
|
||||||
|
|
||||||
Intersect doFilterIntersections(Intersect &xs) {
|
void doFilterIntersections(Intersect &xs, Intersect &ret) {
|
||||||
return this->filterIntersections(xs);
|
this->filterIntersections(xs, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSGTest(OperationType operation, Shape *left, Shape *right) : CSG(operation, left, right) {};
|
CSGTest(OperationType operation, Shape *left, Shape *right) : CSG(operation, left, right) {};
|
||||||
@@ -186,7 +186,8 @@ TEST(CSGTest, Filtering_a_list_of_intersections)
|
|||||||
for(i = 0; i < testCount; i++)
|
for(i = 0; i < testCount; i++)
|
||||||
{
|
{
|
||||||
c.setOperation(testList[i]);
|
c.setOperation(testList[i]);
|
||||||
Intersect result = c.doFilterIntersections(xs);
|
Intersect result = Intersect();
|
||||||
|
c.doFilterIntersections(xs, result);
|
||||||
|
|
||||||
ASSERT_EQ(result.count(), 2);
|
ASSERT_EQ(result.count(), 2);
|
||||||
ASSERT_EQ(result[0], xs[testResults[i][0]]);
|
ASSERT_EQ(result[0], xs[testResults[i][0]]);
|
||||||
|
|||||||
Reference in New Issue
Block a user