Page 1 of 1
Is it possible to change scalar field value?
Posted: Mon Aug 01, 2016 10:18 am
by Lucien
Helle, is there a function to set scalar field value?
Re: Is it possible to change scalar field value?
Posted: Mon Aug 01, 2016 11:39 am
by daniel
There's no option to change the scalar field value of a single point (at least with the graphical interface - it's of course possible with the code).
You can add a scalar field with a custom value for all points. And you can also save the cloud as an ASCII file, edit it and reload it.
Re: Is it possible to change scalar field value?
Posted: Tue Aug 02, 2016 7:30 am
by Lucien
I wanted to modify the scalar value by ccGenericPointCloud::setPointScalarValue(index,scalar). But it crashed.
Re: Is it possible to change scalar field value?
Posted: Tue Aug 02, 2016 8:40 am
by daniel
If you use the generic accessors, then first you have to make sure there's an active scalar field (as most of the cloud classes can handle multiple scalar fields, you have to set which one is the default one. You'll have to use the higher level class (ChunkedPointCloud? ccGenericPointCloud? ccPointCloud?) to do that. Generally with the 'setCurrentScalarField' method.
Then of course this scalar field must have as much values as the number of points (i.e. currentSize is at least as big as the cloud size). If it's empty you have to 'add' the values the first time (with addElement).
Re: Is it possible to change scalar field value?
Posted: Wed Aug 03, 2016 9:14 am
by Lucien
I add a scalar field and set scalar values by a pushbutton.
- Capture.PNG (16.21 KiB) Viewed 20104 times
The values are changed but histogram is disable.
- Capture1.PNG (50.18 KiB) Viewed 20104 times
Re: Is it possible to change scalar field value?
Posted: Wed Aug 03, 2016 8:28 pm
by daniel
If you modify a scalar field, you must call 'computeMinAndMax' once all modifications are done (it updates the min and max values that are used by many tools and widgets).