something wrong when using ccGLCameraParameters

Feel free to ask any question here
Post Reply
kasper
Posts: 29
Joined: Thu May 17, 2018 6:13 am

something wrong when using ccGLCameraParameters

Post by kasper »

I want to get the ccGLCameraParameters data.

Code: Select all

 ccGLCameraParameters camera;
 glWindow->getGLCameraParameters(camera);

but there's something wrong.

Code: Select all

"QCC_DB_LIB.lib(QCC_DB_LIB.dll):-1: error:
 LNK2005: "public: virtual void __cdecl ccGLMatrixTpl<double>::toIdentity(void)" (?toIdentity@?$ccGLMatrixTpl@N@@UEAAXXZ) 已在 mainwindow.obj 中定義過了"   
it already defined in mainwindow.obj

so I remove all code .

Only left with

Code: Select all

CreateGLWindow(glWindow, widget);
ccGLCameraParameters camera;
it still error.

I found that the problem is "ccGLMatrixd"

Code: Select all

#include <ccGLMatrixTpl.h>
ccGLMatrixd m;
then the same error.

but no error when using "ccGLMatrix"


I also can not find "ccGLCameraParameters" in document?

How to fix it? Thanks.
kasper
Posts: 29
Joined: Thu May 17, 2018 6:13 am

Re: something wrong when using ccGLCameraParameters

Post by kasper »

I don't know how , LNK2005 disappeared Linux OS.

But now I got a new problem,

when I'm using

Code: Select all

ccGenericPointCloud::VisibilityTableType *visibilityArray = cloud->getTheVisibilityArray();
it was error.
I click into getTheVisibilityArray() function, and in header file,
its return type is ccGenericPointCloud::VisibilityTableType not ccGenericPointCloud::VisibilityTableType *

but I serach in document-api online it return ccGenericPointCloud::VisibilityTableType *
why they are different?

Second, after I get the visibility array, visibilityArray is not a null object but its size is 0.

should I do any setting before it?

it's my code.

Code: Select all


    ccGLCameraParameters camera;
    m_glWindow_->getGLCameraParameters(camera);

    const double half_w = camera.viewport[2] / 2.0;
    const double half_h = camera.viewport[3] / 2.0;

    ccGenericPointCloud::VisibilityTableType *visibilityArray = &c->getTheVisibilityArray();

    assert(visibilityArray);

    unsigned cloudSize = c->size();


    qDebug() << "visibilityArray" <<  visibilityArray->size();   // it return 0

    for (int i = 0; i < static_cast<int>(cloudSize); ++i)
    {
        qDebug() << "cloudSize"<< cloudSize;
        if (visibilityArray->at(i) == POINT_VISIBLE)            // it will runtime error because of its size.
        {
            const CCVector3* P3D = c->getPoint(i);

            CCVector3d Q2D;
            camera.project(*P3D, Q2D);

            CCVector2 P2D(	static_cast<PointCoordinateType>(Q2D.x-half_w),
                            static_cast<PointCoordinateType>(Q2D.y-half_h) );

            bool pointInside = CCLib::ManualSegmentationTools::isPointInsidePoly(P2D, m_segmentationPoly_);
            visibilityArray->at(i) = ( false != pointInside ? POINT_HIDDEN : POINT_VISIBLE );
        }
    }
    
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: something wrong when using ccGLCameraParameters

Post by daniel »

The online code documentation is a little bit old (well, actually it's very old). The new API indeed returns a reference on the 'visibility table':
https://github.com/CloudCompare/CloudCo ... oud.h#L171

And before using it, you have to actually allocate it (with resetVisibilityArray) and then populate it (not sure what you want to do with it).
Daniel, CloudCompare admin
Post Reply