How to resize "Plane"

Any question about the main GUI application (frontend)
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

How to resize "Plane"

Post by eimixas »

Is any way to resize plane constructed with:

Code: Select all

ccPlane* pPlane = pCloud->fitPlane(&rms); 
(cloud is build from 3 selected points)

It looks like plane (rectangle) is constructed like mesh using 2 faces (tiangles) - they are shown if "wireframe" option is selected. Should i somehow modify those faces?

Could be rotation changed too? (not plane rotation, but rotation of rectangle that represents plane)
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to resize "Plane"

Post by daniel »

Primitives are parametric meshes that depends only on their 'parameters' value. The associated mesh structures (vertices and triangles) are mainly used for display and may be regenerated each time a parameter of the primitive changes (notably it's 'precision' parameter). So you can of course modify the vertices position, but you may lose this modification in an unpredictable way (each time the primitive is cloned, saved, or each time it's 'precision' parameter is changed, etc.).

The best way to do what you want is to 'duplicate' the primitive with new parameters:

Code: Select all

ccPlane* newPlane = new ccPlane(newXWidth,newYWidth,&pPlane->getTransformation());
After that, you'll have to restore display parameters yourself (plane color, stippling, etc.).

P.S. : please ask this kind of questions in the 'Developer > qCC' thread
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: How to resize "Plane"

Post by eimixas »

OK, i will ask similar question in 'Developer > qCC'
(i see you moved this one)

I understand - i will duplicate with new parameters. Bet how can i get old ones? pPlane->m_xWidth and pPlane->m_yHeight are "access protected" and could find how to get them.
(i want to create new plane 5mm larger then original - so i need old width/height)
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to resize "Plane"

Post by daniel »

I've just added accessors to several primitives parameters (plane, sphere, box and extru).
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: How to resize "Plane"

Post by eimixas »

How to remove object?

New plane is created, but old ones has to be removed.

here is part of my code:

Code: Select all

	//Parent->removeChild(pPlane);
	m_app->removeFromDB(pPlane);
	
	m_app->refreshAll();
	m_app->updateUI();

	//delete pPlane;
it works only if i comment Parent->removeChild(pPlane); and delete pPlane;
is it ok? do i need only "m_app->removeFromDB(pPlane);"?
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: How to resize "Plane"

Post by eimixas »

And what is correct way to "select" newly created plane?

if i do like this:

Code: Select all

	NewPlane->setSelected(true);
	Parent->addChild(NewPlane);
	m_app->addToDB(NewPlane); 

	m_app->removeFromDB(pPlane);
	
	m_app->refreshAll();
	m_app->updateUI();
	m_app->redrawAll();
it is drawn as selected - but all plugin buttons are disabled. and it is not selected in "DB Tree"
Am i wrong somethere or some kind of bug?
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to resize "Plane"

Post by daniel »

Yep, 'removeFromDB' does all the job.

By the way, if you want to remove an object from DB tree without deleting it, there's another method (MainWindow::removeObjectTemporarilyFromDBTree).
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: How to resize "Plane"

Post by eimixas »

Thank you, i will user removeFromDB only.
And what about "selecting" newly created objects?
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: How to resize "Plane"

Post by daniel »

To 'select' an entity just as the user would do, see ccDBRoot::selectEntity.

In MainWindow, you can call

Code: Select all

m_ccRoot->selectEntity(myEntity);
Daniel, CloudCompare admin
eimixas
Posts: 36
Joined: Thu Jan 17, 2013 8:14 am

Re: How to resize "Plane"

Post by eimixas »

Is it possible to call this method from plugin's ::DoAction()?

something like

Code: Select all

ccDBRoot* m_ccDBRoot = (ccDBRoot*)(m_app->dbRoot());
m_ccDBRoot->selectEntity(NewPlane);
but i get:
qPlaneSizeReducePlugin.obj : error LNK2019: unresolved external symbol "public: void __thiscall ccDBRoot::selectEntity(class ccHObject *)" (?selectEntity@ccDBRoot@@QAEXPAVccHObject@@@Z) referenced in function "protected: void __thiscall qPlaneSizeReducePlugin::doAction(void)" (?doAction@qPlaneSizeReducePlugin@@IAEXXZ)
Post Reply