Calculation sum of scalar field
Posted: Wed Dec 05, 2018 9:32 am
Hi,
To compute the sum of a scalar field of a cloud point, I use the conventional way like this:
int density = Cloud->getScalarFieldIndexByName("Density");
CCLib::ScalarField* sf_density = Cloud->getScalarField(density);
double sum = 0.;
for (int num = 0; num < Cloud->size(); num++)
sum = sum + sf_density->getValue(num);
It seems to work for me. Are there another way more simple to do that?
Thanks
To compute the sum of a scalar field of a cloud point, I use the conventional way like this:
int density = Cloud->getScalarFieldIndexByName("Density");
CCLib::ScalarField* sf_density = Cloud->getScalarField(density);
double sum = 0.;
for (int num = 0; num < Cloud->size(); num++)
sum = sum + sf_density->getValue(num);
It seems to work for me. Are there another way more simple to do that?
Thanks