Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Function for check if another point is in radius around point p
- bool circle_check( double xpoint, double ypoint, double x_center, double y_center, double diameter, int holenumber) {
- if ( ( ( (xpoint-x_center)*(xpoint-x_center) ) + ( (ypoint-y_center)*(ypoint-y_center) ) ) <= (diameter*diameter/4) ) {
- printf ("Found needle inside hole no. %d with x,y: %.0lf,%.0lfn", holenbumber+1, xpoint, ypoint);
- fprintf(logfile, "Found needle inside hole no. %d with x,y: %.0lf,%.0lfn", holenbumber+1, xpoint, ypoint);
- return true;}
- else {
- return false;}
- for (i=0;i<number_points;i++){
- for (k=0;k<=number_circles;k++){
- if (circle_check( new_coord[i].xcoord, new_coord[i].ycoord, holes[k].xhcoord, holes[k].yhcoord, holes[k].diamh, k) == false){
- fprintf( result, "%.0lft%.0lfn", new_coord[i].xcoord, new_coord[i].ycoord);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement