Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Bauer
VTK
Commits
f0d0a0d6
Commit
f0d0a0d6
authored
Apr 19, 1995
by
Will Schroeder
Browse files
ERR: Fixed range computation bug.
parent
8fbe9d7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ContourF.cc
View file @
f0d0a0d6
...
...
@@ -34,7 +34,8 @@ vlContourFilter::~vlContourFilter()
}
// Description:
// Set a particular contour value at contour number i.
// Set a particular contour value at contour number i. The index i ranges
// between 0<=i<NumberOfContours.
void
vlContourFilter
::
SetValue
(
int
i
,
float
value
)
{
i
=
(
i
>=
MAX_CONTOURS
?
MAX_CONTOURS
-
1
:
(
i
<
0
?
0
:
i
)
);
...
...
@@ -42,7 +43,7 @@ void vlContourFilter::SetValue(int i, float value)
{
this
->
Modified
();
this
->
Values
[
i
]
=
value
;
if
(
i
>
NumberOfContours
)
this
->
NumberOfContours
=
i
;
if
(
i
>
=
this
->
NumberOfContours
)
this
->
NumberOfContours
=
i
+
1
;
if
(
value
<
this
->
Range
[
0
]
)
this
->
Range
[
0
]
=
value
;
if
(
value
>
this
->
Range
[
1
]
)
this
->
Range
[
1
]
=
value
;
}
...
...
@@ -50,21 +51,19 @@ void vlContourFilter::SetValue(int i, float value)
// Description:
// Generate numContours equally spaced contour values between specified
// range.
// range.
Contour values will include min/max range values.
void
vlContourFilter
::
GenerateValues
(
int
numContours
,
float
range
[
2
])
{
float
val
,
incr
;
int
i
;
numContours
=
(
numContours
>
=
MAX_CONTOURS
?
MAX_CONTOURS
-
1
:
(
numContours
<
0
?
0
:
numContours
)
);
numContours
=
(
numContours
>
MAX_CONTOURS
?
MAX_CONTOURS
:
(
numContours
>
1
?
numContours
:
2
)
);
if
(
numContours
<
1
)
numContours
=
1
;
incr
=
(
range
[
1
]
-
range
[
0
])
/
numContours
;
incr
=
(
range
[
1
]
-
range
[
0
])
/
(
numContours
-
1
);
for
(
i
=
0
,
val
=
range
[
0
];
i
<
numContours
;
i
++
,
val
+=
incr
)
{
this
->
SetValue
(
i
,
val
);
// don't modify object unless absolutely nec.
this
->
SetValue
(
i
,
val
);
}
}
...
...
Write
Preview
Supports
Markdown
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