Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
31ba4cb5
Commit
31ba4cb5
authored
Sep 22, 2020
by
Kendrick, Coleman
Browse files
Simple tests on sphere before summing links function
parent
414a3eb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Framework/Geometry/test/CSGObjectTest.h
View file @
31ba4cb5
...
...
@@ -846,6 +846,56 @@ public:
TS_ASSERT_DELTA
(
axisLength
,
point
->
Z
(),
tolerance
);
}
void
testTracksForSphere
()
{
// Sphere centered at origin, 3 mm diameter
constexpr
double
RADIUS
{
0.0015
};
const
V3D
BEAM_X
{
1.0
,
0.0
,
0.0
};
const
V3D
BEAM_Y
{
0.0
,
1.0
,
0.0
};
const
V3D
BEAM_Z
{
0.0
,
0.0
,
1.0
};
auto
sphere
=
ComponentCreationHelper
::
createSphere
(
RADIUS
);
// Test center of sphere
Track
origin
(
V3D
{
0.0
,
0.0
,
0.0
},
BEAM_X
);
sphere
->
interceptSurface
(
origin
);
TS_ASSERT_EQUALS
(
origin
.
front
().
distInsideObject
,
RADIUS
);
Track
front_midpoint
(
V3D
{
0.5
*
RADIUS
,
0.0
,
0.0
},
BEAM_X
);
sphere
->
interceptSurface
(
front_midpoint
);
TS_ASSERT_EQUALS
(
front_midpoint
.
front
().
distInsideObject
,
0.5
*
RADIUS
);
Track
back_midpoint
(
V3D
{
-
0.5
*
RADIUS
,
0.0
,
0.0
},
BEAM_X
);
sphere
->
interceptSurface
(
back_midpoint
);
TS_ASSERT_EQUALS
(
back_midpoint
.
front
().
distInsideObject
,
1.5
*
RADIUS
);
// Y axis tests
origin
=
Track
(
V3D
{
0.0
,
0.0
,
0.0
},
BEAM_Y
);
sphere
->
interceptSurface
(
origin
);
TS_ASSERT_EQUALS
(
origin
.
front
().
distInsideObject
,
RADIUS
);
front_midpoint
=
Track
(
V3D
{
0.0
,
0.5
*
RADIUS
,
0.0
},
BEAM_Y
);
sphere
->
interceptSurface
(
front_midpoint
);
TS_ASSERT_EQUALS
(
front_midpoint
.
front
().
distInsideObject
,
0.5
*
RADIUS
);
back_midpoint
=
Track
(
V3D
{
0.0
,
-
0.5
*
RADIUS
,
0.0
},
BEAM_Y
);
sphere
->
interceptSurface
(
back_midpoint
);
TS_ASSERT_EQUALS
(
back_midpoint
.
front
().
distInsideObject
,
1.5
*
RADIUS
);
// Z axis tests
origin
=
Track
(
V3D
{
0.0
,
0.0
,
0.0
},
BEAM_Z
);
sphere
->
interceptSurface
(
origin
);
TS_ASSERT_EQUALS
(
origin
.
front
().
distInsideObject
,
RADIUS
);
front_midpoint
=
Track
(
V3D
{
0.0
,
0.0
,
0.5
*
RADIUS
},
BEAM_Z
);
sphere
->
interceptSurface
(
front_midpoint
);
TS_ASSERT_EQUALS
(
front_midpoint
.
front
().
distInsideObject
,
0.5
*
RADIUS
);
back_midpoint
=
Track
(
V3D
{
0.0
,
0.0
,
-
0.5
*
RADIUS
},
BEAM_Z
);
sphere
->
interceptSurface
(
back_midpoint
);
TS_ASSERT_EQUALS
(
back_midpoint
.
front
().
distInsideObject
,
1.5
*
RADIUS
);
}
void
testGeneratePointInsideSphere
()
{
using
namespace
::
testing
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment