mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
correct a potential divide by zero
This commit is contained in:
parent
a42bb1b0c7
commit
168952a0ce
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user