geda-pcb/pcjc2/v2.git
5 years agoExtend object3d_from_contours() to have an option to produce an inverted shell contourstep_export/extend-object3d_from_contours
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Extend object3d_from_contours() to have an option to produce an inverted shell contour

This will be useful when extruding voids within objects during 3D export.

5 years agoAdd void *userdata member to the POLYAREA objectstep_export/add-void-userdata-member-to
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Add void *userdata member to the POLYAREA object

This is intended to allow client code operating on polygons to assign
arbitrary additional data to the polygon contours.

The initial target use-case is in 3D export code, where it is helpful to
have temporary links between POLYAREA contours being extruded and the 3D
object structures being generated. Allowing this tagging directly avoids
the need to maintain a hash-mapping or similar.

5 years agoAlter cntr_in_M_POLYAREA() to return which POLYAREA which the passed PLINE was found... step_export/alter-cntr_in_m_polyarea-to
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Alter cntr_in_M_POLYAREA() to return which POLYAREA which the passed PLINE was found inside.

In the case which previously returned FALSE, where the PLINE was not found
inside any of the linked POLYAREA, the funciton returns NULL.

5 years agoSubtract vias from ...step_export/subtract-vias-from
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Subtract vias from ...

5 years agoRename PinPoly to PinClearPoly, re-introducing PinPoly to create the shape of the... step_export/rename-pinpoly-to-pinclearpoly
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Rename PinPoly to PinClearPoly, re-introducing PinPoly to create the shape of the pin.

5 years agoDebug stuffstep_export/debug-stuff
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Debug stuff

5 years agoExtend object3d code to support arc-segments in POLYAREA contoursstep_export/extend-object3d-code-to
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Extend object3d code to support arc-segments in POLYAREA contours

5 years agoRemove left over debugstep_export/remove-left-over-debug
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Remove left over debug

5 years agoDisable debugstep_export/disable-debug
Peter Clifton [Sun, 4 Dec 2016 20:31:09 +0000 (4 20:31 +0000)]
Disable debug

5 years agoCopy contour is_round information when copying polygonsstep_export/copy-contour-is_round
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Copy contour is_round information when copying polygons

5 years agoPolygon debugstep_export/polygon-debug
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Polygon debug

5 years agoXXX: THIS IS NOT TO BE EDITED, JUST A CHERRY PICKED COPY FOR DEBUG... Add polygon... step_export/add-polygon-parentage-tree
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
XXX: THIS IS NOT TO BE EDITED, JUST A CHERRY PICKED COPY FOR DEBUG... Add polygon parentage tree debug view

NB: Also contains some probably bug fixes for PBO operations,
in particular - relating to bad exit codes when a NULL poly is
copied.

5 years agoDebug wonky copper polygon generationstep_export/debug-wonky-copper-polygon
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Debug wonky copper polygon generation

5 years agoEnable output of via pads, and dial down circular approximation accuracystep_export/enable-output-of-via-pads-and
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Enable output of via pads, and dial down circular approximation accuracy

5 years agoTurn off debug hacks in object generationstep_export/turn-off-debug-hacks-in-object
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Turn off debug hacks in object generation

5 years agoRe-enable board core emissionstep_export/re-enable-board-core-emission
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Re-enable board core emission

5 years agoDisable small edge EPSILON hack for computing edge normalsstep_export/disable-small-edge-epsilon
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Disable small edge EPSILON hack for computing edge normals

5 years agoPrepend when adding things to listsstep_export/prepend-when-adding-things-to
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
Prepend when adding things to lists

5 years agohid/step: Add copper layer export to 3D modelstep_export/hid-step-add-copper-layer
Peter Clifton [Sun, 4 Dec 2016 20:31:08 +0000 (4 20:31 +0000)]
hid/step: Add copper layer export to 3D model

5 years agoComment object3d_draw_debug() call during exposestep_export/comment-object3d_draw_debug
Peter Clifton [Sun, 4 Dec 2016 20:31:07 +0000 (4 20:31 +0000)]
Comment object3d_draw_debug() call during expose

