For (k=GridIndxe_List. The begin (); k !=GridIndxe_List. End (); + + k)
{
Cout & lt; <* k & lt;
CodePudding user response:
Code to stick allCodePudding user response:
This code is right, wrong is positioning in this code? You read the newspaper in the wrong is the STD: : vector, not a QListCodePudding user response:
# include & lt; QtCore/QCoreApplication># include & lt; QList>
# include & lt; QMultiHash>
# include & lt; QString>
# include & lt; QFileDialog>
# include & lt; Iostream>
# include "Octree. H"
# include & lt; Photo/octree/octree. H>
using namespace std;
Int main ()
{
Photo: : PointCloud
The string fileName="";
Float searchRadius=0.0 f;
Cout<& lt;" Please enter the file name: ";
Cin> The fileName.
if(! OpenLasFile (cloud, fileName))
{
Cout<& lt;" Point cloud open failure!"
return -1;
}//the size of the 3 d mesh,
Const float Xscale3d=0.2 f;
Const float Yscale3d=0.2 f;
Const float Zscale3d=0.05 f;
//grid of rows and columns, layer number of
Int RowNum, ColNum, LayerNum;
//define two points on the extremum for storage,
Photo: : PointXYZI minPt maxPt;
//get coordinates extremum,
Photo: : getMinMax3D (* cloud, minPt, maxPt);
Double X_Max=maxPt. X;
Double X_Min=minPt. X;
Double Y_Max=maxPt. Y;
Double Y_Min=minPt. Y;
Double Z_Max=maxPt. Z;
Double Z_Min=minPt. Z;
Double xscale wasn't entirely=(X_Max - X_Min)/2;
Double yscale=(Y_Max - Y_Min)/2;
Double zscale=(Z_Max - Z_Min)/2;
/* cout & lt; <"Coordinate extremum as follows" & lt;
//calculate the whole grid of rows and columns, layer number, rounded
RowNum=int ((X_Max - X_Min)/xscale wasn't entirely + 1);
ColNum=int ((Y_Max - Y_Min)/yscale + 1);
LayerNum=int ((Z_Max - Z_Min)/zscale + 1);
/* cout & lt; <"The ranks of grid layer as follows" & lt;
//photo: : PointCloud
QList
QList
QList
//hash keys linear index
QList
QList
Int the row, col, layer;
Int d_row, d_col d_layer;
Unsigned int TempIndex=0;
Int root_node_code=80;
//create a new object QMultiHash point3dHash, hash table point3dHash will represent the entire three-dimensional grid,
QMultiHash
/* cout & lt;
{
The row=int ((cloud - & gt; Points [nIndex]. X-ray X_Min)/xscale wasn't entirely) + 1;
Col=int ((cloud - & gt; Points [nIndex] y - minPt. Y)/yscale) + 1;
Layer=int ((cloud - & gt; Points [nIndex]. Z - minPt. Z)/zscale) + 1;
If (col==1 & amp; & The row==1 & amp; & Layer==1)
{
TempIndex=root_node_code + 1;
}
If (col==2 & amp; & The row==1 & amp; & Layer==1)
{
TempIndex=root_node_code + 2;
}
If (col==1 & amp; & The row==2 & amp; & Layer==1)
{
TempIndex=root_node_code + 3;
}
If (col==2 & amp; & The row==2 & amp; & Layer==1)
{
TempIndex=root_node_code + 4;
}
If (col==1 & amp; & The row==1 & amp; & Layer==2)
{
TempIndex=root_node_code + 5;
}
If (col==2 & amp; & The row==1 & amp; & Layer==2)
{
TempIndex=root_node_code + 6;
}
If (col==1 & amp; & The row==2 & amp; & Layer==2)
{
TempIndex=root_node_code + 7;
}
If (col==2 & amp; & The row==2 & amp; & Layer==2)
{
TempIndex=root_node_code + 8;
}
GridIndxe_List. Append (TempIndex);//each point cloud in 3 d mesh, linear index number, the following table values with point cloud of inside the cloud values listed in the table below,
//to store your first nIndex a point cloud into linear index for TempIndex grid,
//cout & lt;
}
//const QList
//for each 3 d mesh, the strength of the point cloud extremum
Vector