mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
clang-format : Added extension .inl
Applied clang-format on all files in ApplicationCode including new extension .inl. Also includes some missing clang-format on other files.
This commit is contained in:
parent
ae9575feb2
commit
651c28dc49
@ -64,7 +64,6 @@ double RiaWeightedMeanCalculator<T>::aggregatedWeight() const
|
|||||||
return m_aggregatedWeight;
|
return m_aggregatedWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -107,7 +107,9 @@ RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::RiaGrpcUnaryCallback(ServiceT*
|
|||||||
template <typename ServiceT, typename RequestT, typename ReplyT>
|
template <typename ServiceT, typename RequestT, typename ReplyT>
|
||||||
RiaGrpcCallbackInterface* RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::createNewFromThis() const
|
RiaGrpcCallbackInterface* RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::createNewFromThis() const
|
||||||
{
|
{
|
||||||
return new RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>(this->m_service, this->m_methodImpl, this->m_methodRequest);
|
return new RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>( this->m_service,
|
||||||
|
this->m_methodImpl,
|
||||||
|
this->m_methodRequest );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -150,7 +152,8 @@ QString RiaGrpcUnaryCallback<ServiceT, RequestT, ReplyT>::methodType() const
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
||||||
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcServerToClientStreamCallback(ServiceT* service,
|
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcServerToClientStreamCallback(
|
||||||
|
ServiceT* service,
|
||||||
MethodImplT methodImpl,
|
MethodImplT methodImpl,
|
||||||
MethodRequestT methodRequest,
|
MethodRequestT methodRequest,
|
||||||
StateHandlerT* stateHandler )
|
StateHandlerT* stateHandler )
|
||||||
@ -166,10 +169,13 @@ RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
||||||
RiaGrpcCallbackInterface* RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
|
RiaGrpcCallbackInterface*
|
||||||
|
RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
|
||||||
{
|
{
|
||||||
return new RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>(
|
return new RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>( this->m_service,
|
||||||
this->m_service, m_methodImpl, m_methodRequest, new StateHandlerT);
|
m_methodImpl,
|
||||||
|
m_methodRequest,
|
||||||
|
new StateHandlerT );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -248,12 +254,12 @@ QString RiaGrpcServerToClientStreamCallback<ServiceT, RequestT, ReplyT, StateHan
|
|||||||
return "StreamingMethod";
|
return "StreamingMethod";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
||||||
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcClientToServerStreamCallback(ServiceT* service,
|
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::RiaGrpcClientToServerStreamCallback(
|
||||||
|
ServiceT* service,
|
||||||
MethodImplT methodImpl,
|
MethodImplT methodImpl,
|
||||||
MethodRequestT methodRequest,
|
MethodRequestT methodRequest,
|
||||||
StateHandlerT* stateHandler )
|
StateHandlerT* stateHandler )
|
||||||
@ -269,10 +275,13 @@ RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
template <typename ServiceT, typename RequestT, typename ReplyT, typename StateHandlerT>
|
||||||
RiaGrpcCallbackInterface* RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
|
RiaGrpcCallbackInterface*
|
||||||
|
RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>::createNewFromThis() const
|
||||||
{
|
{
|
||||||
return new RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>(
|
return new RiaGrpcClientToServerStreamCallback<ServiceT, RequestT, ReplyT, StateHandlerT>( this->m_service,
|
||||||
this->m_service, m_methodImpl, m_methodRequest, new StateHandlerT(true));
|
m_methodImpl,
|
||||||
|
m_methodRequest,
|
||||||
|
new StateHandlerT( true ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -19,20 +19,21 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
#pragma warning( disable : 4503 )
|
#pragma warning( disable : 4503 )
|
||||||
namespace cvf
|
namespace cvf
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename DataType>
|
template <typename DataType>
|
||||||
DataType GeometryTools::interpolateQuad(const cvf::Vec3d& v1, DataType s1,
|
DataType GeometryTools::interpolateQuad( const cvf::Vec3d& v1,
|
||||||
const cvf::Vec3d& v2, DataType s2,
|
DataType s1,
|
||||||
const cvf::Vec3d& v3, DataType s3,
|
const cvf::Vec3d& v2,
|
||||||
const cvf::Vec3d& v4, DataType s4,
|
DataType s2,
|
||||||
|
const cvf::Vec3d& v3,
|
||||||
|
DataType s3,
|
||||||
|
const cvf::Vec3d& v4,
|
||||||
|
DataType s4,
|
||||||
const cvf::Vec3d& point )
|
const cvf::Vec3d& point )
|
||||||
{
|
{
|
||||||
cvf::Vec4d bc = barycentricCoords( v1, v2, v3, v4, point );
|
cvf::Vec4d bc = barycentricCoords( v1, v2, v3, v4, point );
|
||||||
@ -56,7 +57,6 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
{
|
{
|
||||||
CVF_ASSERT( polygon );
|
CVF_ASSERT( polygon );
|
||||||
|
|
||||||
|
|
||||||
// Check if vertex is directly included already
|
// Check if vertex is directly included already
|
||||||
|
|
||||||
for ( typename std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it )
|
for ( typename std::vector<IndexType>::iterator it = polygon->begin(); it != polygon->end(); ++it )
|
||||||
@ -80,7 +80,6 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
if ( existsOrInserted ) return true;
|
if ( existsOrInserted ) return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Copy the start polygon to a list
|
// Copy the start polygon to a list
|
||||||
|
|
||||||
std::list<IndexType> listPolygon;
|
std::list<IndexType> listPolygon;
|
||||||
@ -97,9 +96,13 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
for ( typename 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();
|
||||||
|
|
||||||
double sqDistToLine = GeometryTools::linePointSquareDist(nodeCoords[*it], nodeCoords[*it2], nodeCoords[vertexIndex]);
|
double sqDistToLine = GeometryTools::linePointSquareDist( nodeCoords[*it],
|
||||||
|
nodeCoords[*it2],
|
||||||
|
nodeCoords[vertexIndex] );
|
||||||
if ( fabs( sqDistToLine ) < tolerance * tolerance )
|
if ( fabs( sqDistToLine ) < tolerance * tolerance )
|
||||||
{
|
{
|
||||||
it = listPolygon.insert( insertBefore, vertexIndex );
|
it = listPolygon.insert( insertBefore, vertexIndex );
|
||||||
@ -118,7 +121,6 @@ bool GeometryTools::insertVertexInPolygon( std::vector<IndexType> * polygon,
|
|||||||
return existsOrInserted;
|
return existsOrInserted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// \brief Test if a point touches a polygon within the specified tolerance
|
/// \brief Test if a point touches a polygon within the specified tolerance
|
||||||
///
|
///
|
||||||
@ -227,7 +229,6 @@ bool GeometryTools::isPointTouchingIndexedPolygon( const cvf::Vec3d& polygonNor
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Returns true if we get an actual polygon
|
/// Returns true if we get an actual polygon
|
||||||
/// The returned polygon will keep the winding from the first face.
|
/// The returned polygon will keep the winding from the first face.
|
||||||
@ -330,7 +331,6 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
|
|
||||||
if ( numCv2VxesOnCv1 >= 4 )
|
if ( numCv2VxesOnCv1 >= 4 )
|
||||||
{
|
{
|
||||||
|
|
||||||
int k;
|
int k;
|
||||||
for ( k = 3; k >= 0; --k ) // Return opposite winding, to match winding of face 1
|
for ( k = 3; k >= 0; --k ) // Return opposite winding, to match winding of face 1
|
||||||
{
|
{
|
||||||
@ -352,7 +352,8 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
{
|
{
|
||||||
if ( nextCv1Idx > 3 ) nextCv1Idx = 0;
|
if ( nextCv1Idx > 3 ) nextCv1Idx = 0;
|
||||||
|
|
||||||
if (cv1VxTouchCv2[cv1Idx] && cv1VxTouchCv2Edge[cv1Idx] == -1) // Start of cv1 edge is touching inside the cv2 polygon (not on an cv2 edge)
|
if ( cv1VxTouchCv2[cv1Idx] &&
|
||||||
|
cv1VxTouchCv2Edge[cv1Idx] == -1 ) // Start of cv1 edge is touching inside the cv2 polygon (not on an cv2 edge)
|
||||||
{
|
{
|
||||||
if ( polygon->empty() || polygon->back() != cv1CubeFaceIndices[cv1Idx] )
|
if ( polygon->empty() || polygon->back() != cv1CubeFaceIndices[cv1Idx] )
|
||||||
{
|
{
|
||||||
@ -361,8 +362,8 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
|
|
||||||
if ( cv1VxTouchCv2[nextCv1Idx] && cv1VxTouchCv2Edge[nextCv1Idx] == -1 )
|
if ( cv1VxTouchCv2[nextCv1Idx] && cv1VxTouchCv2Edge[nextCv1Idx] == -1 )
|
||||||
{
|
{
|
||||||
// Both ends of this cv1 edge is touching inside(not on an edge) cv2 polygon, no intersections possible (assuming convex cube-face)
|
// Both ends of this cv1 edge is touching inside(not on an edge) cv2 polygon, no intersections possible
|
||||||
// Continue with next Cv1-edge.
|
// (assuming convex cube-face) Continue with next Cv1-edge.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,23 +413,25 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
double fractionAlongEdge2;
|
double fractionAlongEdge2;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if ( edgeIntersectionStorage )
|
if ( edgeIntersectionStorage )
|
||||||
found = edgeIntersectionStorage->findIntersection(
|
found = edgeIntersectionStorage->findIntersection( cv1CubeFaceIndices[cv1Idx],
|
||||||
cv1CubeFaceIndices[cv1Idx],
|
|
||||||
cv1CubeFaceIndices[nextCv1Idx],
|
cv1CubeFaceIndices[nextCv1Idx],
|
||||||
cv2CubeFaceIndices[cv2Idx],
|
cv2CubeFaceIndices[cv2Idx],
|
||||||
cv2CubeFaceIndices[nextCv2Idx],
|
cv2CubeFaceIndices[nextCv2Idx],
|
||||||
&intersectionVxIndex, &intersectStatus,
|
&intersectionVxIndex,
|
||||||
&fractionAlongEdge1, &fractionAlongEdge2);
|
&intersectStatus,
|
||||||
|
&fractionAlongEdge1,
|
||||||
|
&fractionAlongEdge2 );
|
||||||
|
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
{
|
||||||
|
|
||||||
intersectStatus = GeometryTools::inPlaneLineIntersect3D( normal,
|
intersectStatus = GeometryTools::inPlaneLineIntersect3D( normal,
|
||||||
nodes[cv1CubeFaceIndices[cv1Idx]],
|
nodes[cv1CubeFaceIndices[cv1Idx]],
|
||||||
nodes[cv1CubeFaceIndices[nextCv1Idx]],
|
nodes[cv1CubeFaceIndices[nextCv1Idx]],
|
||||||
nodes[cv2CubeFaceIndices[cv2Idx]],
|
nodes[cv2CubeFaceIndices[cv2Idx]],
|
||||||
nodes[cv2CubeFaceIndices[nextCv2Idx]],
|
nodes[cv2CubeFaceIndices[nextCv2Idx]],
|
||||||
&intersection, &fractionAlongEdge1, &fractionAlongEdge2,
|
&intersection,
|
||||||
|
&fractionAlongEdge1,
|
||||||
|
&fractionAlongEdge2,
|
||||||
tolerance );
|
tolerance );
|
||||||
|
|
||||||
switch ( intersectStatus )
|
switch ( intersectStatus )
|
||||||
@ -442,20 +445,30 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
break;
|
break;
|
||||||
case GeometryTools::LINES_TOUCH:
|
case GeometryTools::LINES_TOUCH:
|
||||||
{
|
{
|
||||||
if (fractionAlongEdge1 <= 0.0) intersectionVxIndex = cv1CubeFaceIndices[cv1Idx];
|
if ( fractionAlongEdge1 <= 0.0 )
|
||||||
else if (fractionAlongEdge1 >= 1.0) intersectionVxIndex = cv1CubeFaceIndices[nextCv1Idx];
|
intersectionVxIndex = cv1CubeFaceIndices[cv1Idx];
|
||||||
else if (fractionAlongEdge2 <= 0.0) intersectionVxIndex = cv2CubeFaceIndices[cv2Idx];
|
else if ( fractionAlongEdge1 >= 1.0 )
|
||||||
else if (fractionAlongEdge2 >= 1.0) intersectionVxIndex = cv2CubeFaceIndices[nextCv2Idx];
|
intersectionVxIndex = cv1CubeFaceIndices[nextCv1Idx];
|
||||||
else CVF_ASSERT(false); // Tolerance trouble
|
else if ( fractionAlongEdge2 <= 0.0 )
|
||||||
|
intersectionVxIndex = cv2CubeFaceIndices[cv2Idx];
|
||||||
|
else if ( fractionAlongEdge2 >= 1.0 )
|
||||||
|
intersectionVxIndex = cv2CubeFaceIndices[nextCv2Idx];
|
||||||
|
else
|
||||||
|
CVF_ASSERT( false ); // Tolerance trouble
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GeometryTools::LINES_OVERLAP:
|
case GeometryTools::LINES_OVERLAP:
|
||||||
{
|
{
|
||||||
if (fractionAlongEdge1 <= 0.0) intersectionVxIndex = cv1CubeFaceIndices[cv1Idx];
|
if ( fractionAlongEdge1 <= 0.0 )
|
||||||
else if (fractionAlongEdge1 >= 1.0) intersectionVxIndex = cv1CubeFaceIndices[nextCv1Idx];
|
intersectionVxIndex = cv1CubeFaceIndices[cv1Idx];
|
||||||
else if (fractionAlongEdge2 <= 0.0) intersectionVxIndex = cv2CubeFaceIndices[cv2Idx];
|
else if ( fractionAlongEdge1 >= 1.0 )
|
||||||
else if (fractionAlongEdge2 >= 1.0) intersectionVxIndex = cv2CubeFaceIndices[nextCv2Idx];
|
intersectionVxIndex = cv1CubeFaceIndices[nextCv1Idx];
|
||||||
else CVF_ASSERT(false); // Tolerance trouble
|
else if ( fractionAlongEdge2 <= 0.0 )
|
||||||
|
intersectionVxIndex = cv2CubeFaceIndices[cv2Idx];
|
||||||
|
else if ( fractionAlongEdge2 >= 1.0 )
|
||||||
|
intersectionVxIndex = cv2CubeFaceIndices[nextCv2Idx];
|
||||||
|
else
|
||||||
|
CVF_ASSERT( false ); // Tolerance trouble
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -467,17 +480,17 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
cv1CubeFaceIndices[nextCv1Idx],
|
cv1CubeFaceIndices[nextCv1Idx],
|
||||||
cv2CubeFaceIndices[cv2Idx],
|
cv2CubeFaceIndices[cv2Idx],
|
||||||
cv2CubeFaceIndices[nextCv2Idx],
|
cv2CubeFaceIndices[nextCv2Idx],
|
||||||
intersectionVxIndex, intersectStatus,
|
intersectionVxIndex,
|
||||||
fractionAlongEdge1, fractionAlongEdge2);
|
intersectStatus,
|
||||||
|
fractionAlongEdge1,
|
||||||
|
fractionAlongEdge2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store data for each intersection along the Cv1-edge
|
// Store data for each intersection along the Cv1-edge
|
||||||
|
|
||||||
if ( (intersectStatus == GeometryTools::LINES_CROSSES)
|
if ( ( intersectStatus == GeometryTools::LINES_CROSSES ) ||
|
||||||
|| (intersectStatus == GeometryTools::LINES_TOUCH)
|
( intersectStatus == GeometryTools::LINES_TOUCH ) || ( intersectStatus == GeometryTools::LINES_OVERLAP ) )
|
||||||
|| (intersectStatus == GeometryTools::LINES_OVERLAP) )
|
|
||||||
{
|
{
|
||||||
CVF_ASSERT( intersectionVxIndex != cvf::UNDEFINED_UINT );
|
CVF_ASSERT( intersectionVxIndex != cvf::UNDEFINED_UINT );
|
||||||
|
|
||||||
@ -530,8 +543,8 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
if intersected cv2 edge has endpoint touching cv1 then
|
if intersected cv2 edge has endpoint touching cv1 then
|
||||||
add endpoint to polygon. continue to add next endpoint until it does not touch Cv1
|
add endpoint to polygon. continue to add next endpoint until it does not touch Cv1
|
||||||
*/
|
*/
|
||||||
if ( !cv1VxTouchCv2[nextCv1Idx]
|
if ( !cv1VxTouchCv2[nextCv1Idx] &&
|
||||||
&& ( cv1VxTouchCv2[cv1Idx] || ( intersectedCv2EdgeIdxs.size() ) ) ) // Two touches along edge also qualifies
|
( cv1VxTouchCv2[cv1Idx] || ( intersectedCv2EdgeIdxs.size() ) ) ) // Two touches along edge also qualifies
|
||||||
{
|
{
|
||||||
if ( lastIntersection < intersectedCv2EdgeIdxs.size() )
|
if ( lastIntersection < intersectedCv2EdgeIdxs.size() )
|
||||||
{
|
{
|
||||||
@ -540,7 +553,9 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
// Continue the polygon along the Cv2 edges as long as they touch cv1.
|
// Continue the polygon along the Cv2 edges as long as they touch cv1.
|
||||||
// Depending on the faces having opposite winding, which is guaranteed as long as
|
// Depending on the faces having opposite winding, which is guaranteed as long as
|
||||||
// no intersecting CVs share a connection
|
// no intersecting CVs share a connection
|
||||||
while (cv2VxTouchCv1[cv2Idx] && count < 4 && (cv2VxTouchCv1Edge[cv2Idx] == -1)) // Touch of edge is regarded as being outside, so we must stop
|
while (
|
||||||
|
cv2VxTouchCv1[cv2Idx] && count < 4 &&
|
||||||
|
( cv2VxTouchCv1Edge[cv2Idx] == -1 ) ) // Touch of edge is regarded as being outside, so we must stop
|
||||||
{
|
{
|
||||||
if ( polygon->empty() || polygon->back() != cv2CubeFaceIndices[cv2Idx] )
|
if ( polygon->empty() || polygon->back() != cv2CubeFaceIndices[cv2Idx] )
|
||||||
{
|
{
|
||||||
@ -566,17 +581,16 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
// Sanity checks
|
// Sanity checks
|
||||||
if ( polygon->size() < 3 )
|
if ( polygon->size() < 3 )
|
||||||
{
|
{
|
||||||
// cvf::Trace::show(cvf::String("Degenerated connection polygon detected. (Less than 3 vertexes) Cv's probably not in contact: %1 , %2").arg(m_ownerCvId).arg(m_neighborCvId));
|
// cvf::Trace::show(cvf::String("Degenerated connection polygon detected. (Less than 3 vertexes) Cv's probably
|
||||||
|
// not in contact: %1 , %2").arg(m_ownerCvId).arg(m_neighborCvId));
|
||||||
polygon->clear();
|
polygon->clear();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// This method assumes that all intersection and mid edge vertexes are created an are already
|
/// This method assumes that all intersection and mid edge vertexes are created an are already
|
||||||
/// merged into all the polygons. We can also assume that all the connection polygons are completely
|
/// merged into all the polygons. We can also assume that all the connection polygons are completely
|
||||||
@ -587,7 +601,8 @@ bool GeometryTools::calculateOverlapPolygonOfTwoQuads(std::vector<IndexType> * p
|
|||||||
// template <typename NodeArrayType, typename NodeType, typename IndicesArrayType, typename IndicesType>
|
// template <typename NodeArrayType, typename NodeType, typename IndicesArrayType, typename IndicesType>
|
||||||
// void setup( ArrayWrapper<NodeArrayType, NodeType> nodeArray, ArrayWrapper<IndicesArrayType, IndicesType> indices)
|
// void setup( ArrayWrapper<NodeArrayType, NodeType> nodeArray, ArrayWrapper<IndicesArrayType, IndicesType> indices)
|
||||||
template <typename VerticeArrayType, typename PolygonArrayType, typename IndexType>
|
template <typename VerticeArrayType, typename PolygonArrayType, typename IndexType>
|
||||||
void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<VerticeArrayType, cvf::Vec3d> nodeCoords,
|
void GeometryTools::calculatePartiallyFreeCubeFacePolygon(
|
||||||
|
ArrayWrapperConst<VerticeArrayType, cvf::Vec3d> nodeCoords,
|
||||||
ArrayWrapperConst<PolygonArrayType, IndexType> completeFacePolygon,
|
ArrayWrapperConst<PolygonArrayType, IndexType> completeFacePolygon,
|
||||||
const cvf::Vec3d& faceNormal,
|
const cvf::Vec3d& faceNormal,
|
||||||
const std::vector<std::vector<IndexType>*>& faceOverlapPolygons,
|
const std::vector<std::vector<IndexType>*>& faceOverlapPolygons,
|
||||||
@ -641,7 +656,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
std::list<IndexType>::const_iterator polIt;
|
std::list<IndexType>::const_iterator polIt;
|
||||||
for ( polIt = resultPolygon.begin(); polIt != resultPolygon.end(); ++polIt )
|
for ( polIt = resultPolygon.begin(); polIt != resultPolygon.end(); ++polIt )
|
||||||
{
|
{
|
||||||
cvf::Trace::show(cvf::String("%1 \t%2 %3 %4").arg((int)(*polIt))
|
cvf::Trace::show( cvf::String( "%1 \t%2 %3 %4" )
|
||||||
|
.arg( (int)( *polIt ) )
|
||||||
.arg( nodeCoords[*polIt].x() )
|
.arg( nodeCoords[*polIt].x() )
|
||||||
.arg( nodeCoords[*polIt].y() )
|
.arg( nodeCoords[*polIt].y() )
|
||||||
.arg( nodeCoords[*polIt].z() ) );
|
.arg( nodeCoords[*polIt].z() ) );
|
||||||
@ -658,7 +674,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
cvf::Trace::show( "Connection " + cvf::String( (long long)cIdx ) );
|
cvf::Trace::show( "Connection " + cvf::String( (long long)cIdx ) );
|
||||||
for ( polIt = faceOverlapPolygons[cIdx]->begin(); polIt != faceOverlapPolygons[cIdx]->end(); ++polIt )
|
for ( polIt = faceOverlapPolygons[cIdx]->begin(); polIt != faceOverlapPolygons[cIdx]->end(); ++polIt )
|
||||||
{
|
{
|
||||||
cvf::Trace::show(cvf::String("%1 \t%2 %3 %4").arg((int)(*polIt))
|
cvf::Trace::show( cvf::String( "%1 \t%2 %3 %4" )
|
||||||
|
.arg( (int)( *polIt ) )
|
||||||
.arg( nodeCoords[*polIt].x() )
|
.arg( nodeCoords[*polIt].x() )
|
||||||
.arg( nodeCoords[*polIt].y() )
|
.arg( nodeCoords[*polIt].y() )
|
||||||
.arg( nodeCoords[*polIt].z() ) );
|
.arg( nodeCoords[*polIt].z() ) );
|
||||||
@ -675,7 +692,6 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
// merge the connection polygon into the main polygon,
|
// merge the connection polygon into the main polygon,
|
||||||
// and remove the connection polygon from the merge able connection polygons.
|
// and remove the connection polygon from the merge able connection polygons.
|
||||||
|
|
||||||
|
|
||||||
for ( typename 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
|
||||||
@ -703,7 +719,8 @@ 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
|
||||||
typename 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() )
|
||||||
{
|
{
|
||||||
@ -719,13 +736,16 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
if ( hasSameWinding )
|
if ( hasSameWinding )
|
||||||
{
|
{
|
||||||
// Same winding as main polygon. We need to go the opposite way
|
// Same winding as main polygon. We need to go the opposite way
|
||||||
if (startCPIt == faceOverlapPolygons[opIdx]->begin()) startCPIt = faceOverlapPolygons[opIdx]->end();
|
if ( startCPIt == faceOverlapPolygons[opIdx]->begin() )
|
||||||
|
startCPIt = faceOverlapPolygons[opIdx]->end();
|
||||||
--startCPIt;
|
--startCPIt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Opposite winding. Go forward when merging
|
// Opposite winding. Go forward when merging
|
||||||
++startCPIt; if (startCPIt == faceOverlapPolygons[opIdx]->end()) startCPIt = faceOverlapPolygons[opIdx]->begin();
|
++startCPIt;
|
||||||
|
if ( startCPIt == faceOverlapPolygons[opIdx]->end() )
|
||||||
|
startCPIt = faceOverlapPolygons[opIdx]->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate possible new edge-to-edge angle and test against existing angle
|
// Calculate possible new edge-to-edge angle and test against existing angle
|
||||||
@ -779,7 +799,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
// Now remove all double edges
|
// Now remove all double edges
|
||||||
|
|
||||||
bool goneAround = false;
|
bool goneAround = false;
|
||||||
for ( typename 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.
|
||||||
typename std::list<IndexType>::iterator nextPIt = pIt;
|
typename std::list<IndexType>::iterator nextPIt = pIt;
|
||||||
@ -803,7 +824,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
resultPolygon.erase( pIt );
|
resultPolygon.erase( pIt );
|
||||||
resultPolygon.erase( prevPIt );
|
resultPolygon.erase( prevPIt );
|
||||||
|
|
||||||
if ( resultPolygon.begin() == resultPolygon.end()) break; // Polygon has been completely removed. Nothing left. Break out of while
|
if ( resultPolygon.begin() == resultPolygon.end() )
|
||||||
|
break; // Polygon has been completely removed. Nothing left. Break out of while
|
||||||
|
|
||||||
pIt = nextPIt;
|
pIt = nextPIt;
|
||||||
++nextPIt;
|
++nextPIt;
|
||||||
@ -818,8 +840,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
--prevPIt;
|
--prevPIt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( resultPolygon.begin() == resultPolygon.end()) break; // Polygon has been completely removed. Nothing left. Break out of for loop
|
if ( resultPolygon.begin() == resultPolygon.end() )
|
||||||
|
break; // Polygon has been completely removed. Nothing left. Break out of for loop
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for holes
|
// Check for holes
|
||||||
@ -840,7 +862,8 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
cvf::Trace::show( "Polygon: " );
|
cvf::Trace::show( "Polygon: " );
|
||||||
for ( std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt )
|
for ( std::list<IndexType>::iterator pIt = resultPolygon.begin(); pIt != resultPolygon.end(); ++pIt )
|
||||||
{
|
{
|
||||||
cvf::Trace::show(cvf::String("%1 \t%2 %3 %4").arg((int)(*pIt))
|
cvf::Trace::show( cvf::String( "%1 \t%2 %3 %4" )
|
||||||
|
.arg( (int)( *pIt ) )
|
||||||
.arg( nodeCoords[*pIt].x() )
|
.arg( nodeCoords[*pIt].x() )
|
||||||
.arg( nodeCoords[*pIt].y() )
|
.arg( nodeCoords[*pIt].y() )
|
||||||
.arg( nodeCoords[*pIt].z() ) );
|
.arg( nodeCoords[*pIt].z() ) );
|
||||||
@ -857,8 +880,6 @@ void GeometryTools::calculatePartiallyFreeCubeFacePolygon(ArrayWrapperConst<Vert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -869,8 +890,13 @@ void EdgeIntersectStorage<IndexType>::setVertexCount(size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename IndexType>
|
template <typename IndexType>
|
||||||
void EdgeIntersectStorage<IndexType>::canonizeAddress(IndexType& e1P1, IndexType& e1P2, IndexType& e2P1, IndexType& e2P2,
|
void EdgeIntersectStorage<IndexType>::canonizeAddress( IndexType& e1P1,
|
||||||
bool& flipE1, bool& flipE2, bool& flipE1E2)
|
IndexType& e1P2,
|
||||||
|
IndexType& e2P1,
|
||||||
|
IndexType& e2P2,
|
||||||
|
bool& flipE1,
|
||||||
|
bool& flipE2,
|
||||||
|
bool& flipE1E2 )
|
||||||
{
|
{
|
||||||
flipE1 = e1P1 > e1P2;
|
flipE1 = e1P1 > e1P2;
|
||||||
flipE2 = e2P1 > e2P2;
|
flipE2 = e2P1 > e2P2;
|
||||||
@ -907,9 +933,14 @@ void EdgeIntersectStorage<IndexType>::canonizeAddress(IndexType& e1P1, IndexType
|
|||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename IndexType>
|
template <typename IndexType>
|
||||||
void EdgeIntersectStorage<IndexType>::addIntersection(IndexType e1P1, IndexType e1P2, IndexType e2P1, IndexType e2P2,
|
void EdgeIntersectStorage<IndexType>::addIntersection( IndexType e1P1,
|
||||||
IndexType vxIndexIntersectionPoint, GeometryTools::IntersectionStatus intersectionStatus,
|
IndexType e1P2,
|
||||||
double fractionAlongEdge1, double fractionAlongEdge2)
|
IndexType e2P1,
|
||||||
|
IndexType e2P2,
|
||||||
|
IndexType vxIndexIntersectionPoint,
|
||||||
|
GeometryTools::IntersectionStatus intersectionStatus,
|
||||||
|
double fractionAlongEdge1,
|
||||||
|
double fractionAlongEdge2 )
|
||||||
{
|
{
|
||||||
static bool flipE1;
|
static bool flipE1;
|
||||||
static bool flipE2;
|
static bool flipE2;
|
||||||
@ -935,15 +966,18 @@ void EdgeIntersectStorage<IndexType>::addIntersection(IndexType e1P1, IndexType
|
|||||||
m_edgeIntsectMap[e1P1][e1P2][e2P1][e2P2] = iData;
|
m_edgeIntsectMap[e1P1][e1P2][e2P1][e2P2] = iData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
template <typename IndexType>
|
template <typename IndexType>
|
||||||
bool EdgeIntersectStorage<IndexType>::findIntersection(IndexType e1P1, IndexType e1P2, IndexType e2P1, IndexType e2P2,
|
bool EdgeIntersectStorage<IndexType>::findIntersection( IndexType e1P1,
|
||||||
IndexType* vxIndexIntersectionPoint, GeometryTools::IntersectionStatus* intersectionStatus,
|
IndexType e1P2,
|
||||||
double* fractionAlongEdge1, double* fractionAlongEdge2)
|
IndexType e2P1,
|
||||||
|
IndexType e2P2,
|
||||||
|
IndexType* vxIndexIntersectionPoint,
|
||||||
|
GeometryTools::IntersectionStatus* intersectionStatus,
|
||||||
|
double* fractionAlongEdge1,
|
||||||
|
double* fractionAlongEdge2 )
|
||||||
{
|
{
|
||||||
static bool flipE1;
|
static bool flipE1;
|
||||||
static bool flipE2;
|
static bool flipE2;
|
||||||
@ -985,6 +1019,4 @@ bool EdgeIntersectStorage<IndexType>::findIntersection(IndexType e1P1, IndexType
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace cvf
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -17,9 +17,8 @@ TEST( RiaPolyArcLineSampler, Basic )
|
|||||||
#if 1
|
#if 1
|
||||||
for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx )
|
for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx )
|
||||||
{
|
{
|
||||||
std::cout << sampledPoints[pIdx].x() << " "
|
std::cout << sampledPoints[pIdx].x() << " " << sampledPoints[pIdx].y() << " " << sampledPoints[pIdx].z()
|
||||||
<< sampledPoints[pIdx].y() << " "
|
<< " md: " << mds[pIdx] << std::endl;
|
||||||
<< sampledPoints[pIdx].z() << " md: " << mds[pIdx] << std::endl;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
EXPECT_EQ( 55, (int)sampledPoints.size() );
|
EXPECT_EQ( 55, (int)sampledPoints.size() );
|
||||||
|
Loading…
Reference in New Issue
Block a user