5 years agoAdjust coordinate system GOODNES KNOWS WHETHER THE GEOMETRY IS CORRECT... IDA-STEP... step_export/adjust-coordinate-system
Peter Clifton [Sun, 4 Dec 2016 20:31:07 +0000 (4 20:31 +0000)]
Adjust coordinate system GOODNES KNOWS WHETHER THE GEOMETRY IS CORRECT... IDA-STEP SEEMS TO COPE THOUGH

5 years agoExtend board exportstep_export/extend-board-export
Peter Clifton [Sun, 4 Dec 2016 20:31:07 +0000 (4 20:31 +0000)]
Extend board export

Include emission of soldermask etc..

V2: Apply the solder-mask on top of the board (core) thickness, don't shrink the core to account for it

5 years agoXXX: SEE BELOW.. Alternative, more thorough STEP export codestep_export/alternative-more-thorough-step
Peter Clifton [Sun, 4 Dec 2016 20:31:07 +0000 (4 20:31 +0000)]
XXX: SEE BELOW.. Alternative, more thorough STEP export code

This has mostly been copied and refactored from the 3D code in the branch
local_customisation_pcb+gl. They MAY have diverged, and a common history
should be recreated if possible.

5 years agoChange scroll-wheel bindings to match more GTK applicationsstep_export/change-scroll-wheel-bindings
Peter Clifton [Sun, 4 Dec 2016 20:31:07 +0000 (4 20:31 +0000)]
Change scroll-wheel bindings to match more GTK applications

5 years agoAdd STEPcode based assembly export functionstep_export/add-stepcode-based-assembly
Peter Clifton [Sun, 26 Feb 2017 16:13:22 +0000 (26 16:13 +0000)]
Add STEPcode based assembly export function

5 years agoAdd action to reconstruct pins / vias / holesstep_export/add-action-to-reconstruct-pins
Peter Clifton [Sun, 26 Feb 2017 16:13:21 +0000 (26 16:13 +0000)]
Add action to reconstruct pins / vias / holes

5 years agoAdd action to break elements to pieces in placestep_export/add-action-to-break-elements
Peter Clifton [Thu, 2 Mar 2017 02:33:34 +0000 (2 02:33 +0000)]
Add action to break elements to pieces in place

5 years agoAdd name tags for line contours (and provide partial support for arcs)step_export/add-name-tags-for-line
Peter Clifton [Thu, 2 Mar 2017 02:33:34 +0000 (2 02:33 +0000)]
Add name tags for line contours (and provide partial support for arcs)

5 years agoAdd name tags to contours and feature naming for pins and vias in STEP exportstep_export/add-name-tags-to-contours-and
Peter Clifton [Thu, 2 Mar 2017 02:33:33 +0000 (2 02:33 +0000)]
Add name tags to contours and feature naming for pins and vias in STEP export

5 years agostep: Fixup for refactored HID / HID_DRAW APIstep_export/step-fixup-for-refactored-hid
Peter Clifton [Thu, 2 Mar 2017 02:33:33 +0000 (2 02:33 +0000)]
step: Fixup for refactored HID / HID_DRAW API

5 years agoAdd simple STEP exporter for the board outlinestep_export/add-simple-step-exporter-for
Peter Clifton [Thu, 2 Mar 2017 02:33:33 +0000 (2 02:33 +0000)]
Add simple STEP exporter for the board outline

5 years agoFix 3D contour export3d_foundation3d_foundation/fix-3d-contour-export
Peter Clifton [Thu, 2 Mar 2017 02:32:41 +0000 (2 02:32 +0000)]
Fix 3D contour export

5 years agoRefactor circular contour handling to be more generic3d_foundation/refactor-circular-contour
Peter Clifton [Thu, 2 Mar 2017 02:32:41 +0000 (2 02:32 +0000)]
Refactor circular contour handling to be more generic

5 years agoRemove pseudocode for assembly emission3d_foundation/remove-pseudocode-for-assembly
Peter Clifton [Thu, 2 Mar 2017 02:32:41 +0000 (2 02:32 +0000)]
Remove pseudocode for assembly emission

5 years agoRework step generation a little3d_foundation/extend-board-export
Peter Clifton [Thu, 2 Mar 2017 02:32:41 +0000 (2 02:32 +0000)]
Rework step generation a little

5 years agoAdd wrapper function for appending to GList of step_ids stuffed into pointers.3d_foundation/object3d-step-changes
Peter Clifton [Thu, 2 Mar 2017 02:32:41 +0000 (2 02:32 +0000)]
Add wrapper function for appending to GList of step_ids stuffed into pointers.

Avoids casting

5 years agoAnd working again (mostly)3d_foundation/and-working-again-mostly
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
And working again (mostly)

5 years agoDangling fixup from old way of emitting board contours3d_foundation/dangling-fixup-from-old-way-of
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
Dangling fixup from old way of emitting board contours

5 years agoWell on the way to completely messing up the STEP code, just by flipping the Y coord!3d_foundation/well-on-the-way-to-completely
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
Well on the way to completely messing up the STEP code, just by flipping the Y coord!

5 years agoAttempt to refactor the STEP emission somewhat3d_foundation/attempt-to-refactor-the-step
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
Attempt to refactor the STEP emission somewhat

5 years agoSTEP changes from continue-tinkering-with-3d3d_foundation/continue-tinkering-with-3d-STEP
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
STEP changes from continue-tinkering-with-3d

5 years agoSTEP changes from more-play-with-quad-edge-data3d_foundation/more-play-with-quad-edge-data-STEP
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
STEP changes from more-play-with-quad-edge-data

5 years agoSTEP stuff from wip-on-quad-edge-play3d_foundation/wip-on-quad-edge-play-STEP
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
STEP stuff from wip-on-quad-edge-play

5 years agoSTEP stuff from play-with-quad-edge-data3d_foundation/play-with-quad-edge-data-STEP
Peter Clifton [Thu, 2 Mar 2017 02:32:40 +0000 (2 02:32 +0000)]
STEP stuff from play-with-quad-edge-data

5 years agoRemove object3d test cube and associated debug3d_foundation/remove-object3d-test-cube-and
Peter Clifton [Thu, 2 Mar 2017 02:32:39 +0000 (2 02:32 +0000)]
Remove object3d test cube and associated debug

5 years agoSplice a cylinder onto the top of the board outline (hacky test)3d_foundation/splice-a-cylinder-onto-the-top
Peter Clifton [Thu, 2 Mar 2017 02:32:39 +0000 (2 02:32 +0000)]
Splice a cylinder onto the top of the board outline (hacky test)

5 years agoContinue tinkering with 3D games3d_foundation/continue-tinkering-with-3d
Peter Clifton [Thu, 2 Mar 2017 02:32:39 +0000 (2 02:32 +0000)]
Continue tinkering with 3D games

Add reversed orientation field to face3d structure

5 years agoMore play with quad edge data-structures and STEP export3d_foundation/more-play-with-quad-edge-data
Peter Clifton [Thu, 2 Mar 2017 02:32:39 +0000 (2 02:32 +0000)]
More play with quad edge data-structures and STEP export

5 years agoPlay with quad-edge data-structure - using PCB as a framework for GL!3d_foundation/play-with-quad-edge-data
Peter Clifton [Thu, 2 Mar 2017 02:32:39 +0000 (2 02:32 +0000)]
Play with quad-edge data-structure - using PCB as a framework for GL!

Squashes: WIP on quad edge play

5 years agoRemove debug from outline generationarc_polyarc_poly/remove-debug-from-outline
Peter Clifton [Thu, 2 Mar 2017 02:31:41 +0000 (2 02:31 +0000)]
Remove debug from outline generation

5 years agoTemporarily disable rendering short-cut for round contoursarc_poly/temporarily-disable-rendering
Peter Clifton [Thu, 2 Mar 2017 02:31:41 +0000 (2 02:31 +0000)]
Temporarily disable rendering short-cut for round contours

This lets us see the underlying approximation and edge data instead.

5 years agoRevert "Test routine for poly_InvContour"arc_poly/revert-test-routine-for
Peter Clifton [Thu, 2 Mar 2017 02:31:41 +0000 (2 02:31 +0000)]
Revert "Test routine for poly_InvContour"

This reverts commit e1de240da219e7cd5696ed8dde04b0483abd6e54.

5 years agoTest routine for poly_InvContourarc_poly/test-routine-for
Peter Clifton [Thu, 2 Mar 2017 02:31:41 +0000 (2 02:31 +0000)]
Test routine for poly_InvContour

5 years agoTag VNODEs with details of circular contour segmentsarc_poly/tag-vnodes-with-details-of
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
Tag VNODEs with details of circular contour segments

The idea here is to track that the PWL segments actually came from a
particular underlying curve. This should allow us to reconstruct that
curve (approximately at least) if these segments survive in the final
polygon (are not intersected or removed by boolean operations).

The convention is that the curve shape tagging of a vertex corresponds
to the edge spanning this, and the net vertex around the list. (As per
other existing edge related flags).

NB: STILL DOES NOT WORK CORRECTLY IN ALL CASES. SEE:

circ_segs_test4_still_procuces_bad_contour_when_starting_with_arc.pcb

(SUSPECTED BUG IN THE GATHER / JUMP ROUTINES)

5 years agoDebug rendering for board outlinearc_poly/debug-rendering-for-board
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
Debug rendering for board outline

5 years agoMore debug for circsegs stuffarc_poly/more-debug-for-circsegs-stuff
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
More debug for circsegs stuff

Unite clearance polygons to compute a board-outline polygon...
Lets us explore operations on more specific basis.

5 years agoInvalidate board contour when a via / pin is alteredarc_poly/invalidate-board-contour-when
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
Invalidate board contour when a via / pin is altered

The drill-holes of vias and pins can affect the board contour

5 years agoDisable polygon heritagearc_poly/disable-polygon-heritage
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
Disable polygon heritage

5 years agoRevert "DEBUG STUFF - looking into bad polygons"arc_poly/revert-debug-stuff-looking
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
Revert "DEBUG STUFF - looking into bad polygons"

This reverts commit 292c3e44c385e3ca13127339cbfdeda1d7f6587e.

5 years agoDEBUG STUFF - looking into bad polygonsarc_poly/debug-stuff-looking-into-bad
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
DEBUG STUFF - looking into bad polygons

5 years agopolygon.h: Reduce circ_segs to 8 for debug clarityarc_poly/polygon-h-reduce-circ_segs-to
Peter Clifton [Thu, 2 Mar 2017 02:31:40 +0000 (2 02:31 +0000)]
polygon.h: Reduce circ_segs to 8 for debug clarity

5 years agoTest poly-curve supportarc_poly/test-poly-curve-support
Peter Clifton [Thu, 2 Mar 2017 02:31:39 +0000 (2 02:31 +0000)]
Test poly-curve support

5 years agoLimit virtual memory size of PCB process to avoid swapping my machine to death!arc_poly/limit-virtual-memory-size-of
Peter Clifton [Thu, 2 Mar 2017 02:31:39 +0000 (2 02:31 +0000)]
Limit virtual memory size of PCB process to avoid swapping my machine to death!

Sometimes the polygon code exploded...

5 years agoAdd polygon parentage tree debug viewarc_poly/add-polygon-parentage-tree
Peter Clifton [Thu, 2 Mar 2017 02:31:39 +0000 (2 02:31 +0000)]
Add polygon parentage tree debug view

5 years agopolygon.c: Temporarily disable coalescing adjacent line segmentspolygon_arc_segmentspolygon_arc_segments/polygon-c-temporarily-disable
Peter Clifton [Thu, 2 Mar 2017 02:31:13 +0000 (2 02:31 +0000)]
polygon.c: Temporarily disable coalescing adjacent line segments

We need to extend the tests to properly account for arc segments.

5 years agoCompute the correct boundingbox for a polygon with arc segments.polygon_arc_segments/compute-the-correct
Peter Clifton [Thu, 2 Mar 2017 02:31:12 +0000 (2 02:31 +0000)]
Compute the correct boundingbox for a polygon with arc segments.

5 years agoTemppolygon_arc_segments/temp
Peter Clifton [Thu, 2 Mar 2017 02:31:12 +0000 (2 02:31 +0000)]
Temp

