diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp index 0410323145..bf4518a932 100644 --- a/gerbview/gerbview_painter.cpp +++ b/gerbview/gerbview_painter.cpp @@ -282,8 +282,11 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer ) // On Opengl, a not convex filled polygon is usually drawn by using triangles as // primitives. CacheTriangulation() can create basic triangle primitives to draw the // polygon solid shape on Opengl + // We use the fastest CacheTriangulation calculation mode: no partition created because + // the partition is useless in Gerbview, and very time consumming (optimized only + // for pcbnew that has different internal unit) if( m_gal->IsOpenGlEngine() && !aItem->m_AbsolutePolygon.IsTriangulationUpToDate() ) - aItem->m_AbsolutePolygon.CacheTriangulation(); + aItem->m_AbsolutePolygon.CacheTriangulation( false /* fastest triangulation calculation mode */ ); m_gal->DrawPolygon( aItem->m_AbsolutePolygon ); } diff --git a/libs/kimath/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h index 528bd4fe5b..40a15d00f8 100644 --- a/libs/kimath/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -498,6 +498,16 @@ public: SHAPE_POLY_SET& operator=( const SHAPE_POLY_SET& aOther ); + /** + * Build a polygon triangulation, needed to draw a polygon on OpenGL and in some + * other calculations + * @param aPartition = true to created a trinagulation in a partition on a grid + * false to create a more basic triangulation of the polygons + * Note + * in partition calculations the grid size is hard coded to 1e7. + * This is a good value for Pcbnew: 1cm, in internal units. + * But not good for Gerbview (1e7 = 10cm), however using a partition is not useful. + */ void CacheTriangulation( bool aPartition = true ); bool IsTriangulationUpToDate() const; @@ -1359,7 +1369,7 @@ public: /** * Build a SHAPE_POLY_SET from a bunch of outlines in provided in random order. - * + * * @param aPath set of closed outlines forming the polygon. Positive orientation = outline, negative = hole * @param aReverseOrientation inverts the sign of the orientation of aPaths (so negative = outline) * @param aEvenOdd forces the even-off fill rule (default is non zero)