22 for(i = 0; i < n; i++) {
27 for(i = 0; i < n; i++) {
28 double temp = v[i] - mean;
47 double *result =
new double[3];
48 const double x[4] = {v[0], v[3], v[6], v[9]};
49 const double y[4] = {v[1], v[4], v[7], v[10]};
50 const double z[4] = {v[2], v[5], v[8], v[11]};
72 for (i = 1; i < n; i++) {
91 int *idx =
new int[n];
92 std::iota(idx, idx+n, 0);
95 std::sort(idx, idx+n, [v](
size_t i1,
size_t i2) {
return v[i1] < v[i2];});
136 double v1[3] = {poly.
vertices[idx]-insidePt[0], poly.
vertices[idx+1]-insidePt[1], poly.
vertices[idx+2]-insidePt[2]};
137 double v2[3] = {poly.
vertices[idx+3]-insidePt[0], poly.
vertices[idx+4]-insidePt[1], poly.
vertices[idx+5]-insidePt[2]};
146 double v2[3] = {poly.
vertices[last]-insidePt[0], poly.
vertices[last+1]-insidePt[1], poly.
vertices[last+2]-insidePt[2]};
168 for (
int i = 0; i < size; i++){
199 for (
int i = 0; i < famSize; i++) {
201 if (cdfIdx == count &&
p32Status[i] == 0){
209 std::cout <<
"ERROR: see indexFromProb_and_P32Status(), funct did not return anything\n";
231 for (
int i = famIdx; i >= 0; i--) {
232 if (p32Status[i] == 0) {
246 float *CDF =
new float[size];
248 for (
int i=1; i<size; i++){
249 CDF[i] = CDF[i-1] + famProb[i];
252 if ((CDF[size-1] < 0.999) || (CDF[size-1] > 1.001)) {
253 std::cout <<
"\nWARNING: Familiy probabilities (famProb in input file) do not sum to 1 \nsum = " 254 << std::setprecision(17) << CDF[size-1] <<
"\nPlease check input file.\n\n";
272 float *newProbs =
new float[cdfSize];
276 float addToRemainingElmts = famProbability[idx2Remove]/cdfSize;
280 for (
int i = 0; i < cdfSize+1; i++) {
283 if (i != idx2Remove) {
284 newProbs[idx] = famProbability[i] + addToRemainingElmts;
289 delete[] famProbability;
290 famProbability = newProbs;
293 CDF =
createCDF(famProbability, cdfSize);
T magnitude(T x, T y, T z)
void adjustCDF_and_famProb(float *&CDF, float *&famProbability, int &cdfSize, int idx2Remove)
int * sortedIndex(const double *v, int n)
double getArea(struct Poly &poly)
float * createCDF(float *famProb, int size)
int cdfIdxFromFamNum(float *CDF, bool *p32Status, int famIdx)
int maxElmtIdx(double *v, int n)
int indexFromProb(float *CDF, double roll, int size)
double sumDeviation(const double *v, int n)
int indexFromProb_and_P32Status(float *CDF, double roll, int famSize, int cdfSize, int &cdfIdx)
T * crossProduct(const T *v1, const T *v2)
double * sumDevAry3(double *v)