5 years agoAdd support for arc segments in polygon object outline definitionspolygon_arc_segments/add-support-for-arc-segments
Peter Clifton [Thu, 2 Mar 2017 02:31:12 +0000 (2 02:31 +0000)]
Add support for arc segments in polygon object outline definitions

Test with a polygon like this:

  Polygon("clearpoly")
  (
    [5.0000mm 7.0000mm included_angle: 90] [7.0000mm 5.0000mm]
    [28.000mm 5.0000mm included_angle: 90] [30.000mm 7.0000mm]
    [30.000mm 28.000mm included_angle: 90] [28.000mm 30.000mm]
    [7.0000mm 30.000mm included_angle: 90] [5.0000mm 28.000mm]
  )

NOTE THAT THE ARC BOUNDS ARE NOT YET INCLUDED IN THE BOUNDING BOX CALCULATION,
SO THIS WILL BREAK VARIOUS THINGS PRETTY HORRIBLY IF AN ARC PROTRUDES AS AN
EXTREME FEATURE IN EITHER THE +/-X or +/-Y DIRECTIONS.

5 years agoFix for arc bounding box calculation split from later patchpolygon_arc_segments/fix-for-arc-bounding-box
Peter Clifton [Thu, 2 Mar 2017 02:31:12 +0000 (2 02:31 +0000)]
Fix for arc bounding box calculation split from later patch

This probably wants merging with where the problem was introduced,
but at this moment I've not had chance to review the fix is good.

5 years agoRefactor arc bounding box calculations to separate out thin casepolygon_arc_segments/refactor-arc-bounding-box
Peter Clifton [Thu, 2 Mar 2017 02:31:12 +0000 (2 02:31 +0000)]
Refactor arc bounding box calculations to separate out thin case

The thin-arc case will be useful for arc-segments within polycurves.

5 years agoFix labeling of contour which ends up as all SHARED / SHARED2, or all UNKNKWNpolygon_fixespolygon_fixes/fix-labeling-of-contour-which
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Fix labeling of contour which ends up as all SHARED / SHARED2, or all UNKNKWN

SHARED / SHARED2 labelling does not propagate, so if this occurs for an entire
contour, the labelling code would loop forever. (Same as if no cross-connected
vertex with definitive INSIDE / OUTSIDE information was found).

Catch when we wrap around the edge list and then decide how to classify the
whole contour. If it is all UNKNWN, we re-classify it as not intersected. The
cntr_label_POLYAREA() routine is adjusted to handle the possibility that the
label_contour() routine for ISECTED contours changes the contour status back
back to UNKNWN.

If the whole contour is SHARED or SHARED2, we leave it as ISECTED, since there
is no handling of that condition for an entire contour. (It will either be
dropped, or re-constructed, depending on the boolean operation being performed).

5 years agoRemove debug from hairline handling etc..polygon_fixes/remove-debug-from-hairline-0
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Remove debug from hairline handling etc..

5 years agoFix polygon hairline handlingpolygon_fixes/fix-polygon-hairline-handling
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Fix polygon hairline handling

5 years agoRefactor hairline edge checkspolygon_fixes/refactor-hairline-edge-checks
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Refactor hairline edge checks

5 years agoMore work in progresspolygon_fixes/more-work-in-progress
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
More work in progress

5 years agoMore debug stuffpolygon_fixes/more-debug-stuff
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
More debug stuff

5 years agoTemp attempt to try adding nodes when dealing with the inconsistent edge hairline... polygon_fixes/temp-attempt-to-try-adding
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Temp attempt to try adding nodes when dealing with the inconsistent edge hairline case

5 years agoRemove debug from hairline edge codepolygon_fixes/remove-debug-from-hairline
Peter Clifton [Thu, 2 Mar 2017 02:30:47 +0000 (2 02:30 +0000)]
Remove debug from hairline edge code

5 years agoWork in progresspolygon_fixes/work-in-progress
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Work in progress

5 years agoTry to do something about the hairline edgespolygon_fixes/try-to-do-something-about-the
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Try to do something about the hairline edges

