CanonicalizePolygon[poly]
gives a canonical representation of the polygon poly with shared coordinates and with inner and outer boundaries.
CanonicalizePolygon[poly,"filter"]
gives a canonical representation of poly with the specified filter.
CanonicalizePolygon
CanonicalizePolygon[poly]
gives a canonical representation of the polygon poly with shared coordinates and with inner and outer boundaries.
CanonicalizePolygon[poly,"filter"]
gives a canonical representation of poly with the specified filter.
Details
- CanonicalizePolygon is used to get a simple standard representation of a polygon from various representations and descriptions.
- CanonicalizePolygon converts a polygon to an optimized standard form Polygon[{p1,p2,…},{outer1,outer2inner2,…}].
- The points pi are the endpoints of nonintersecting line segments and sorted into Sort order.
- An outer boundary outerk is a closed curve with line segments {pi,pj}, possibly touching at endpoints but no other crossings.
- An inner boundary innerk is a closed curve with line segments {pi,pj}, possibly touching at endpoints but no other crossings.
- The general polygon specification makes it possible to give degenerate polygons representing lines and points. By using the "filter" specification, it is possible to control whether these lower-dimensional components are kept.
- Possible "filter" specifications include:
-

All all components, including lines and points 
Full full-dimensional components only
Examples
open all close allBasic Examples (1)
Find the canonical form of a Polygon:
𝒫 = Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}];CanonicalizePolygon[𝒫]Graphics[%]Scope (9)
Basic Uses (7)
CanonicalizePolygon works on polygons:
Polygon[{{0, 0}, {1., 0.}, {0.5, 1}}];CanonicalizePolygon[%]CanonicalizePolygon[Triangle[]]CanonicalizePolygon[Rectangle[]]Polygon[{{0, 0}, {3, 0}, {3, 3}, {0, 3}, {1, 1}, {1, 2}, {2, 2}, {2, 1}}, {1, 2, 3, 4} -> {{5, 6, 7, 8}}];CanonicalizePolygon[%]CanonicalizePolygon works on polygons with geographic entities:
CanonicalizePolygon[Polygon[["france"]]]Polygon with GeoPosition:
Polygon[GeoPosition[{{{40.083441, -88.235716}, {40.083607, -88.257488}, {40.082603, -88.257149},
{40.076136999999996, -88.25740499999999}, {40.076178, -88.270888}, {40.076516, -88.271558},
{40.083686, -88.271512}, {40.083659999999995, -88.267046}, ... 33323}, {40.098112, -88.228687},
{40.095216, -88.228627}, {40.095179, -88.238547}, {40.094480999999995, -88.238546},
{40.094508999999995, -88.23267}, {40.094106, -88.232556}, {40.090666999999996, -88.232477},
{40.090741, -88.235745}}}]];CanonicalizePolygon[%]Polygon with GeoPositionXYZ:
Polygon[GeoPositionXYZ[{{{150451.6968462432, -4.884430486484052*^6, 4.085078564164219*^6},
{148595.27532671497, -4.884475441490381*^6, 4.085092666620835*^6},
{148626.35829777512, -4.884546311005128*^6, 4.0850073717259285*^6},
{148618.5908634042 ... 7*^6, 4.0860187668081024*^6},
{150697.56410771207, -4.8836599487428395*^6, 4.085984535480795*^6},
{150711.88303095422, -4.883905546449982*^6, 4.0856924143435075*^6},
{150433.15479548014, -4.883908845676418*^6, 4.0856987003255524*^6}}}]];CanonicalizePolygon[%]Polygon with GeoPositionENU:
Polygon[GeoPositionENU[{{{3378.2547059731055, -3369.2234780923936, -0.7440009205072329},
{1521.3211635380246, -3351.391253626573, -0.022340134218666208},
{1550.2571145363192, -3462.8657556618973, -0.08899812728964207},
{1528.5672303494055, -418 ... 63383291193, -0.37494203351275246},
{3654.121991908476, -2566.7472331234085, -0.5214977847472255},
{3375.420726854886, -2558.6597093173914, -0.3648706331350695}}},
GeoPosition[{40.11379115639895, -88.2753251202516, -1.0415787873318691}]]];CanonicalizePolygon[%]Polygon with GeoGridPosition:
Polygon[GeoGridPosition[{{{-0.9950503945490105, 1.2366760550756015},
{-0.9952074890903578, 1.2369207053693891}, {-0.9952196732768064, 1.2369073327446167},
{-0.9953160063787643, 1.236848436956935}, {-0.9954141759436825, 1.2369993898475449},
{-0. ... 197645333103}, {-0.9949098578570917, 1.2368130881428654},
{-0.9948663952535768, 1.2367477711687371}, {-0.9948714472169538, 1.2367426500757825},
{-0.9949211061652593, 1.2367089232486177}, {-0.9949439717990124, 1.236746107097628}}}, "Bonne"]];CanonicalizePolygon[%]Polygon[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}}];CanonicalizePolygon[%]Polygons with disconnected components:
Polygon[{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {2, 1}, {1, 2}}, {{1, 2, 3}, {4, 5, 6}}];CanonicalizePolygon[%]Polygon[{{2, 3, 1, 0}, {6, 9, 1, 0}, {5, 4, 1, 0}, {8, 2, 1, 0}}, {1, 2, 3, 4}];CanonicalizePolygon[%]Specifications (2)
Find all components of polygons:
𝒫 = Polygon[{{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, {{2, 2}, {3, 3}}}]CanonicalizePolygon[𝒫, All]Find full-dimensional components of polygons:
𝒫 = Polygon[{{{1, 0}, {0, Sqrt[3]}, {-1, 0}}, {{2, 2}, {3, 3}}}]CanonicalizePolygon[𝒫, Full]Applications (2)
Set up a graphics complex with shared coordinates:
𝒞𝒫 = CanonicalizePolygon[Polygon[{{{0, 0, 0}, {2, 0, 0}, {1, 1, 2}}, {{2, 0, 0}, {2, 2, 0}, {1, 1, 2}}, {{2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, {{0, 2, 0}, {0, 0, 0}, {1, 1, 2}}}]]Graphics3D[{GraphicsComplex[𝒞𝒫[[1]], Polygon[𝒞𝒫[[2]]]]}]Find self-intersection points of given segments:
seg = {{-0.6, -0.8}, {0.9, 0.3}, {-0.9, 0.3}, {0.6, -0.8}, {0., 1.}, {-0.6, -0.8}};coords = CanonicalizePolygon[Polygon[seg]][[1]];intersection = Complement[coords, seg];Graphics[{Line[seg], PointSize[Medium], Red, Point[intersection], Blue, Point[seg]}]Properties & Relations (4)
Using CanonicalizePolygon to get PolygonCoordinates:
𝒫 = Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}];First[CanonicalizePolygon[𝒫]]PolygonCoordinates[𝒫]The CanonicalizePolygon of simple polygons preserves the number of polygon coordinates:
𝒫 = Polygon[{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}];SimplePolygonQ[𝒫]Length[First[#]]& /@ {𝒫, CanonicalizePolygon[𝒫]}OuterPolygon gives the canonical representation of the outer polygon:
OuterPolygon[Polygon[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}}]]InnerPolygon gives the canonical representation of the inner polygon:
InnerPolygon[Polygon[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}}]]Possible Issues (1)
CanonicalizePolygon works only on geometric regions:
𝒫 = Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 0}, {0, 0, 1}}];{CanonicalizePolygon[𝒫], RegionQ[𝒫]}Related Guides
-
▪
- Polygons
History
Text
Wolfram Research (2019), CanonicalizePolygon, Wolfram Language function, https://reference.wolfram.com/language/ref/CanonicalizePolygon.html.
CMS
Wolfram Language. 2019. "CanonicalizePolygon." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CanonicalizePolygon.html.
APA
Wolfram Language. (2019). CanonicalizePolygon. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CanonicalizePolygon.html
BibTeX
@misc{reference.wolfram_2026_canonicalizepolygon, author="Wolfram Research", title="{CanonicalizePolygon}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/CanonicalizePolygon.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_canonicalizepolygon, organization={Wolfram Research}, title={CanonicalizePolygon}, year={2019}, url={https://reference.wolfram.com/language/ref/CanonicalizePolygon.html}, note=[Accessed: 12-June-2026]}