KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_poly_triangulation.cpp File Reference
#include <geometry/shape_poly_set.h>
#include <geometry/shape_line_chain.h>
#include <geometry/polygon_triangulation.h>
#include <trigo.h>
#include <thread>
#include <chrono>
#include <future>
#include <qa_utils/geometry/geometry.h>
#include <qa_utils/numeric.h>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include "geom_test_utils.h"

Go to the source code of this file.

Classes

class  TRIANGULATION_TEST_FIXTURE
 

Functions

SHAPE_LINE_CHAIN createSquare (int size=100, VECTOR2I offset=VECTOR2I(0, 0))
 
SHAPE_LINE_CHAIN createTriangle (int size=100, VECTOR2I offset=VECTOR2I(0, 0))
 
SHAPE_LINE_CHAIN createConcavePolygon (int size=100)
 
bool validateTriangulation (const SHAPE_POLY_SET::TRIANGULATED_POLYGON &result, const SHAPE_LINE_CHAIN &original, bool strict=true)
 
 BOOST_AUTO_TEST_CASE (BasicTriangleTriangulation)
 
 BOOST_AUTO_TEST_CASE (BasicSquareTriangulation)
 
 BOOST_AUTO_TEST_CASE (ConcavePolygonTriangulation)
 
 BOOST_AUTO_TEST_CASE (HintDataOptimization)
 
 BOOST_AUTO_TEST_CASE (HintDataInvalidation)
 
 BOOST_AUTO_TEST_CASE (DegeneratePolygons)
 
 BOOST_AUTO_TEST_CASE (ZeroAreaPolygon)
 
 BOOST_AUTO_TEST_CASE (MemoryManagement)
 
 BOOST_AUTO_TEST_CASE (LargePolygonStressTest)
 
 BOOST_AUTO_TEST_CASE (ConcurrentTriangulation)
 
 BOOST_AUTO_TEST_CASE (SelfIntersectingPolygon)
 
 BOOST_AUTO_TEST_CASE (Issue18083_SelfIntersectingPolygonArea)
 Test case for GitLab issue #18083: Self-intersecting filled shape is not completely filled.
 
 BOOST_AUTO_TEST_CASE (NearlyCollinearVertices)
 
 BOOST_AUTO_TEST_CASE (DuplicateVertices)
 
 BOOST_AUTO_TEST_CASE (ExtremeCoordinates)
 
 BOOST_AUTO_TEST_CASE (ErrorRecoveryAndCleanup)
 
 BOOST_AUTO_TEST_CASE (TriangulatedPolygonInterface)
 
 BOOST_AUTO_TEST_CASE (SourceOutlineIndexTracking)
 
 BOOST_AUTO_TEST_CASE (PerformanceRegression)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/19]

◆ BOOST_AUTO_TEST_CASE() [2/19]

◆ BOOST_AUTO_TEST_CASE() [3/19]

◆ BOOST_AUTO_TEST_CASE() [4/19]

◆ BOOST_AUTO_TEST_CASE() [5/19]

◆ BOOST_AUTO_TEST_CASE() [6/19]

◆ BOOST_AUTO_TEST_CASE() [7/19]

◆ BOOST_AUTO_TEST_CASE() [8/19]

◆ BOOST_AUTO_TEST_CASE() [9/19]

◆ BOOST_AUTO_TEST_CASE() [10/19]

◆ BOOST_AUTO_TEST_CASE() [11/19]

BOOST_AUTO_TEST_CASE ( Issue18083_SelfIntersectingPolygonArea )

Test case for GitLab issue #18083: Self-intersecting filled shape is not completely filled.

A self-touching polygon where one vertex lies on a non-adjacent edge creates a "pinch point". The polygon appears to form a figure-8 shape that should be fully filled on both sides.

The polygon from the issue has points: (165,87), (179,87), (174,94), (169,87), (167,94) where vertex (169,87) lies on the segment from (165,87) to (179,87).

This test verifies that the triangulation correctly fills both regions of the self-touching polygon by checking that the total triangulated area equals the sum of both triangular lobes.

Definition at line 474 of file test_poly_triangulation.cpp.

References std::abs(), SHAPE_POLY_SET::AddOutline(), SHAPE_LINE_CHAIN::Append(), BOOST_TEST(), SHAPE_POLY_SET::CacheTriangulation(), SHAPE_POLY_SET::IsSelfIntersecting(), SHAPE_POLY_SET::IsTriangulationUpToDate(), SHAPE_LINE_CHAIN::SetClosed(), SHAPE_POLY_SET::TriangulatedPolyCount(), and SHAPE_POLY_SET::TriangulatedPolygon().

◆ BOOST_AUTO_TEST_CASE() [12/19]

◆ BOOST_AUTO_TEST_CASE() [13/19]

◆ BOOST_AUTO_TEST_CASE() [14/19]

◆ BOOST_AUTO_TEST_CASE() [15/19]

BOOST_AUTO_TEST_CASE ( PerformanceRegression )

◆ BOOST_AUTO_TEST_CASE() [16/19]

◆ BOOST_AUTO_TEST_CASE() [17/19]

BOOST_AUTO_TEST_CASE ( SourceOutlineIndexTracking )

◆ BOOST_AUTO_TEST_CASE() [18/19]

◆ BOOST_AUTO_TEST_CASE() [19/19]

◆ createConcavePolygon()

SHAPE_LINE_CHAIN createConcavePolygon ( int size = 100)

Definition at line 71 of file test_poly_triangulation.cpp.

References chain.

Referenced by BOOST_AUTO_TEST_CASE().

◆ createSquare()

◆ createTriangle()

SHAPE_LINE_CHAIN createTriangle ( int size = 100,
VECTOR2I offset = VECTOR2I(0, 0) )

◆ validateTriangulation()