+static bool getNodeElemDistance (SMESH::Measure& theMeasure,
+ const SMDS_MeshNode* theNode,
+ SMESH_ElementSearcher* theElemSearcher)
+{
+ if ( !theNode || !theElemSearcher )
+ return false;
+
+ const SMDS_MeshElement* closestElement = 0;
+ gp_Pnt point = SMESH_NodeXYZ( theNode );
+ gp_Pnt closestPoint = theElemSearcher->Project( point, SMDSAbs_All, &closestElement );
+
+ if ( closestElement )
+ {
+ theMeasure.value = point.Distance( closestPoint );
+ theMeasure.node1 = theNode->GetID();
+ theMeasure.elem2 = closestElement->GetID();
+ theMeasure.maxX = closestPoint.X();
+ theMeasure.maxY = closestPoint.Y();
+ theMeasure.maxZ = closestPoint.Z();
+ theMeasure.minX = closestPoint.X() - point.X();
+ theMeasure.minY = closestPoint.Y() - point.Y();
+ theMeasure.minZ = closestPoint.Z() - point.Z();
+ }
+
+ return closestElement;
+}
+