std::map<int, vtkPolyData*> HYDROData_Bathymetry::myDelaunay2D;
#endif
+inline double sqr( double x )
+{
+ return x*x;
+}
+
+HYDROData_Bathymetry::AltitudePoint::AltitudePoint( double x, double y, double z )
+{
+ X=x; Y=y; Z=z;
+}
+
+double HYDROData_Bathymetry::AltitudePoint::SquareDistance( const HYDROData_Bathymetry::AltitudePoint& p ) const
+{
+ double d = 0;
+ d += sqr( X - p.X );
+ d += sqr( Y - p.Y );
+ d += sqr( Z - p.Z );
+ return d;
+}
HYDROData_Bathymetry::HYDROData_Bathymetry()
: HYDROData_IAltitudeObject()
class HYDROData_Bathymetry : public HYDROData_IAltitudeObject
{
public:
- struct AltitudePoint
+ struct HYDRODATA_EXPORT AltitudePoint
{
- AltitudePoint( double x=0, double y=0, double z=0 ) { X=x; Y=y; Z=z; }
+ AltitudePoint( double x=0, double y=0, double z=0 );
double X;
double Y;
double Z;
+
+ double SquareDistance( const AltitudePoint& ) const;
};
typedef std::vector<AltitudePoint> AltitudePoints;
IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry )
-
HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ )
: myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ )
{
}
thePoints.reserve( sorted_points.size() );
+ const double EPS = 1E-12;
std::map<double, AltitudePoint>::const_iterator it = sorted_points.begin(), last = sorted_points.end();
for( ; it!=last; it++ )
- thePoints.push_back( it->second );
+ if( thePoints.empty() || thePoints.back().SquareDistance( it->second ) > EPS )
+ thePoints.push_back( it->second );
}
inline double max( double a, double b )