(Solved)get Min scalar field error

Feel free to ask any question here
Post Reply
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

(Solved)get Min scalar field error

Post by fblue »

Hi,
I want to get Min and Max of scalar field by simply using getCurrentInScalarField()->getMin(), but I got the access violation error. I don't know why? Please help me!
The codes:
ccPointCloud* compCloud = new ccPointCloud;
results->clone(compCloud);
ScalarType minVal_0 = compCloud->getCurrentInScalarField()->getMin();
ScalarType maxVal_0 = compCloud->getCurrentInScalarField()->getMax();

The error:
error.PNG
error.PNG (14.52 KiB) Viewed 1798 times

Thanks
Last edited by fblue on Thu Nov 22, 2018 9:48 am, edited 1 time in total.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: get Min scalar field error

Post by daniel »

Well, you must first check that the cloud has a 'IN' scalar field currently specified! (if it's not the case, the getCurrentInScalarField method will return a NULL pointer).

You may try with the currently 'displayed' scalar field also (it depends on how the cloud was generated / where it comes from).
Daniel, CloudCompare admin
fblue
Posts: 37
Joined: Thu Oct 25, 2018 9:00 am

Re: get Min scalar field error

Post by fblue »

As you said, I try getCurrentDisplayedScalarField() and it works!! Thanks!
But what's the difference with the two?
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: (Solved)get Min scalar field error

Post by daniel »

Well, the 'current displayed' scalar field is the one selected by the user.

The current 'in' scalar field, needs to be setup by the developer (it is used mostly implicitly by algorithms of the CCLib library that access the default scalar field via the generic cloud interface).
Daniel, CloudCompare admin
Post Reply