mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Linux compile fixes
This commit is contained in:
parent
63e945fedf
commit
5ca8911a68
@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "cvfGeometryTools.h"
|
#include "cvfGeometryTools.h"
|
||||||
#include "cvfBoundingBoxTree.h"
|
#include "cvfBoundingBoxTree.h"
|
||||||
#include <array>
|
|
||||||
|
|
||||||
using namespace cvf;
|
using namespace cvf;
|
||||||
|
|
||||||
@ -192,7 +191,7 @@ std::vector<caf::UintArray4> getCubeFaces()
|
|||||||
return cubeFaces;
|
return cubeFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<< (std::ostream& stream, std::vector<uint> v)
|
std::ostream& operator<< (std::ostream& stream, std::vector<cvf::uint> v)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < v.size(); ++i)
|
for (size_t i = 0; i < v.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -210,13 +209,13 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
|
|
||||||
std::vector<cvf::Vec3d> additionalVertices;
|
std::vector<cvf::Vec3d> additionalVertices;
|
||||||
|
|
||||||
std::vector< std::vector<uint> > overlapPolygons;
|
std::vector< std::vector<cvf::uint> > overlapPolygons;
|
||||||
std::vector<caf::UintArray4> faces = getCubeFaces();
|
std::vector<caf::UintArray4> faces = getCubeFaces();
|
||||||
|
|
||||||
EdgeIntersectStorage<uint> edgeIntersectionStorage;
|
EdgeIntersectStorage<cvf::uint> edgeIntersectionStorage;
|
||||||
edgeIntersectionStorage.setVertexCount(nodes.size());
|
edgeIntersectionStorage.setVertexCount(nodes.size());
|
||||||
{
|
{
|
||||||
std::vector<uint> polygon;
|
std::vector<cvf::uint> polygon;
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
||||||
&polygon,
|
&polygon,
|
||||||
@ -227,7 +226,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
faces[1].data(),
|
faces[1].data(),
|
||||||
1e-6);
|
1e-6);
|
||||||
|
|
||||||
EXPECT_EQ( 5, polygon.size());
|
EXPECT_EQ( (size_t)5, polygon.size());
|
||||||
EXPECT_EQ( (size_t)2, additionalVertices.size());
|
EXPECT_EQ( (size_t)2, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
overlapPolygons.push_back(polygon);
|
overlapPolygons.push_back(polygon);
|
||||||
@ -236,7 +235,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<uint> polygon;
|
std::vector<cvf::uint> polygon;
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
||||||
&polygon,
|
&polygon,
|
||||||
@ -247,7 +246,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
faces[2].data(),
|
faces[2].data(),
|
||||||
1e-6);
|
1e-6);
|
||||||
|
|
||||||
EXPECT_EQ( 5, polygon.size());
|
EXPECT_EQ( (size_t)5, polygon.size());
|
||||||
EXPECT_EQ( (size_t)4, additionalVertices.size());
|
EXPECT_EQ( (size_t)4, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
overlapPolygons.push_back(polygon);
|
overlapPolygons.push_back(polygon);
|
||||||
@ -256,7 +255,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<uint> polygon;
|
std::vector<cvf::uint> polygon;
|
||||||
bool isOk = false;
|
bool isOk = false;
|
||||||
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(
|
||||||
&polygon,
|
&polygon,
|
||||||
@ -267,7 +266,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
faces[3].data(),
|
faces[3].data(),
|
||||||
1e-6);
|
1e-6);
|
||||||
|
|
||||||
EXPECT_EQ( 3, polygon.size());
|
EXPECT_EQ( (size_t)3, polygon.size());
|
||||||
EXPECT_EQ( (size_t)6, additionalVertices.size());
|
EXPECT_EQ( (size_t)6, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
overlapPolygons.push_back(polygon);
|
overlapPolygons.push_back(polygon);
|
||||||
@ -275,10 +274,10 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nodes.insert(nodes.end(), additionalVertices.begin(), additionalVertices.end());
|
nodes.insert(nodes.end(), additionalVertices.begin(), additionalVertices.end());
|
||||||
std::vector<uint> basePolygon;
|
std::vector<cvf::uint> basePolygon;
|
||||||
basePolygon.insert(basePolygon.begin(), faces[0].data(), &(faces[0].data()[4]));
|
basePolygon.insert(basePolygon.begin(), faces[0].data(), &(faces[0].data()[4]));
|
||||||
|
|
||||||
for (uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx)
|
for (cvf::uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx)
|
||||||
{
|
{
|
||||||
bool inserted = GeometryTools::insertVertexInPolygon(
|
bool inserted = GeometryTools::insertVertexInPolygon(
|
||||||
&basePolygon,
|
&basePolygon,
|
||||||
@ -288,12 +287,12 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ( 8, basePolygon.size());
|
EXPECT_EQ( (size_t)8, basePolygon.size());
|
||||||
std::cout << "Bp: " << basePolygon << std::endl;
|
std::cout << "Bp: " << basePolygon << std::endl;
|
||||||
|
|
||||||
for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx)
|
for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx)
|
||||||
{
|
{
|
||||||
for (uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx)
|
for (cvf::uint vxIdx = 0; vxIdx < nodes.size(); ++vxIdx)
|
||||||
{
|
{
|
||||||
bool inserted = GeometryTools::insertVertexInPolygon(
|
bool inserted = GeometryTools::insertVertexInPolygon(
|
||||||
&overlapPolygons[pIdx],
|
&overlapPolygons[pIdx],
|
||||||
@ -305,15 +304,15 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
|
|
||||||
if (pIdx == 0)
|
if (pIdx == 0)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(5, overlapPolygons[pIdx].size());
|
EXPECT_EQ((size_t)5, overlapPolygons[pIdx].size());
|
||||||
}
|
}
|
||||||
if (pIdx == 1)
|
if (pIdx == 1)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(5, overlapPolygons[pIdx].size());
|
EXPECT_EQ((size_t)5, overlapPolygons[pIdx].size());
|
||||||
}
|
}
|
||||||
if (pIdx == 2)
|
if (pIdx == 2)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(4, overlapPolygons[pIdx].size());
|
EXPECT_EQ((size_t)4, overlapPolygons[pIdx].size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Op" << pIdx << ":" << overlapPolygons[pIdx] << std::endl;
|
std::cout << "Op" << pIdx << ":" << overlapPolygons[pIdx] << std::endl;
|
||||||
@ -325,10 +324,10 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
faceOverlapPolygonWindingSameAsCubeFaceFlags.resize(overlapPolygons.size(), true);
|
faceOverlapPolygonWindingSameAsCubeFaceFlags.resize(overlapPolygons.size(), true);
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<uint> freeFacePolygon;
|
std::vector<cvf::uint> freeFacePolygon;
|
||||||
bool hasHoles = false;
|
bool hasHoles = false;
|
||||||
|
|
||||||
std::vector< std::vector<uint>* > overlapPolygonPtrs;
|
std::vector< std::vector<cvf::uint>* > overlapPolygonPtrs;
|
||||||
for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx)
|
for (size_t pIdx = 0; pIdx < overlapPolygons.size(); ++pIdx)
|
||||||
{
|
{
|
||||||
overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx]));
|
overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx]));
|
||||||
@ -344,16 +343,16 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
&hasHoles
|
&hasHoles
|
||||||
);
|
);
|
||||||
|
|
||||||
EXPECT_EQ( 4, freeFacePolygon.size());
|
EXPECT_EQ( (size_t)4, freeFacePolygon.size());
|
||||||
EXPECT_FALSE(hasHoles);
|
EXPECT_FALSE(hasHoles);
|
||||||
std::cout << "FF1: " << freeFacePolygon << std::endl;
|
std::cout << "FF1: " << freeFacePolygon << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::vector<uint> freeFacePolygon;
|
std::vector<cvf::uint> freeFacePolygon;
|
||||||
bool hasHoles = false;
|
bool hasHoles = false;
|
||||||
|
|
||||||
std::vector< std::vector<uint>* > overlapPolygonPtrs;
|
std::vector< std::vector<cvf::uint>* > overlapPolygonPtrs;
|
||||||
for (size_t pIdx = 0; pIdx < 1; ++pIdx)
|
for (size_t pIdx = 0; pIdx < 1; ++pIdx)
|
||||||
{
|
{
|
||||||
overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx]));
|
overlapPolygonPtrs.push_back(&(overlapPolygons[pIdx]));
|
||||||
@ -369,7 +368,7 @@ TEST(CellFaceIntersectionTst, Intersection1)
|
|||||||
&hasHoles
|
&hasHoles
|
||||||
);
|
);
|
||||||
|
|
||||||
EXPECT_EQ( 9, freeFacePolygon.size());
|
EXPECT_EQ( (size_t)9, freeFacePolygon.size());
|
||||||
EXPECT_FALSE(hasHoles);
|
EXPECT_FALSE(hasHoles);
|
||||||
|
|
||||||
std::cout << "FF2: " << freeFacePolygon << std::endl;
|
std::cout << "FF2: " << freeFacePolygon << std::endl;
|
||||||
@ -414,7 +413,7 @@ TEST(CellFaceIntersectionTst, Intersection)
|
|||||||
|
|
||||||
bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
||||||
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
||||||
EXPECT_EQ( 4, polygon.size());
|
EXPECT_EQ( (size_t)4, polygon.size());
|
||||||
EXPECT_EQ( (size_t)0, additionalVertices.size());
|
EXPECT_EQ( (size_t)0, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
|
|
||||||
@ -432,7 +431,7 @@ TEST(CellFaceIntersectionTst, Intersection)
|
|||||||
|
|
||||||
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
||||||
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
||||||
EXPECT_EQ( 8, polygon.size());
|
EXPECT_EQ( (size_t)8, polygon.size());
|
||||||
EXPECT_EQ( (size_t)8, additionalVertices.size());
|
EXPECT_EQ( (size_t)8, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
|
|
||||||
@ -475,7 +474,7 @@ TEST(CellFaceIntersectionTst, FreeFacePolygon)
|
|||||||
|
|
||||||
bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
bool isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
||||||
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
||||||
EXPECT_EQ( 4, polygon.size());
|
EXPECT_EQ( (size_t)4, polygon.size());
|
||||||
EXPECT_EQ( (size_t)0, additionalVertices.size());
|
EXPECT_EQ( (size_t)0, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
|
|
||||||
@ -509,7 +508,7 @@ TEST(CellFaceIntersectionTst, FreeFacePolygon)
|
|||||||
|
|
||||||
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
isOk = GeometryTools::calculateOverlapPolygonOfTwoQuads(&polygon, &additionalVertices, edgeIntersectionStorage,
|
||||||
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
wrapArrayConst(&nodes), cv1CubeFaceIndices, cv2CubeFaceIndices, 1e-6);
|
||||||
EXPECT_EQ( 8, polygon.size());
|
EXPECT_EQ( (size_t)8, polygon.size());
|
||||||
EXPECT_EQ( (size_t)8, additionalVertices.size());
|
EXPECT_EQ( (size_t)8, additionalVertices.size());
|
||||||
EXPECT_TRUE(isOk);
|
EXPECT_TRUE(isOk);
|
||||||
|
|
||||||
|
@ -922,4 +922,4 @@ bool FanEarClipTesselator::isTriangleValid(size_t u, size_t v, size_t w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "cvfArray.h"
|
#include "cvfArray.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <hash_map>
|
|
||||||
#include "cvfArrayWrapperConst.h"
|
#include "cvfArrayWrapperConst.h"
|
||||||
|
|
||||||
namespace cvf
|
namespace cvf
|
||||||
@ -165,4 +164,4 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "cvfGeometryTools.inl"
|
#include "cvfGeometryTools.inl"
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
#pragma warning (disable : 4503)
|
#pragma warning (disable : 4503)
|
||||||
namespace cvf
|
namespace cvf
|
||||||
@ -22,7 +24,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
|
|
||||||
// Check if vertex is directly included already
|
// Check if vertex is directly included already
|
||||||
|
|
||||||
for(std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it)
|
for(typename std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it)
|
||||||
{
|
{
|
||||||
if (*it == vertexIndex) return true;
|
if (*it == vertexIndex) return true;
|
||||||
}
|
}
|
||||||
@ -31,7 +33,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
// Check if the new point is within tolerance of one of the polygon vertices
|
// Check if the new point is within tolerance of one of the polygon vertices
|
||||||
|
|
||||||
bool existsOrInserted = false;
|
bool existsOrInserted = false;
|
||||||
for(std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it)
|
for(typename std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it)
|
||||||
{
|
{
|
||||||
if ( (nodeCoords[*it] - nodeCoords[vertexIndex]).length() < tolerance)
|
if ( (nodeCoords[*it] - nodeCoords[vertexIndex]).length() < tolerance)
|
||||||
{
|
{
|
||||||
@ -54,10 +56,10 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
|
|
||||||
// Insert vertex in polygon if the distance to one of the edges is small enough
|
// Insert vertex in polygon if the distance to one of the edges is small enough
|
||||||
|
|
||||||
std::list<IndexType >::iterator it2;
|
typename std::list<IndexType >::iterator it2;
|
||||||
std::list<IndexType >::iterator insertBefore;
|
typename std::list<IndexType >::iterator insertBefore;
|
||||||
|
|
||||||
for (std::list<IndexType >::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it)
|
for (typename std::list<IndexType >::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it)
|
||||||
{
|
{
|
||||||
it2 = it;
|
it2 = it;
|
||||||
++it2; insertBefore = it2; if (it2 == listPolygon.end()) it2 = listPolygon.begin();
|
++it2; insertBefore = it2; if (it2 == listPolygon.end()) it2 = listPolygon.begin();
|
||||||
@ -73,7 +75,7 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
// Write polygon back into the vector
|
// Write polygon back into the vector
|
||||||
|
|
||||||
polygon->clear();
|
polygon->clear();
|
||||||
for (std::list<IndexType >::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it)
|
for (typename std::list<IndexType >::iterator it = listPolygon.begin(); it != listPolygon.end(); ++it)
|
||||||
{
|
{
|
||||||
polygon->push_back(*it);
|
polygon->push_back(*it);
|
||||||
}
|
}
|
||||||
@ -472,7 +474,7 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
sortingMap[intersectionFractionsAlongEdge[i]] = intersectionVxIndices[i];
|
sortingMap[intersectionFractionsAlongEdge[i]] = intersectionVxIndices[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<double, IndexType>::iterator it;
|
typename std::map<double, IndexType>::iterator it;
|
||||||
for (it = sortingMap.begin(); it != sortingMap.end(); ++it)
|
for (it = sortingMap.begin(); it != sortingMap.end(); ++it)
|
||||||
{
|
{
|
||||||
if (polygon->empty() || polygon->back() != it->second)
|
if (polygon->empty() || polygon->back() != it->second)
|
||||||
@ -557,7 +559,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
bool* m_partiallyFreeCubeFaceHasHoles)
|
bool* m_partiallyFreeCubeFaceHasHoles)
|
||||||
{
|
{
|
||||||
// Vertex Index to position in polygon
|
// Vertex Index to position in polygon
|
||||||
typedef std::map< IndexType, std::vector<IndexType>::const_iterator > VxIdxToPolygonPositionMap;
|
typedef std::map< IndexType, typename std::vector<IndexType>::const_iterator > VxIdxToPolygonPositionMap;
|
||||||
|
|
||||||
CVF_ASSERT(m_partiallyFreeCubeFaceHasHoles);
|
CVF_ASSERT(m_partiallyFreeCubeFaceHasHoles);
|
||||||
CVF_ASSERT(partialFacePolygon != NULL);
|
CVF_ASSERT(partialFacePolygon != NULL);
|
||||||
@ -584,7 +586,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
for (size_t i = 0; i < faceOverlapPolygons.size(); ++i)
|
for (size_t i = 0; i < faceOverlapPolygons.size(); ++i)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (std::vector<IndexType >::const_iterator pcIt = faceOverlapPolygons[i]->begin();
|
for (typename std::vector<IndexType >::const_iterator pcIt = faceOverlapPolygons[i]->begin();
|
||||||
pcIt != faceOverlapPolygons[i]->end();
|
pcIt != faceOverlapPolygons[i]->end();
|
||||||
++pcIt)
|
++pcIt)
|
||||||
{
|
{
|
||||||
@ -637,19 +639,19 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
// and remove the connection polygon from the merge able connection polygons.
|
// and remove the connection polygon from the merge able connection polygons.
|
||||||
|
|
||||||
|
|
||||||
for (std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt)
|
for (typename std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt)
|
||||||
{
|
{
|
||||||
// Set iterator to previous node in polygon
|
// Set iterator to previous node in polygon
|
||||||
std::list<IndexType>::iterator prevPIt = pIt;
|
typename std::list<IndexType>::iterator prevPIt = pIt;
|
||||||
if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end();
|
if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end();
|
||||||
--prevPIt;
|
--prevPIt;
|
||||||
|
|
||||||
cvf::Vec3d pToPrev = nodeCoords[*prevPIt] - nodeCoords[*pIt];
|
cvf::Vec3d pToPrev = nodeCoords[*prevPIt] - nodeCoords[*pIt];
|
||||||
|
|
||||||
// Set iterator to next node in polygon. Used to insert before and as pointer to the next point
|
// Set iterator to next node in polygon. Used to insert before and as pointer to the next point
|
||||||
std::list<IndexType>::iterator nextPIt = pIt;
|
typename std::list<IndexType>::iterator nextPIt = pIt;
|
||||||
++nextPIt;
|
++nextPIt;
|
||||||
std::list<IndexType>::iterator insertBeforePIt = nextPIt;
|
typename std::list<IndexType>::iterator insertBeforePIt = nextPIt;
|
||||||
if (nextPIt == resultPolygon.end()) nextPIt = resultPolygon.begin();
|
if (nextPIt == resultPolygon.end()) nextPIt = resultPolygon.begin();
|
||||||
|
|
||||||
// Calculate existing edge to edge angle
|
// Calculate existing edge to edge angle
|
||||||
@ -664,14 +666,14 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
if (isConnectionPolygonMerged[opIdx]) continue; // Already merged
|
if (isConnectionPolygonMerged[opIdx]) continue; // Already merged
|
||||||
|
|
||||||
// Find position of pIt vertex index in the current connection polygon
|
// Find position of pIt vertex index in the current connection polygon
|
||||||
VxIdxToPolygonPositionMap::iterator vxIndexPositionInPolygonIt = polygonSearchMaps[opIdx].find(*pIt);
|
typename VxIdxToPolygonPositionMap::iterator vxIndexPositionInPolygonIt = polygonSearchMaps[opIdx].find(*pIt);
|
||||||
|
|
||||||
if (vxIndexPositionInPolygonIt != polygonSearchMaps[opIdx].end())
|
if (vxIndexPositionInPolygonIt != polygonSearchMaps[opIdx].end())
|
||||||
{
|
{
|
||||||
// Merge the connection polygon into the main polygon
|
// Merge the connection polygon into the main polygon
|
||||||
// if the angle prevPIt pIt nextPIt is larger than angle prevPIt pIt (startCPIt++)
|
// if the angle prevPIt pIt nextPIt is larger than angle prevPIt pIt (startCPIt++)
|
||||||
|
|
||||||
std::vector<IndexType>::const_iterator startCPIt;
|
typename std::vector<IndexType>::const_iterator startCPIt;
|
||||||
startCPIt = vxIndexPositionInPolygonIt->second;
|
startCPIt = vxIndexPositionInPolygonIt->second;
|
||||||
|
|
||||||
// First vx to insert is the one after the match
|
// First vx to insert is the one after the match
|
||||||
@ -696,7 +698,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
if (candidatePolygonEdgeAngle < mainPolygonEdgeAngle )
|
if (candidatePolygonEdgeAngle < mainPolygonEdgeAngle )
|
||||||
{
|
{
|
||||||
// Merge ok
|
// Merge ok
|
||||||
std::vector<IndexType >::const_iterator pcIt = startCPIt;
|
typename std::vector<IndexType >::const_iterator pcIt = startCPIt;
|
||||||
if (hasSameWinding)
|
if (hasSameWinding)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@ -740,10 +742,10 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
// Now remove all double edges
|
// Now remove all double edges
|
||||||
|
|
||||||
bool goneAround = false;
|
bool goneAround = false;
|
||||||
for ( std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end() && !goneAround; ++pIt)
|
for ( typename std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end() && !goneAround; ++pIt)
|
||||||
{
|
{
|
||||||
// Set iterator to next node in polygon.
|
// Set iterator to next node in polygon.
|
||||||
std::list<IndexType>::iterator nextPIt = pIt;
|
typename std::list<IndexType>::iterator nextPIt = pIt;
|
||||||
++nextPIt;
|
++nextPIt;
|
||||||
if (nextPIt == resultPolygon.end())
|
if (nextPIt == resultPolygon.end())
|
||||||
{
|
{
|
||||||
@ -753,7 +755,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
|
|
||||||
// Set iterator to previous node in polygon
|
// Set iterator to previous node in polygon
|
||||||
|
|
||||||
std::list<IndexType>::iterator prevPIt = pIt;
|
typename std::list<IndexType>::iterator prevPIt = pIt;
|
||||||
|
|
||||||
if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end();
|
if (prevPIt == resultPolygon.begin()) prevPIt = resultPolygon.end();
|
||||||
--prevPIt;
|
--prevPIt;
|
||||||
@ -812,7 +814,7 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
// Copy the result polygon to the output variable
|
// Copy the result polygon to the output variable
|
||||||
|
|
||||||
partialFacePolygon->clear();
|
partialFacePolygon->clear();
|
||||||
for (std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt)
|
for (typename std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt)
|
||||||
{
|
{
|
||||||
partialFacePolygon->push_back(*pIt);
|
partialFacePolygon->push_back(*pIt);
|
||||||
}
|
}
|
||||||
@ -914,15 +916,15 @@ bool EdgeIntersectStorage<IndexType>::findIntersection(IndexType e1P1, IndexType
|
|||||||
|
|
||||||
if (!m_edgeIntsectMap[e1P1].size()) return false;
|
if (!m_edgeIntsectMap[e1P1].size()) return false;
|
||||||
|
|
||||||
std::map<IndexType, std::map<IndexType, std::map<IndexType, IntersectData > > >::iterator it;
|
typename std::map<IndexType, std::map<IndexType, std::map<IndexType, IntersectData > > >::iterator it;
|
||||||
it = m_edgeIntsectMap[e1P1].find(e1P2);
|
it = m_edgeIntsectMap[e1P1].find(e1P2);
|
||||||
if (it == m_edgeIntsectMap[e1P1].end()) return false;
|
if (it == m_edgeIntsectMap[e1P1].end()) return false;
|
||||||
|
|
||||||
std::map<IndexType, std::map<IndexType, IntersectData > >::iterator it2;
|
typename std::map<IndexType, std::map<IndexType, IntersectData > >::iterator it2;
|
||||||
it2 = it->second.find(e2P1);
|
it2 = it->second.find(e2P1);
|
||||||
if (it2 == it->second.end()) return false;
|
if (it2 == it->second.end()) return false;
|
||||||
|
|
||||||
std::map<IndexType, IntersectData >::iterator it3;
|
typename std::map<IndexType, IntersectData >::iterator it3;
|
||||||
it3 = it2->second.find(e2P2);
|
it3 = it2->second.find(e2P2);
|
||||||
if (it3 == it2->second.end()) return false;
|
if (it3 == it2->second.end()) return false;
|
||||||
|
|
||||||
@ -948,4 +950,4 @@ bool EdgeIntersectStorage<IndexType>::findIntersection(IndexType e1P1, IndexType
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -150,4 +150,4 @@ inline const ArrayWrapperConst< const ElmType*, ElmType > wrapArrayConst( ElmTy
|
|||||||
return warr;
|
return warr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -129,4 +129,4 @@ inline ArrayWrapperToEdit< ElmType*, ElmType > wrapArrayToEdit(ElmType* array, s
|
|||||||
return warr;
|
return warr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user