check orientation when re-loading points from a proxy mesh

This commit is contained in:
eap 2013-05-31 11:56:32 +00:00
parent 3c2cd16c45
commit 083e873dfe

View File

@ -358,13 +358,18 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
{ {
const UVPtStructVec& edgeUVPtStruct = proxySubMesh[iE]->GetUVPtStructVec(); const UVPtStructVec& edgeUVPtStruct = proxySubMesh[iE]->GetUVPtStructVec();
std::copy( edgeUVPtStruct.begin(), edgeUVPtStruct.end(), & points[iPt] ); std::copy( edgeUVPtStruct.begin(), edgeUVPtStruct.end(), & points[iPt] );
// check orientation
double du1 = edgeUVPtStruct.back().param - edgeUVPtStruct[0].param;
double du2 = myLast[iE] - myFirst[iE];
if ( du1 * du2 < 0 )
std::reverse( & points[iPt], & points[iPt + edgeUVPtStruct.size()]);
// update normalized params // update normalized params
if ( myEdge.size() > 1 ) { if ( myEdge.size() > 1 ) {
for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i, ++iPt ) for ( size_t i = 0; i < edgeUVPtStruct.size(); ++i, ++iPt )
{ {
UVPtStruct & uvPt = points[iPt]; UVPtStruct & uvPt = points[iPt];
uvPt.normParam = prevNormPar + uvPt.normParam * paramSize; uvPt.normParam = prevNormPar + uvPt.normParam * paramSize;
uvPt.x = uvPt.y = uvPt.normParam; uvPt.x = uvPt.y = uvPt.normParam;
} }
--iPt; // to point to the 1st VERTEX of the next EDGE --iPt; // to point to the 1st VERTEX of the next EDGE
} }