5 years agoTMPpolygon_fixes/tmp
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
TMP

5 years agoIdentify and filter out shared edges within each input polygon after intersectingpolygon_fixes/identify-and-filter-out-shared
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Identify and filter out shared edges within each input polygon after intersecting

Shared-edges can result from snap-rounding during intersection turning distinct
edges with similar slopes into new edges which may share identical portions.

These shared edges then confuse the polygon edge labeling code, which needs to
identify distinct spans of inside / outside each contour. As the edges are
identical, they have ambigous sort-order in the resulting CVCList.

5 years agoTemporarily disable the circular contour radius adjustmentpolygon_fixes/temporarily-disable-the
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Temporarily disable the circular contour radius adjustment

Was part of adding arc support, now temporarily borrowed for debugging

5 years agoAllocate VNODE with g_slice_new0, rather than callocpolygon_fixes/allocate-vnode-with
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Allocate VNODE with g_slice_new0, rather than calloc

g_slice should be optimised for lots of small allocations - lets try this..

5 years agopolygon1.c: Move jump call to bottom of Gather..polygon_fixes/polygon1-c-move-jump-call-to
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
polygon1.c: Move jump call to bottom of Gather..

We call Gather from Collect1, having in Collect(), established using the j_rule,
that the edge we wish to start with is not marked, and it suitable for inclusion
in the new polygon contour. (Passing what will be the resulting "from" vertex
into Collect1 to start processing).

The first step in Gather was previously a Jump call - which could switch to the
other polygon contour. (Without including our start edge). The key problem here
is that Jump makes the assumption that the vertex it is passed was reached having
been included in the resulting polygon. (It starts inspection of the CVCList from
the assumed entry edge that reached the given vertex).

In our startup condition, the vertex we pass (usually a from vertex, of a FORWARD
polygon traversal of an edge in the 'A' polygon to be included in the resulting
contour), is not necessarily preceeded by an edge on that same source contour that
will end up in the resulting polyon - leading to the possibility that Jump gets
the wrong result. (This is a by-inspection / theoretical issue, not one yet known
to cause any particular bug).

The fix is to include the edge segment we start with, BEFORE calling jump in Collect.
Once our start edge is included, the assumptions made by Jump should hold.

5 years agoUse g_critical_if_fail rather than assert for edge_labelpolygon_fixes/use-g_critical_if_fail-rather
Peter Clifton [Thu, 2 Mar 2017 02:30:46 +0000 (2 02:30 +0000)]
Use g_critical_if_fail rather than assert for edge_label

5 years agoAttempt to splice in edge_label routine from later in patch series...polygon_fixes/attempt-to-splice-in
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
Attempt to splice in edge_label routine from later in patch series...

This corrects the bogus fix for hairline edges in the previous patch,
simplifying edge_label, but it DOES NOT address how to deal with these
hairline edge pairs.

With debugging on the test-cases causing problem will fail.

With arc radius compensation disabled in polygon.h, the following will
produce hairline edge pairs, and cause problems..

Via[8475.00mil 5575.00mil 40.00mil 30.00mil 0.0000 20.00mil "" ""]

Layer(1 "component")
(
)
Layer(2 "solder")
(
  Line[8425.00mil 6250.00mil 8425.00mil 4475.00mil 25.00mil 30.00mil "clearline"]
  Line[8475.00mil 5575.00mil 8475.00mil 4425.00mil 15.00mil 30.00mil "clearline"]
  Polygon("clearpoly")
  (
    [6350.00mil 6650.00mil] [6350.00mil 4150.00mil] [9050.00mil 4150.00mil] [9050.00mil 6650.00mil]
  )
)

The diff for polygon.h:

diff --git a/src/polygon.h b/src/polygon.h
index a369096..0cba2bf 100644
--- a/src/polygon.h
+++ b/src/polygon.h
@@ -37,11 +37,28 @@
 #define POLY_CIRC_SEGS 8//40
 #define POLY_CIRC_SEGS_F ((float)POLY_CIRC_SEGS)

