-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
VTKViewer_Triangulator
::VTKViewer_Triangulator():
myCellIds(vtkIdList::New()),
+ myPointIds(NULL),
myFaceIds(vtkIdList::New()),
- myPoints(vtkPoints::New()),
- myPointIds(NULL)
+ myPoints(vtkPoints::New())
{}
myPoints->Modified(); // the VTK bug
vtkIdType aNumPts;
- theInput->GetCellPoints(theCellId, aNumPts, myPointIds);
+ vtkIdType const *tmp;
+ theInput->GetCellPoints(theCellId, aNumPts, tmp);
+ myPointIds = const_cast<vtkIdType*>( tmp );
if ( aNumPts > 0 ) {
double anAbsoluteCoord[3];
myPoints->SetNumberOfPoints(aNumPts);
vtkPoints *anInputPoints = theInput->GetPoints();
- for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ for (auto aPntId = 0; aPntId < aNumPts; aPntId++) {
anInputPoints->GetPoint(myPointIds[aPntId], anAbsoluteCoord);
myPoints->SetPoint(aPntId, anAbsoluteCoord);
}
vtkCellData* theOutputCD,
int theStoreMapping,
std::vector<vtkIdType>& theVTK2ObjIds,
- std::map< vtkIdType, std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
+ std::vector< std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
bool theIsCheckConvex)
{
vtkPoints *aPoints = InitPoints(theInput, theCellId);
double aCellCenter[3] = {0.0, 0.0, 0.0};
{
double aPntCoord[3];
- for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ for (auto aPntId = 0; aPntId < aNumPts; aPntId++) {
aPoints->GetPoint(GetPointId(aPntId),aPntCoord);
if(DEBUG_TRIA_EXECUTE) cout<<"\taPntId = "<<GetPointId(aPntId)<<" {"<<aPntCoord[0]<<", "<<aPntCoord[1]<<", "<<aPntCoord[2]<<"}\n";
aCellCenter[0] += aPntCoord[0];
}
double aCellLength = GetCellLength();
- int aNumFaces = GetNumFaces();
+ vtkIdType aNumFaces = GetNumFaces();
static double EPS = 1.0E-2;
double aDistEps = aCellLength/3.0 * EPS;
typedef std::set<TPointIds> TFace2PointIds;
TFace2PointIds aFace2PointIds;
- for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ for (auto aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
vtkCell* aFace = GetFace(aFaceId);
GetCellNeighbors(theInput, theCellId, aFace, myCellIds);
::TPolygons aPolygons;
- for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
+ for (auto aFaceId = 0; aFaceId < aNumFaces; aFaceId++) {
if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end())
continue;
if(DEBUG_TRIA_EXECUTE) cout << "; Added = FALSE" << endl;
}
}
- int aNbPoints = aPointIds.size();
+ size_t aNbPoints = aPointIds.size();
aCenter[0] /= aNbPoints;
aCenter[1] /= aNbPoints;
aCenter[2] /= aNbPoints;
}
if(!aSortedPointIds.empty()){
- int aNumFacePts = aSortedPointIds.size();
+ size_t aNumFacePts = aSortedPointIds.size();
::TConnectivities aConnectivities(aNumFacePts);
TSortedPointIds::const_iterator anIter = aSortedPointIds.begin();
TSortedPointIds::const_iterator anEndIter = aSortedPointIds.end();
// To check, whether the polygons give a convex polyhedron or not
if(theIsCheckConvex){
- int aNbPolygons = aPolygons.size();
- for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ size_t aNbPolygons = aPolygons.size();
+ for (size_t aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
::TPolygon& aPolygon = aPolygons[aPolygonId];
double* aNormal = aPolygon.myNormal;
double* anOrigin = aPolygon.myOrigin;
// To pass resulting set of the polygons to the output
{
- int aNbPolygons = aPolygons.size();
- for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
+ size_t aNbPolygons = aPolygons.size();
+ for (size_t aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) {
::TPolygon& aPolygon = aPolygons[aPolygonId];
if(DEBUG_TRIA_EXECUTE) cout << "PoilygonId="<<aPolygonId<<" | ";
TConnectivities& aConnectivities = aPolygon.myConnectivities;
if(DEBUG_TRIA_EXECUTE) {
- for(int i=0;i<aConnectivities.size();i++)
+ for(size_t i=0;i<aConnectivities.size();i++)
cout << aConnectivities[i] << ",";
cout << endl;
}
- int aNbPoints = aConnectivities.size();
+ int aNbPoints = (int)aConnectivities.size();
vtkIdType aNewCellId = theOutput->InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]);
if(theStoreMapping)
VTKViewer_GeometryFilter::InsertId( theCellId, VTK_POLYGON, theVTK2ObjIds, theDimension2VTK2ObjIds );
zSize = aBounds[5] - aBounds[4];
double anAbsoluteCoord[3];
double aParamentrucCoord[3];
- for (int aPntId = 0; aPntId < aNumPts; aPntId++) {
+ for (auto aPntId = 0; aPntId < aNumPts; aPntId++) {
myPoints->GetPoint(aPntId, anAbsoluteCoord);
aParamentrucCoord[0] = xSize==0. ? 0. : ((anAbsoluteCoord[0] - aBounds[0]) / xSize);
aParamentrucCoord[1] = ySize==0. ? 0. : ((anAbsoluteCoord[1] - aBounds[2]) / ySize);
if ( theFaceId < 0 || theFaceId >= aNumCells )
return NULL;
- vtkIdType *aCells = myBoundaryTris->GetPointer();
+ vtkIdType *aCells = myBoundaryTris->GetData()->GetPointer(0);
// Each triangle has three points plus number of points
vtkIdType *aCellPtr = aCells + 4*theFaceId;