// if (myQuadtree->isEmpty() )
if (myQuadtrees.find(labkey) == myQuadtrees.end())
{
- DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
+ //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey);
HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.);
myQuadtrees[labkey] = aQuadtree;
TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
index++;
aListOfNodes->push_back(aPoint);
}
- DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute");
+ //DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute");
aQuadtree->setNodesAndCompute(aListOfNodes);
return aQuadtree;
}
//DEBTRACE("GetVtkDelaunay2D this labkey altkey "<<this<<" "<<labkey<<" "<<altkey);
if (myDelaunay2D.find(labkey) == myDelaunay2D.end())
{
- DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
+ //DEBTRACE("GetVtkDelaunay2D init " << this << " " << labkey);
TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false);
if (aLabel.IsNull())
}
vtkPolyData* profile = vtkPolyData::New();
profile->SetPoints(points);
- DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
+ //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints());
vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New();
delaunay2D->SetInputData(profile);
int nbPts = triangle->GetNumberOfIds();
if (nbPts != 3)
{
- DEBTRACE("not a triangle ?");
+ //DEBTRACE("not a triangle ?");
return false;
}
vtkIdType s[3];
double det = (v[1][1]-v[2][1])*(v[0][0]-v[2][0]) + (v[2][0]-v[1][0])*(v[0][1]-v[2][1]);
if (det == 0)
{
- DEBTRACE("flat triangle ?");
+ //DEBTRACE("flat triangle ?");
return false;
}
double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const
{
- DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
+ //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
double anInvalidAltitude = GetInvalidAltitude();
double aResAltitude = anInvalidAltitude;
HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes();
if (!aQuadtree)
{
- DEBTRACE(" no Quadtree");
+ //DEBTRACE(" no Quadtree");
return aResAltitude;
}
while (dist2nodes.size() == 0)
{
aQuadtree->setPrecision(aQuadtree->getPrecision() *2);
- DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
+ //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision());
aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision());
}
std::map<double, const gpi_XYZ*>::const_iterator it = dist2nodes.begin();
aResAltitude = it->second->Z();
int nodeIndex = it->second->getIndex();
- DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
+ //DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex);
// --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud)
// interpolation is required.
points->Allocate(64);
aDelaunay2D->GetPointCells(nodeIndex, cells);
vtkIdType nbCells = cells->GetNumberOfIds();
- DEBTRACE(" triangles on nearest point: " << nbCells);
+ //DEBTRACE(" triangles on nearest point: " << nbCells);
bool isInside = false;
for (int i=0; i<nbCells; i++)
{
if (isInside)
{
aResAltitude = z;
- DEBTRACE(" interpolated z: " << z);
+ //DEBTRACE(" interpolated z: " << z);
break;
}
}
- if (!isInside) DEBTRACE(" point outside triangles, nearest z kept");
+ if (!isInside)
+ {
+ // DEBTRACE(" point outside triangles, nearest z kept");
+ }
}
#endif
return aResAltitude;
const double minBoxSize) :
HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25)
{
- DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
+ //DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor");
if (myNodes)
{
- DEBTRACE(" --- start compute");
+ //DEBTRACE(" --- start compute");
compute();
- DEBTRACE(" --- end compute");
+ //DEBTRACE(" --- end compute");
}
}
myNodes = theNodes;
if (myNodes)
{
- DEBTRACE(" --- start compute");
+ //DEBTRACE(" --- start compute");
compute();
- DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
- DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y());
- DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y());
+ //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight());
+ //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y());
+ //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y());
}
}
aTestPoint = gp_XY( 0.5, 0.5 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.7127, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
aTestPoint = gp_XY( 1.5, 1 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
aTestPoint = gp_XY( 1.5, 0.7 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.4116, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS );
aTestPoint = gp_XY( 1.5, -0.7 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.0479, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.271267, anAltitude, EPS );
aTestPoint = gp_XY( 2, 3.5 );
anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 );
- CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.2525, anAltitude, EPS );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.9454, anAltitude, EPS );
aDoc->Close();
}