+#if 0
+/* THIS IS BROKEN:
+ *
+ * IT BREAKS THE CIRCULARITY OF CIRULAR CONTORS, AS THE FIRST
+ * FIRST VERTEX ADDED BY CirclePoly IS NOT RADIUS ADJUSTED.
+ *
+ * IT BREAKS CIRCULARITY OF ALIGMENT BETWEEN A LINE AND ITS END-CAPS,
+ * LEADING TO MORE COMPLEX CONTOURS FOR COMMON LINE-LINE INTERSECTIONS,
+ * SUCH AS 90 AND 45 DEGREE ANGLES
+ *
+ * IT WAS INTENDED TO AVOID DRC ERRORS WITH "TOO-CLOSE" FEATURES,
+ * BUT COULD OTHERWISE CAUSE THEM FOR "TOO THIN" FEATURES - INSIDE/OUTSIDE
+ * CONTOUR APPROXIMATION NEEDS TO BE CONTROLED DEPENDING ON THE REQUIREMENT
+ */
 /* adjustment to make the segments outline the circle rather than connect
  * points on the circle: 1 - cos (\alpha / 2) < (\alpha / 2) ^ 2 / 2
  */
 #define POLY_CIRC_RADIUS_ADJ (1.0 + M_PI / POLY_CIRC_SEGS_F * \
                                     M_PI / POLY_CIRC_SEGS_F / 2.0)
+#else
+#define POLY_CIRC_RADIUS_ADJ 1.0
+#endif

 /* polygon diverges from modelled arc no more than MAX_ARC_DEVIATION * thick */
 #define POLY_ARC_MAX_DEVIATION 0.02

5 years agoXXX: ON REFLECTION, THIS "FIX" IS BOGUS... Fix bug in polygon contour generationpolygon_fixes/fix-bug-in-polygon-contour
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
XXX: ON REFLECTION, THIS "FIX" IS BOGUS... Fix bug in polygon contour generation

Incorrect contours were emitted in some cases when snap-rounding of vertices to
the integer grid cause coincident shared vertices from the same polygon to meet
at a cross-connected vertex.

