Re: CMake Errors
Posted: Sun Jul 16, 2017 12:39 pm
Thank you for your help.It's done.
With Regards
Hritika
With Regards
Hritika
Open-source point cloud editing software
https://cloudcompare.net/forum/
I'm forced to implement it in C++ now and I'm completely lost.. Now when I compile, it shows me 2 errors and creates a Files in CloudCompare_debug (as shown left in the screenshot).les245 wrote:Thank you very much, that solved the problem. But now, as I try to compile the INSTALL project, I get 3 errors...
What I need to do is get a mesh of a point cloud. I got it using the Delaunay feature in CloudCompare and now I have to automate it, so I thought it would be easy to program it in C++ using a library but I'm completely lost and overtaken. I have never done anything similar (I learned to program in C# but never used many libraries). Could you point me in the right direction or tell me if what I'm trying to do is achievable?
I attached a screenshot of the errors. Thank you very much again.
I think it will be easier to explain what I want to achieve because I'm not sure what I'm doing here..daniel wrote:Hum, hard to tell with only this view.
Are you only 'compiling' the CloudCompare projet or are you trying to run it here? Looking at the error, I would say that compilation is ok, but it fails to run?
If that's the case, then you must actually compile the 'INSTALL' project and then run the installed version of CloudCompare (see the specific section of the BUILD.md file, about Visual Studio).
Otherwise I'll need more information...
Code: Select all
#include <stdlib.h>
#include <iostream>
#include <STLFilter.h>
#include <Delaunay2dMesh.h>
#include <qstring.h>
#include <AsciiFilter.h>
#include <ccMesh.h>
static ccHObject::Container clouds;
static ccMesh* mesh;
using namespace std;
int main(int argc, char* argv) {
QString directory_test("F:\\Mesh.xyz");
//ccHObject::Container clouds;
FileIOFilter::LoadParameters parameters;
AsciiFilter::loadFile(directory_test, clouds, parameters);
double s_meshMaxEdgeLength = 15.0;
bool updateNormals = true;
CC_TRIANGULATION_TYPES type;
for (size_t i = 0; i < clouds.size(); ++i)
{
ccHObject* ent = clouds[i];
assert(ent->isKindOf(CC_TYPES::POINT_CLOUD));
//compute mesh
ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(ent);
ccMesh* mesh = ccMesh::Triangulate(cloud,
type,
updateNormals,
static_cast<PointCoordinateType>(s_meshMaxEdgeLength),
2 //XY plane by default
);
}
FILE* thefile = fopen("Mesh_Test.stl", "wb");
QWidget *parentWidget = (QWidget *)0;
STLFilter::saveToASCIIFile(mesh,thefile,*parentWidget);
return EXIT_SUCCESS;
}
Code: Select all
#include <stdlib.h>
#include <iostream>
#include <STLFilter.h>
#include <Delaunay2dMesh.h>
#include <qstring.h>
#include <AsciiFilter.h>
#include <ccMesh.h>
using namespace std;
int main(int argc, char* argv)
{
//if you want to use Qt, you have to instantiate a Qt application first
QApplication app;
QString directory_test("F:\\Mesh.xyz");
ccHObject::Container clouds;
FileIOFilter::LoadParameters parameters;
//you have to instantiate the AsciiFilter before using it (loadFile is not a static function)
//(another way is to use FileIOFilter::LoadFromFile which is static)
if (AsciiFilter().loadFile(directory_test, clouds, parameters) != CC_FERR_NO_ERROR)
{
return EXIT_FAILURE;
}
double meshMaxEdgeLength = 15.0;
bool updateNormals = true;
CC_TRIANGULATION_TYPES type = DELAUNAY_2D_AXIS_ALIGNED; //you have to chose the triangulation type here!
for (size_t i = 0; i < clouds.size(); ++i)
{
ccHObject* ent = clouds[i];
assert(ent->isKindOf(CC_TYPES::POINT_CLOUD));
//compute mesh
ccGenericPointCloud* cloud = ccHObjectCaster::ToGenericPointCloud(ent);
ccMesh* mesh = ccMesh::Triangulate(cloud,
type,
updateNormals,
static_cast<PointCoordinateType>(meshMaxEdgeLength),
2 //XY plane by default
);
if (!mesh)
{
//failed to triangulate the point cloud
continue;
}
FILE* thefile = fopen(QString("Mesh_%1_Test.stl").arg(i), "wb"); //you need one file per cloud
if (!theFile)
{
//failed to open the file for writing
continue;
}
//Same thing for the STLFilter, you have to insantiate it before using it
//And you don't have access to 'saveToASCIIFile' (it's protected). You can either change the code so as to make it 'public'
//or directly change the default state of 'binaryMode' in saveToFile.
STLFilter().saveToASCIIFile(mesh, thefile, *parentWidget);
//don't forget to close the file
fclose(thefile);
//don't forget to clean the memory
delete mesh;
} //the loop should end here (and not before saving the file)
return EXIT_SUCCESS;
}