Page 1 of 1

(Solved)get Min scalar field error

Posted: Wed Nov 21, 2018 3:02 pm
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 1780 times

Thanks

Re: get Min scalar field error

Posted: Wed Nov 21, 2018 9:42 pm
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).

Re: get Min scalar field error

Posted: Thu Nov 22, 2018 9:48 am
by fblue
As you said, I try getCurrentDisplayedScalarField() and it works!! Thanks!
But what's the difference with the two?

Re: (Solved)get Min scalar field error

Posted: Thu Nov 22, 2018 8:38 pm
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).