mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
#11798 Use type definition from ClipperLib to avoid overflow
When converting a cvf::Vec3d to an integer vector, the platform int type was used as an intermediate variable. This caused overflow for large double values.
This commit is contained in:
parent
f6ab2f92d3
commit
4f8619d38c
@ -407,9 +407,10 @@ double clipperConversionFactor = 10000; // For transform to clipper int
|
||||
|
||||
ClipperLib::IntPoint toClipperPoint( const cvf::Vec3d& cvfPoint )
|
||||
{
|
||||
int xInt = cvfPoint.x() * clipperConversionFactor;
|
||||
int yInt = cvfPoint.y() * clipperConversionFactor;
|
||||
int zInt = cvfPoint.z() * clipperConversionFactor;
|
||||
ClipperLib::cInt xInt = cvfPoint.x() * clipperConversionFactor;
|
||||
ClipperLib::cInt yInt = cvfPoint.y() * clipperConversionFactor;
|
||||
ClipperLib::cInt zInt = cvfPoint.z() * clipperConversionFactor;
|
||||
|
||||
return ClipperLib::IntPoint( xInt, yInt, zInt );
|
||||
}
|
||||
|
||||
|
@ -566,9 +566,9 @@ double clipperConversionFactor2 = 10000; // For transform to clipper int
|
||||
|
||||
ClipperLib::IntPoint toClipperEdgePoint( const cvf::Vec3d& cvfPoint )
|
||||
{
|
||||
int xInt = cvfPoint.x() * clipperConversionFactor2;
|
||||
int yInt = cvfPoint.y() * clipperConversionFactor2;
|
||||
int zInt = cvfPoint.z();
|
||||
ClipperLib::cInt xInt = cvfPoint.x() * clipperConversionFactor2;
|
||||
ClipperLib::cInt yInt = cvfPoint.y() * clipperConversionFactor2;
|
||||
ClipperLib::cInt zInt = cvfPoint.z();
|
||||
return ClipperLib::IntPoint( xInt, yInt, zInt );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user