BUG: cvMesh: Average plane C and plane D normals for the mitre point pair

This commit is contained in:
laurence
2012-01-24 12:51:35 +00:00
parent 83d81b7441
commit a98aecf98f

View File

@ -229,8 +229,8 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
Foam::point externalPtD; Foam::point externalPtD;
Foam::point externalPtE; Foam::point externalPtE;
vector convexEdgePlaneCNormal; vector convexEdgePlaneCNormal(0,0,0);
vector convexEdgePlaneDNormal; vector convexEdgePlaneDNormal(0,0,0);
const labelList& concaveEdgeNormals = edgeNormals[concaveEdgeI]; const labelList& concaveEdgeNormals = edgeNormals[concaveEdgeI];
const labelList& convexEdgeANormals = edgeNormals[convexEdgesI[0]]; const labelList& convexEdgeANormals = edgeNormals[convexEdgesI[0]];
@ -248,6 +248,11 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
const vector& convexNormal const vector& convexNormal
= normals[convexEdgeANormals[edgeAnormalI]]; = normals[convexEdgeANormals[edgeAnormalI]];
Info<< "Angle between vectors = "
<< degAngleBetween(concaveNormal, convexNormal) << endl;
// Need a looser tolerance, because sometimes adjacent triangles
// on the same surface will be slightly out of alignment.
if (areParallel(concaveNormal, convexNormal, tolParallel)) if (areParallel(concaveNormal, convexNormal, tolParallel))
{ {
convexEdgeA = true; convexEdgeA = true;
@ -261,6 +266,9 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
const vector& convexNormal const vector& convexNormal
= normals[convexEdgeBNormals[edgeBnormalI]]; = normals[convexEdgeBNormals[edgeBnormalI]];
Info<< "Angle between vectors = "
<< degAngleBetween(concaveNormal, convexNormal) << endl;
// Need a looser tolerance, because sometimes adjacent triangles // Need a looser tolerance, because sometimes adjacent triangles
// on the same surface will be slightly out of alignment. // on the same surface will be slightly out of alignment.
if (areParallel(concaveNormal, convexNormal, tolParallel)) if (areParallel(concaveNormal, convexNormal, tolParallel))
@ -269,15 +277,28 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
} }
} }
if (convexEdgeA && convexEdgeB) if ((convexEdgeA && convexEdgeB) || (!convexEdgeA && !convexEdgeB))
{ {
FatalErrorIn WarningIn
( (
"Foam::conformalVoronoiMesh" "Foam::conformalVoronoiMesh"
"::createSpecialisedFeaturePoint" "::createSpecialisedFeaturePoint"
) )
<< "Both convex edges share the concave edges normal!" << "Both or neither of the convex edges share the concave "
<< exit(FatalError); << "edge's normal."
<< " convexEdgeA = " << convexEdgeA
<< " convexEdgeB = " << convexEdgeB
<< endl;
// Remove points that have just been added before returning
for (label i = 0; i < 2; ++i)
{
pts.remove();
indices.remove();
types.remove();
}
return false;
} }
if (convexEdgeA) if (convexEdgeA)
@ -356,8 +377,9 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
// Add additional mitering points // Add additional mitering points
//scalar angleSign = 1.0; //scalar angleSign = 1.0;
vector convexEdgesPlaneNormal = convexEdgePlaneCNormal; Info<<convexEdgePlaneCNormal << " " <<convexEdgePlaneDNormal << endl;
vector convexEdgesPlaneNormal = 0.5*(convexEdgePlaneCNormal + convexEdgePlaneDNormal);
plane planeM(featPt, convexEdgesPlaneNormal); plane planeM(featPt, convexEdgesPlaneNormal);
// if // if