47 if(largest_crv==NULL) {
52 if(new->dist>largest_crv->
dist) {
59 while(tmp->
next!=NULL) {
82 if((nc1==NULL) || (nc2==NULL))
106 largest_crv = largest_crv->
next;
117 static double angle(
double x,
double y)
137 double new_point_x, new_point_y;
143 if((nc1==NULL) || (nc2==NULL))
174 last_alpha = largest_crv->
alpha;
177 largest_crv = largest_crv->
next;
198 printf(
"start=%d\tend=%d\tdist= %5.5lg\talpha=%5.2lf\n",
207 static int addpoint_debug(
double *pc,
double*po)
212 for (i=1; i<=
dim; i++)
239 printf(
"%5.2lf\t%9.5lf\t%9.5lf\t",
248 printf(
"%5.2lf\t%5.2lf\n",
259 double xbound_x, xbound_y, ybound_x, ybound_y;
260 double alpha, delta_alpha=M_PI/4;
270 double marginsx, marginsy;
274 double minx_x, minx_y, maxx_x, maxx_y;
277 double new_point_x, new_point_y;
280 while (tmp_param_set!=NULL) {
291 sprintf(&outfile[i],
".%d_%d", x, y);
293 if ((fp=fopen(outfile,
"w")) == NULL) {
294 strcpy(errmsg,
"Can't write to the '");
295 strcat(errmsg, outfile);
296 strcat(errmsg,
"' file.\n");
308 printf(
"%9.5f\t%9.5f\t%9.5f\t%9.5f\n\n\n",
316 for (i=1; i<=
dim; i++)
323 if (!addpoint_debug(pc,po))
324 nrerror(
"parameter values failed");
327 nrerror(
"parameter values failed");
333 for(alpha=M_PI/2; alpha<=2*M_PI; alpha+=M_PI/2) {
341 tmp->
alpha = alpha - delta_alpha;
342 tmp->
delta = delta_alpha/2;
347 for (i=1; i<=
dim; i++)
350 if(alpha == M_PI/2) {
354 else if(alpha == M_PI) {
357 }
else if (alpha==3*M_PI/2) {
364 if (!addpoint_debug(pc,po))
365 nrerror(
"parameter values failed");
368 nrerror(
"parameter values failed");
395 for(k=0; k<points_nr-4; k++) {
397 for (i=1; i<=
dim; i++)
401 alpha = largest_crv->
alpha;
403 if((alpha<M_PI/2) || (alpha>3*M_PI/2))
427 if (!addpoint_debug(pc,po))
428 nrerror(
"parameter values failed");
431 nrerror(
"parameter values failed");
441 qsort(®ion_points[1], points_nr,
sizeof(
REGION_PNT),
445 for(i=0; i<=points_nr; i++) {
447 fprintf(fp,
"%5.2lf\t%9.5lf\t%9.5lf\t%5.2lf\t%5.2lf\n",
448 region_points[k].alpha,
452 region_points[k].my);
463 tmp_param_set=tmp_param_set->
next;
static double angle(double x, double y)
static void add_to_crv_list(REGION_CRV *new)
char circuit_name[NAME_LENGTH]
char output_dir[NAME_LENGTH]
void free_vector(double *v, int nl, int nh)
PARAMETER_SET * parameter_list
void nrerror(char *error_text)
static double minimum_alpha
static int pointcomp(REGION_PNT *rp1, REGION_PNT *rp2)
char opt_num[NAME_LENGTH]
double * vector(int nl, int nh)
static int modify_region_crv_list(int x, int y)
struct REGION_CRV_STRUCT * next
void free_matrix(double **m, int nrl, int nrh, int ncl, int nch)
char region_ext[NAME_LENGTH]
static REGION_CRV * largest_crv
#define MINIMUM_ALPHA_DIVIDER
int addpoint(double *pc, double *po)
static char outline[LONG_LINE_LENGTH]
struct PARAMETER_SET_STRUCT * next
static void set_and_print_point(double alpha, int x, int y, REGION_PNT *region_points)
double ** matrix(int nrl, int nrh, int ncl, int nch)