Commit 168952a0 authored by Larsen, Matthew's avatar Larsen, Matthew
Browse files

correct a potential divide by zero

parent a42bb1b0
......@@ -181,7 +181,17 @@ public:
, FrameBuffer(frameBuffer.PrepareForExecution(DeviceTag(), token))
, FieldMin(vtkm::Float32(fieldRange.Min))
{
InverseFieldDelta = 1.0f / vtkm::Float32(fieldRange.Length());
vtkm::Float32 fieldLength = vtkm::Float32(fieldRange.Length());
if (fieldLength == 0.f)
{
// constant color
FieldMin = 0.f;
InverseFieldDelta = 1.f;
}
else
{
InverseFieldDelta = 1.0f / fieldLength;
}
Offset = vtkm::Max(0.03f / vtkm::Float32(clippingRange.Length()), 0.0001f);
}
......
Markdown is supported
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