// Fixed a twice-reverse of normals (revealed in bugs vis... tests).
}
// Normalize all vectors
- gp_Dir aNormal;
gp_XYZ aNormXYZ;
for (Standard_Integer aNodeIter = 0; aNodeIter < aNbNodes; ++aNodeIter)
{
aNormXYZ.SetCoord (aNormArr[anIndex + 0], aNormArr[anIndex + 1], aNormArr[anIndex + 2]);
const Standard_Real aMod2 = aNormXYZ.SquareModulus();
if (aMod2 > anEps2)
- aNormal = aNormXYZ;
+ {
+ aNormXYZ /= Sqrt (aMod2);
+ }
else
- aNormal = gp::DZ();
+ {
+ aNormXYZ = gp::DZ().XYZ();
+ }
// Set normal.
theTri->SetNormal (aNodeIter + 1, aNormXYZ);
if (aNode.IsFreeNode())
vecNodeId.SetValue(i, 0);
else {
+ vecNodeId.SetValue(i, ++aCount);
+
const gp_XYZ aNormal = aNode.GetNormal();
if (aNormal.SquareModulus() > Precision::Confusion()) {
aResult->SetNormal (aCount, static_cast<Standard_ShortReal>(aNormal.X()),
static_cast<Standard_ShortReal>(aNormal.Z()));
}
- vecNodeId.SetValue(i, ++aCount);
aResult->ChangeNode (aCount) = aNode;
-
aResult->ChangeUVNode (aCount) = gp_Pnt2d (aNode.GetU(), aNode.GetV());
if (aNode.GetU()*aNode.GetU() + aNode.GetV()*aNode.GetV() >
Precision::Confusion())
const Vec3f& theNormal)
{
// If an array for normals is not allocated yet, do it now.
- if (myNormals.IsEmpty())
+ if (myNormals.IsEmpty() || myNormals.Size() != myNodes.Size())
myNormals.Resize (1, myNodes.Size(), Standard_False);
// Set a normal.
{
aPoly->SetNormal (aNodeIter + 1, 0.0f, 0.0f, 1.0f);
}
- aPoly->SetNormal (aNodeIter + 1, aNorm.x(), aNorm.y(), aNorm.z());
}
}
myBndBox.Clear();
for (Standard_Integer aNodeIdx = 1; aNodeIdx <= myTriangul->NbNodes(); ++aNodeIdx)
{
- myBndBox.Add (SelectMgr_Vec3 (myTriangul->Node (aNodeIdx).X(),
- myTriangul->Node (aNodeIdx).Y(),
- myTriangul->Node (aNodeIdx).Z()));
+ const gp_Pnt& aNode = myTriangul->Node (aNodeIdx);
+ myBndBox.Add (SelectMgr_Vec3 (aNode.X(), aNode.Y(), aNode.Z()));
}
if (theIsInterior)
{
aPoint = aT->Node (aNodeIter);
gp_Dir aNorm = aNormals (aNodeIter);
- if ((aFace.Orientation() == TopAbs_REVERSED) ^ isMirrored)
- {
- aNorm.Reverse();
- }
if (!aLoc.IsIdentity())
{
aPoint.Transform (aTrsf);
aT->Triangle (aTriIter).Get (anIndex[0], anIndex[1], anIndex[2]);
}
- gp_Pnt aP1 = aT->Node (anIndex[0]);
- gp_Pnt aP2 = aT->Node (anIndex[1]);
- gp_Pnt aP3 = aT->Node (anIndex[2]);
+ const gp_Pnt& aP1 = aT->Node (anIndex[0]);
+ const gp_Pnt& aP2 = aT->Node (anIndex[1]);
+ const gp_Pnt& aP3 = aT->Node (anIndex[2]);
gp_Vec aV1 (aP1, aP2);
if (aV1.SquareMagnitude() <= aPreci)