3 #include "AbstractGeometryFilter.h"
18 Voxel *voxel =
nullptr;
19 Mat<double> *matrix =
nullptr;
21 double closestPointDistance = std::numeric_limits<double>::max();
187 void parse(std::string
const & filePath);
195 void firstPass(
string const & filePathString, ifstream &ifs);
204 string const &filePathString,
205 string const &matName,
225 double &halfVoxelSize
238 double halfVoxelSize,
239 string const &filePathString
261 double halfVoxelSize,
325 double x,
double y,
double z,
326 size_t &I,
size_t &J,
size_t &K
Abstract class defining asset loading filters common behavior.
Definition: AbstractGeometryFilter.h:18
Class representing a scene part.
Definition: ScenePart.h:20
Class representing a voxel primitive.
Definition: Voxel.h:11
Import point cloud files abstracting them to a set of voxels.
Definition: XYZPointCloudFileLoader.h:27
size_t indexFromCoordinates(double x, double y, double z, size_t &I, size_t &J, size_t &K)
Obtain voxel-grid index for given coordinates.
Definition: XYZPointCloudFileLoader.cpp:702
ScenePart * run()
Definition: XYZPointCloudFileLoader.cpp:24
void postProcess(string const &matName, int estimateNormals)
Post process already filled voxels grid.
Definition: XYZPointCloudFileLoader.cpp:489
static size_t const batchSize
How many points consider per batch when estimating normals.
Definition: XYZPointCloudFileLoader.h:39
size_t n
The number of points in the point cloud.
Definition: XYZPointCloudFileLoader.h:89
bool correctNormal(double &x, double &y, double &z)
Correct normal if necessary. Only non valid normals will be corrected.
Definition: XYZPointCloudFileLoader.cpp:383
static void restartInputFileStream(ifstream &ifs)
Reset given input file stream so it points to file start.
Definition: XYZPointCloudFileLoader.cpp:719
void voxelsGridToScenePart()
Compose the scene part considering voxels at voxels grid.
Definition: XYZPointCloudFileLoader.cpp:692
double voxelSize
Size for each voxel.
Definition: XYZPointCloudFileLoader.h:55
double maxY
Maximum Y coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:109
void fillVoxelsGrid(ifstream &ifs, int estimateNormals, double halfVoxelSize, string const &filePathString)
Fill voxels grid.
Definition: XYZPointCloudFileLoader.cpp:284
size_t numBatches
How many batches are necessary to estimate normals.
Definition: XYZPointCloudFileLoader.h:173
size_t lastNumVoxels
Used to correctly report number of voxels for each part when reading multiple files at once (i....
Definition: XYZPointCloudFileLoader.h:179
void digestVoxel(int estimateNormals, double halfVoxelSize, double x, double y, double z, double r, double g, double b, double xnorm, double ynorm, double znorm)
Digest a voxel when filling voxels grid. This implies the voxel will be created in the grid if it doe...
Definition: XYZPointCloudFileLoader.cpp:404
double yCoeff
Coefficient ( ) to compute voxel index for a given coordinate.
Definition: XYZPointCloudFileLoader.h:150
double maxColorValue
Max value with respect to used color codification.
Definition: XYZPointCloudFileLoader.h:59
VoxelGridCell * voxels
Full voxels grid.
Definition: XYZPointCloudFileLoader.h:164
void parse(std::string const &filePath)
Parse XYZ file.
Definition: XYZPointCloudFileLoader.cpp:72
bool snapNeighborNormal
Snap neighbor normal instead of average when enabled (true).
Definition: XYZPointCloudFileLoader.h:64
size_t nynz
Product . Stored in a variable because of its recurrent usage.
Definition: XYZPointCloudFileLoader.h:131
static int const voxelPopulationThreshold
How many points can be contained inside a voxel without triggering a warning due to excessive populat...
Definition: XYZPointCloudFileLoader.h:44
void secondPass(string const &filePathString, string const &matName, ifstream &ifs)
Second pass where the input file is read as many times as needed to build necessary voxels.
Definition: XYZPointCloudFileLoader.cpp:197
double xCoeff
Coefficient ( ) to compute voxel index for a given coordinate.
Definition: XYZPointCloudFileLoader.h:141
size_t ny
Number of partitions along y-axis.
Definition: XYZPointCloudFileLoader.h:122
static int const minPointsForSafeNormalEstimation
How many points are necessary for the normal estimation to be reliable.
Definition: XYZPointCloudFileLoader.h:35
size_t nx
Number of partitions along x-axis.
Definition: XYZPointCloudFileLoader.h:118
std::string separator
Field separator specification used by the point cloud file.
Definition: XYZPointCloudFileLoader.h:51
void _estimateNormals(size_t start, size_t end)
Assists estimateNormals function. Normals for filled matrices are computed at this function.
Definition: XYZPointCloudFileLoader.cpp:658
glm::dvec3 defaultNormal
The default normal to be used when needed to fill missing ones.
Definition: XYZPointCloudFileLoader.h:73
double maxZ
Maximum Z coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:113
double minZ
Minimum Z coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:101
double zCoeff
Coefficient ( ) to compute voxel index for a given coordinate.
Definition: XYZPointCloudFileLoader.h:159
double minY
Minimum Y coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:97
double minX
Minimum X coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:93
void warnAboutPotentialErrors(string const &filePathString)
Some issues with normals might be solved during post processing. This function is called before XYZPo...
Definition: XYZPointCloudFileLoader.cpp:463
size_t discardedPointsByNormal
How many points were discarded because they were expected to have a correct normal but they did not.
Definition: XYZPointCloudFileLoader.h:84
bool assignDefaultNormal
Specify whether default normal must be assigned to voxels which normal cannot be safely determined (T...
Definition: XYZPointCloudFileLoader.h:69
double maxX
Maximum X coordinate considering all points.
Definition: XYZPointCloudFileLoader.h:105
void estimateNormalsBatch(ifstream &ifs)
Estimate voxels normals in batch mode, which implies reading input file as many times as specified by...
Definition: XYZPointCloudFileLoader.cpp:580
size_t nz
Number of partitions along z-axis.
Definition: XYZPointCloudFileLoader.h:126
size_t maxNVoxels
Total size of full voxels grid.
Definition: XYZPointCloudFileLoader.h:169
void prepareVoxelsGrid(int &estimateNormals, double &halfVoxelSize)
Prepare voxels grid computation.
Definition: XYZPointCloudFileLoader.cpp:241
void firstPass(string const &filePathString, ifstream &ifs)
First pass of input file used to find essential information needed to successfully abstract the point...
Definition: XYZPointCloudFileLoader.cpp:134
static bool isLineComment(string const &line)
Check if given line is a comment or not.
Definition: XYZPointCloudFileLoader.cpp:715
void loadMaterial()
Load the material for each primitive in a cyclic fashion. It is, if materials are given then the -th...
Definition: XYZPointCloudFileLoader.cpp:224
size_t unsafeNormalEstimations
How many voxels normals could not be safely estimated because there was not enough data inside the vo...
Definition: XYZPointCloudFileLoader.h:78
void estimateNormals(ifstream &ifs)
Estimate voxels normal as the orthonormal of best fitting plane for points inside voxel.
Definition: XYZPointCloudFileLoader.cpp:526
XYZPointCloudFileLoader()
Constructor for point cloud loader.
Definition: XYZPointCloudFileLoader.h:350
VoxelGridCell is used to build and fill all necessary voxels to represent input point cloud.
Definition: XYZPointCloudFileLoader.h:17