Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
b8f76fdf
Commit
b8f76fdf
authored
Aug 10, 2010
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX
#347
] encloses now accepts and rejects the points as desired. Adapted
test accordingly
parent
a58d2c86
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
src/dataHandler/WGridRegular3D.cpp
src/dataHandler/WGridRegular3D.cpp
+1
-1
src/dataHandler/WGridRegular3D.h
src/dataHandler/WGridRegular3D.h
+3
-2
src/dataHandler/test/WGridRegular3D_test.h
src/dataHandler/test/WGridRegular3D_test.h
+17
-2
No files found.
src/dataHandler/WGridRegular3D.cpp
View file @
b8f76fdf
...
...
@@ -389,7 +389,7 @@ int WGridRegular3D::getNVoxelCoord( const wmath::WPosition& pos, size_t axis ) c
break
;
default
:
WAssert
(
false
,
"Invalid axis selected, must be between 0 and 2, including 0 and 2."
);
}
if
(
result
<
0
||
result
>
offsetAxis
*
(
nbAxisPos
-
1
)
)
if
(
result
<
0
||
result
>
=
offsetAxis
*
(
nbAxisPos
-
1
)
)
{
return
-
1
;
}
...
...
src/dataHandler/WGridRegular3D.h
View file @
b8f76fdf
...
...
@@ -277,7 +277,7 @@ public:
\endverbatim
*
* Please note the first voxel has only 1/8 of the size a normal voxel
* would have since all positions outside the grid do
es
not belong
ing
* would have since all positions outside the grid do not belong
* to any voxel. Note: a cell is different to a voxel in terms of position.
* A voxel has a grid point as center whereas a cell has grid points as
* corners.
...
...
@@ -338,7 +338,8 @@ public:
wmath
::
WValue
<
int
>
getVoxelCoord
(
const
wmath
::
WPosition
&
pos
)
const
;
/**
* Computes the id of the cell containing the position pos.
* Computes the id of the cell containing the position pos. Note that the upper
* bound of the grid does not belong to any cell
*
* \param pos The position selecting the cell.
* \param success True if the position pos is inside the grid.
...
...
src/dataHandler/test/WGridRegular3D_test.h
View file @
b8f76fdf
...
...
@@ -564,9 +564,24 @@ public:
void
testEnclosesQuery
(
void
)
{
WGridRegular3D
g
(
2
,
2
,
2
,
1.
,
1.
,
1.
);
// Test bounds for X direction
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
0
-
wlimits
::
FLT_EPS
,
0
,
0
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
0
,
0
,
0
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
1.0
-
wlimits
::
FLT_EPS
,
0.5
,
0.5
)
)
);
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
1
,
0.5
,
0.5
)
)
);
// Test bounds for Y direction
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
0
,
0
-
wlimits
::
FLT_EPS
,
0
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
0
,
0
,
0
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
0.5
,
1.0
-
wlimits
::
FLT_EPS
,
0.5
)
)
);
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
0.5
,
1.0
,
0.5
)
)
);
// Test bounds for Z direction
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
0
,
0
,
0
-
wlimits
::
FLT_EPS
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
0
,
0
,
0
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
1
,
1
,
1
)
)
);
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
1
,
1
,
1.0
+
wlimits
::
DBL_EPS
)
)
);
TS_ASSERT
(
g
.
encloses
(
wmath
::
WPosition
(
0.5
,
0.5
,
1.0
-
wlimits
::
FLT_EPS
)
)
);
TS_ASSERT
(
!
g
.
encloses
(
wmath
::
WPosition
(
0.5
,
0.5
,
1
)
)
);
}
private:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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