44 int n_b1 = n_bands - 1;
48 sqrt((
double)((2 * n_b1 + 1) * (2 * n_b1 + 1) - 8 * scatt_id))) /
52 ((*b_1_id) * (2 * n_b1 + 1) - (*b_1_id) * (*b_1_id)) / 2 +
73 int n_b1 = n_bands - 1;
76 (b_1_id * (2 * n_b1 + 1) - b_1_id * b_1_id) / 2 + b_2_id - b_1_id - 1;
99 cats->
n_scatts = (n_bands - 1) * n_bands / 2;
108 for (i_cat = 0; i_cat < cats->
n_cats; i_cat++)
123 for (i_cat = 0; i_cat < cats->
n_a_cats; i_cat++) {
157 int i_scatt, i_cat_id, cat_id = 0;
163 for (i_cat_id = 0; i_cat_id < cats->
n_cats; i_cat_id++)
187 for (i_scatt = 0; i_scatt < cats->
n_scatts; i_scatt++)
209 int cat_id,
int scatt_id)
211 int band_1, band_2, cat_idx, n_a_scatts;
214 if (cat_id < 0 || cat_id >= cats->
n_cats)
221 if (scatt_id < 0 && scatt_id >= cats->
n_scatts)
260 int n_vals,
void *data)
262 scatt_data->
n_vals = n_vals;
269 (
unsigned int *)
G_malloc(n_vals *
sizeof(
unsigned int));
279 (
unsigned char *)
G_malloc(n_vals *
sizeof(
unsigned char));
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
#define SC_SCATT_CONDITIONS
int I_bands_to_id_scatt(const int b_1_id, const int b_2_id, const int n_bands, int *scatt_id)
Compute scatter plot id from band ids.
void I_sc_free_cats(struct scCats *cats)
Free data of struct scCats, the structure itself remains allocated.
void I_sc_init_cats(struct scCats *cats, int n_bands, int type)
Initialize structure for storing scatter plots data.
int I_sc_insert_scatt_data(struct scCats *cats, struct scdScattData *scatt_data, int cat_id, int scatt_id)
Insert scatter plot data . Inserted scatt_data struct must have same type as cats struct (SC_SCATT_DA...
int I_id_scatt_to_bands(const int scatt_id, const int n_bands, int *b_1_id, int *b_2_id)
Compute band ids from scatter plot id.
int I_sc_add_cat(struct scCats *cats)
Add category.
void I_scd_init_scatt_data(struct scdScattData *scatt_data, int type, int n_vals, void *data)
Insert scatter plot data.
struct scScatts ** cats_arr
struct scdScattData ** scatts_arr
unsigned int * scatt_vals_arr
unsigned char * b_conds_arr