///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018- Equinor ASA // Copyright (C) 2018- Ceetron Solutions AS // // Adapted from work by Paul D. Bourke named "conrec" // // http://paulbourke.net/papers/conrec/. // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cvfBase.h" #include "cvfVector2.h" #include "cvfVector3.h" #include #include #include #include namespace caf { class ContourLines { public: typedef std::pair LineSegment; typedef std::list ListOfLineSegments; static std::vector create(const std::vector& dataXY, const std::vector& xPositions, const std::vector& yPositions, const std::vector& contourLevels); private: static void create(const std::vector& dataXY, const std::vector& xPositions, const std::vector& yPositions, const std::vector& contourLevels, std::vector>* polygons); static double contourRange(const std::vector& contourLevels); static double invalidValue(const std::vector& contourLevels); static double saneValue(int index, const std::vector& dataXY, const std::vector& contourLevels); static double xsect(int p1, int p2, const std::vector& h, const std::vector& xh, const std::vector& yh); static double ysect(int p1, int p2, const std::vector& h, const std::vector& xh, const std::vector& yh); static int gridIndex1d(int i, int j, int nx); private: static const int s_castab[3][3][3]; }; }