Menu

#248 slots bounding box calculation is wrong

v1.0 (example)
open
None
5
2020-02-21
2019-10-28
Eyal
No

There was a mistake in this commit: ec09d5c11d7e0aa81a9f7b3fe91054e52454bfa7 . The stop_x,y coordinates are using for the bounding box before the coordinates are adjusted for units. It should be after. Around line 508 in drill.c:

            /* Update boundingBox with drilled slot stop_x,y coords */
            bbox->left   = min(bbox->left,   curr_net->stop_x - r);
            bbox->right  = max(bbox->right,  curr_net->stop_x + r);
            bbox->bottom = min(bbox->bottom, curr_net->stop_y - r);
            bbox->top    = max(bbox->top,    curr_net->stop_y + r);

            drill_update_image_info_min_max_from_bbox(image->info, bbox);

            if (state->unit == GERBV_UNIT_MM) {
                /* Convert to inches -- internal units */
                curr_net->stop_x /= 25.4;
                curr_net->stop_y /= 25.4;
            }

Discussion

  • jpa

    jpa - 2020-02-19
     
  • Eyal

    Eyal - 2020-02-21

    Great! Would you also like to fix memory leaks and the reading of uninitialized memory?
    https://sourceforge.net/p/gerbv/bugs/250/

    If you fix those then you will have fixed all of the memory leaks and memory errors that valgrind found when running pcb2gcode.

     
  • Eyal

    Eyal - 2020-02-21

    Ah, wait, there is another:

    @@ -1119,6 +1120,7 @@ drill_parse_T_code(gerb_file_t *fd, drill_state_t *state,
    
         /* Set the current tool to the correct one */
         state->current_tool = tool_num;
    
    +    apert = image->aperture[tool_num];
    
         /* Check for a size definition */
         temp = gerb_fgetc(fd);
    @@ -1155,7 +1157,6 @@ drill_parse_T_code(gerb_file_t *fd, drill_state_t *state,
                                "at line %ld in file \"%s\""),
                                size, tool_num, file_line, fd->filename);
                } else {
    
    -               apert = image->aperture[tool_num];
                    if (apert != NULL) {
                        /* allow a redefine of a tool only if the new definition is exactly the same.
                         * This avoid lots of spurious complaints with the output of some cad
    

    That's the last one I think. I can run valgrind on gerbv again when it's merged.

     

Log in to post a comment.

Monday.com Logo