The geometry required to create this situation is tricky, but could be provoked
in certain conditions by exactly touching line clearance polygons. (Due to
subtle rounding errors in the clearance polygons don't always meet exactly).

Distilling a simpler test case, the following polygons (on layer A and B)
should be united to reproduce the bug. (NB: The A POLYAREA has two contours
which touch at a single point):

  Layer(1 "A")
  (
    Polygon("")
    (
      [51.0000mm 18.0000mm] [51.0000mm 12.0000mm] [140.0000mm 12.0000mm  ] [144.0000mm 18.0000mm]
    )
    Polygon("")
    (
      [51.0000mm 6.0000mm] [144.0000mm 6.0000mm] [140.0000mm 12.0000mm] [51.0000mm 11.99996mm]
    )
  )
  Layer(2 "B")
  (
    Polygon("clearpoly")
    (
      [139.0000mm 5.0000mm] [145.0000mm 5.0000mm] [145.0000mm 19.0000mm] [139.0000mm 19.0000mm]
    )
  )

In this case the two contours of the 'A' polygon each have an edge that is
horizontal (or very close to horizontal), and meet at a single point inside
the 'B' polygon contour. Due to rounding onto the integer grid, both lines
intersect the B contour at the same point, leaving two coincident edge
fragments belonging to the A contour meeting at that one vertex on the B
contour.

In the above example, operation ordering conspires to insert the two identical
A edges into the CVC list for the common intersection point on the B contour,
in an incorrect order. (They are sorted by pseudo-angles, which are identical
in this case). The reversed order of these paired edges then upsets contour
labeling in node_label().

This commit fixes node_label() to look for and skip pairs of identically angled
edges from the same polygon when iterating around the CVC list. (We can
determine the INSIDE/OUTSIDE status when we find the next, non-paired edge from
the other polygon).

5 years agoIntroduce macros for traversing between edges and nodes in a specified directionpolygon_fixes/introduce-macros-for
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
Introduce macros for traversing between edges and nodes in a specified direction

This greatly simplifies the code, at the cost of the traversal direction being
slightly less explicit.

5 years agopolygon1.c: Refactor poly_Copy0 to use poly_Create(), rather than open-codingpolygon_fixes/polygon1-c-refactor-poly_copy0
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
polygon1.c: Refactor poly_Copy0 to use poly_Create(), rather than open-coding

This ensures all polygon initialisation happens in a common place

5 years agopolygon1.c: Fix unitialised output polygon upon when hitting allocation failurepolygon_fixes/polygon1-c-fix-unitialised
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
polygon1.c: Fix unitialised output polygon upon when hitting allocation failure

This was a bug present in the poly_Boolean() routine. We need to set the output
polygon to NULL if we are going to return early on memory failure. This was
noticed during general review after observing problems due to our copy routines
incorrectly returning FALSE when copying a NULL polygon.

5 years agoFix return codes from poly_Copy* functions when coping NULL input polygonspolygon_fixes/fix-return-codes-from
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
Fix return codes from poly_Copy* functions when coping NULL input polygons

Copying a NULL polygon results in a NULL return polygon. This is not an error,
so be sure to return TRUE for success, otherwise we can abort boolean
later processing incorrectly, such as in poly_Boolean and poly_BooleanFree

5 years agopolygon1.c: Remove now unused memory allocation macro MemGetpolygon_fixes/polygon1-c-remove-now-unused
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
polygon1.c: Remove now unused memory allocation macro MemGet

5 years agopolyon1.c: Rework InsCntr to re-use poly_Create() rather than open-codingpolygon_fixes/polyon1-c-rework-inscntr-to-re
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
polyon1.c: Rework InsCntr to re-use poly_Create() rather than open-coding

This allows us to ensure common initialisation is performed in poly_Create().

This commit removes the single case where the memory allocation macro MemGet
was called, which will be removed in a later commit.

5 years agoMake poly_Copy1 a static function internal to polygon1.cpolygon_fixes/make-poly_copy1-a-static
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
Make poly_Copy1 a static function internal to polygon1.c

5 years agopolygon.c: Refactor NoHolesPolygonDicer to call poly_Copy0 rather than poly_Copy1polygon_fixes/polygon-c-refactor
Peter Clifton [Thu, 2 Mar 2017 02:30:45 +0000 (2 02:30 +0000)]
polygon.c: Refactor NoHolesPolygonDicer to call poly_Copy0 rather than poly_Copy1

poly_Copy1 is much more of an internal function to polygon1.c, and this is its
only external caller. Replace this occurance with poly_Copy0, which is intended
to be the public API.

5 years agoAttempt to fix bad rtree usage in polygon codepolygon_fixes/attempt-to-fix-bad-rtree-usage
Peter Clifton [Thu, 2 Mar 2017 02:30:44 +0000 (2 02:30 +0000)]
Attempt to fix bad rtree usage in polygon code

We need to delete the rtree entry before updating any bounds, otherwise
bad things might happen (and certainly, with NDEBUG undefined, we may
get asserts firing in rtree.c)

To avoid computational expense deleting and removing from the rtree in
the general case (where we wouldn't expect bounds to change), a new
test function has been added which determines whether the contour bounds
will be updated or not.

5 years agoTry applying Martin's upstream patch (or similar)... and see how that looks with... polygon_fixes/try-applying-martin-s-upstream
Peter Clifton [Thu, 2 Mar 2017 02:30:44 +0000 (2 02:30 +0000)]
Try applying Martin's upstream patch (or similar)... and see how that looks with our new macros

5 years agoRename v->e and e->v to clairfy edge vs. vertex usagepolygon_fixes/rename-v-e-and-e-v-to-clairfy
Peter Clifton [Thu, 2 Mar 2017 02:30:44 +0000 (2 02:30 +0000)]
Rename v->e and e->v to clairfy edge vs. vertex usage

5 years agopolygon1.c: Rename rule and v_rule to j_rule for consistencypolygon_fixes/polygon1-c-rename-rule-and
Peter Clifton [Thu, 2 Mar 2017 02:30:44 +0000 (2 02:30 +0000)]
polygon1.c: Rename rule and v_rule to j_rule for consistency