void main (void) { aint1 = 1; achar1 = 1; c_0(); c_1(); aint0 = 2; achar0 = 2; c_2(); aint0 = 0xff; achar0 = 0xff; c_ff(); aint0 = 0xa5; achar0 = 0xa5; c_a5(); aint0 = 0xabcd; c_abcd(); achar0 = 0; achar1 = 0; c_ifelse1(); achar0 = 1; c_ifelse1(); done (); }
int main() { FILE *fp,*fp_circle,*fp_points; clock_t start,end; int i,j,k; int input_size; leda::circle C,C_j; fp=fopen("input.dat","r"); fp_points=fopen("points.dat","w"); fp_circle=fopen("circle.dat","w"); fscanf(fp,"%d",&input_size); for(i=0;i<input_size;i++) { double x,y; fscanf(fp," %lf %lf",&x,&y); fprintf(fp_points,"%lf\t%lf\n",x,y); leda::point p(x,y); points[i]=p; } start=clock(); leda::point center; center=midpoint( points[0], points[1]); leda::circle c_2(center,points[0]); C=c_2; for(i=2;i<input_size;i++) { if(C.outside(points[i])) { center=midpoint( points[0], points[i]); leda::circle c_1(center,points[0]); C_j=c_1; for(j=1;j<i;j++) { if(C_j.outside(points[j])) { center=midpoint( points[i], points[j]); leda::circle c_ij(center,points[i]); for(k=0;k<j;k++) { if(c_ij.outside(points[k])) { leda::circle c_ijk(points[i],points[j],points[k]); c_ij=c_ijk; } } C_j=c_ij; } } C=C_j; } } end=clock(); printf("%d %6.6lf\n",input_size,((double)(end-start)/CLOCKS_PER_SEC)); center=C.center(); fprintf(fp_circle,"%lf %lf %lf",center.xcoord(),center.ycoord(),C.radius()); //printf("(radius,center)=(%lf,(%lf,%lf))\n",C.radius(),center.xcoord(),center.ycoord()); }
int main(void) { int1 = 1; char1 = 1; c_0(); printf("failures: %d\n",failures); c_1(); printf("failures: %d\n",failures); int0 = 2; char0 = 2; c_2(); printf("failures: %d\n",failures); int0 = 0xff; char0 = 0xff; c_ff(); printf("failures: %d\n",failures); int0 = 0xa5; char0 = 0xa5; c_a5(); printf("failures: %d\n",failures); int0 = 0xabcd; /*c_abcd();*/ char0 = 0; char1 = 0; c_ifelse1(); printf("failures: %d\n",failures); char0 = 1; c_ifelse1(); printf("failures: %d\n",failures); char0 = -1; int0 = -1; c_minus1(); printf("failures: %d\n",failures); char0 = 5; char1 = 3; c_c0gtc1(); printf("failures: %d\n",failures); char1 = -3; c_c0gtc1(); success = failures; done (); printf("failures: %d\n",failures); return failures; }
int BeamContact2Dp::UpdateBase(double xi) // this function computes the surface tangent vector g_xi { Vector t_c(BC2D_NUM_DIM); Vector ddx_c(BC2D_NUM_DIM); Vector d_c1(BC2D_NUM_DIM); Vector c_2(BC2D_NUM_DIM); Vector d_c2(BC2D_NUM_DIM); // compute current projection tangent t_c = Get_dxc_xi(xi); // set value of unit tangent vector c1 mc_1 = t_c/t_c.Norm(); // compute current projection curvature ddx_c = Get_dxc_xixi(xi); // compute derivative of c1 with respect to xi d_c1 = (1/t_c.Norm())*(ddx_c - ((mc_1^ddx_c)*mc_1)); // determine orthogonal vector c2 c_2(0) = -mc_1(1); c_2(1) = mc_1(0); // compute local coordinate transformation term mrho = mRadius*(mNormal^c_2); // compute change in c2 with xi d_c2 = -(d_c1^c_2)*mc_1; // compute surface tangent vector mg_xi = t_c + mrho*d_c2; return 0; }