Commit 4ce0ca67 authored by Kendrick, Coleman's avatar Kendrick, Coleman
Browse files

Added corner angle test, same pt check

parent a4ec2ec3
......@@ -131,7 +131,10 @@ void Track::addPoint(const TrackDirection direction, const V3D &endPoint,
direction, endPoint, endPoint.distance(m_line.getOrigin()), obj, compID);
auto lowestPtr =
std::lower_bound(m_surfPoints.begin(), m_surfPoints.end(), newPoint);
m_surfPoints.insert(lowestPtr, newPoint);
// Make sure same point isn't added twice
if (!(newPoint == *lowestPtr)) {
m_surfPoints.insert(lowestPtr, newPoint);
}
}
/**
......
......@@ -1007,6 +1007,20 @@ public:
TS_ASSERT_DELTA(origin.totalDistInsideObject(),
sqrt(pow(height, 2) + pow(base, 2)), TOLERANCE);
// Test sample at the top corner
BEAM_DIRECTION = V3D{0.0, HEIGHT * 0.5, RADIUS};
BEAM_DIRECTION.normalize();
ANGLE = atan((BEAM_DIRECTION.Y()) / BEAM_DIRECTION.Z());
origin = Track(V3D{0., 0., 0.}, BEAM_DIRECTION);
nsegments = cylinder->interceptSurface(origin);
TS_ASSERT_EQUALS(nsegments, 1);
// Since this is at the corner, triangle sides should be the same as the
// cylinder dimensions
TS_ASSERT_DELTA(origin.totalDistInsideObject(),
sqrt(pow(HEIGHT * 0.5, 2) + pow(RADIUS, 2)), TOLERANCE);
}
void testTracksForHollowCylinder() {
......
Supports Markdown
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