Skip to content
Snippets Groups Projects
Commit 219b75b9 authored by Robert Maynard's avatar Robert Maynard
Browse files

Correct ComputeScalarRange when dealing with multiple components.

Change-Id: I4e441300a189d9f0c7f41c26378b8c05429d54b1
parent 074e1fe1
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,8 @@ void vtkDataArrayComputeScalarRange(InputIterator begin, InputIterator end,
minmaxRange[0] = *begin;
minmaxRange[1] = *begin;
//special case of a single value scalar range
//special case of a single value scalar range to help the compiler onroll
//the for loop
if(numberOfComponents == 1 && component == 0)
{
for(; begin != end; ++begin)
......@@ -199,7 +200,11 @@ void vtkDataArrayComputeScalarRange(InputIterator begin, InputIterator end,
}
else
{
for(; begin != end; begin+=numberOfComponents)
//Since we are dealing with arbitrary iterators instead of pointers
//we can't compute the exact end iterator value since the iterators them
//selves could check if they go out of bounds. So we have to use the less
//then operator to evaluate that our iterator is still valid.
for(; begin < end; begin+=numberOfComponents)
{
minmaxRange[0] = std::min(begin[component],minmaxRange[0]);
minmaxRange[1] = std::max(begin[component],minmaxRange[1]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment