WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

WindingCount [contour,p]

gives the count of the number of times a closed curve winds around a point p.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Applications  
Properties & Relations  
Possible Issues  
See Also
Related Guides
History
Cite this Page

WindingCount [contour,p]

gives the count of the number of times a closed curve winds around a point p.

Details and Options

  • WindingCount is also known as winding number.
  • WindingCount is typically used to define a polygon from self-intersecting closed curves.
  • A counterclockwise revolution has a value 1 and a clockwise revolution has a value -1. For several contours, the number of revolutions around p is the sum of the number of revolutions for each contour.
  • The closed curve contour is typically a collection of line segments Line [{{p1,p2},,{pn-1,pn},{pn,p1}}] and must lie in a plane.
  • For a polygon poly, WindingCount [poly,p] gives the number of times the polygon boundary curves wind around the point p.

Examples

open all close all

Basic Examples  (1)

Count how many times a closed curve winds around a point:

Wolfram Language code: ℛ = Line[{{1, 0}, {0, 3 / 2}, {-1, 0}, {1, 0}}];
Wolfram Language code: WindingCount[ℛ, {0, 1 / 2}]
Wolfram Language code: Graphics[{ℛ, Red, Point[{0, 1 / 2}]}]

Scope  (2)

Count how many times a closed curve winds around a point:

Wolfram Language code: ℛ = Line[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}, {0.35, 0.2}}];
Wolfram Language code: WindingCount[ℛ, {0.55, 0.6}]
Wolfram Language code: Graphics[{ℛ, Red, Point[{0.55, 0.6}]}]

Count how many times a polygon boundary curve winds around a point:

Wolfram Language code: ℛ = Polygon[{{1, 0}, {0, 2}, {-1, 0}, {0, 1}}, {1, 2, 3, 4}];
Wolfram Language code: WindingCount[ℛ, {0, 1.5}]
Wolfram Language code: Graphics[{ℛ, Red, Point[{0, 1.5}]}]

Applications  (2)

Find the polygon density of regular star polygons:

Wolfram Language code: starPolygonBoundary[{p_, q_}] := Line[CirclePoints[p][[NestList[Mod[# + q, p, 1] &, 1, p]]]]
Wolfram Language code: ℛ = starPolygonBoundary[{7, 3}];
Wolfram Language code: WindingCount[ℛ, {0, 0}]
Wolfram Language code: Graphics[{ℛ, Red, Point[{0, 0}]}]

Color points by the winding count of the point around the given contour:

Wolfram Language code: ℛ = IconizedObject[«[image]»];
Wolfram Language code: points = RandomReal[{-1, 1}, {10000, 2}];
Wolfram Language code: counts = WindingCount[ℛ, points];
Wolfram Language code: Graphics[{AbsolutePointSize[1], Point[points, VertexColors -> (ColorData[102] /@ counts)]}]

Properties & Relations  (1)

CrossingCount is an alternate count function:

Wolfram Language code: contour = Line[{{0.35, 0.2}, {0.42, 0.9}, {0.9, 0.35}, {0.1, 0.55}, {0.9, 0.75}, {0.35, 0.2}}];
Wolfram Language code: {CrossingCount[contour, {0.5, 0.5}], WindingCount[contour, {0.5, 0.5}]}

Possible Issues  (1)

A polygon boundary curve is always given in the counterclockwise orientation with no overlapping:

Wolfram Language code: ℛ = {{(1/2), 1}, {1, 0}, {0, 0}, {(1/2), 1}, {1, 0}, {0, 0}};
Wolfram Language code: RegionBoundary[Polygon[ℛ]]

The winding count:

Wolfram Language code: WindingCount[Polygon[ℛ], {1 / 2, 1 / 2}]
Wolfram Language code: Graphics[{Arrowheads[Medium], Arrow[ℛ], Red, Point[{1 / 2, 1 / 2}]}]

See Also

CrossingCount   WindingPolygon   CrossingPolygon   Polygon   Line   Point

Function Repository: TurningNumber

Wolfram Research (2019), WindingCount, Wolfram Language function, https://reference.wolfram.com/language/ref/WindingCount.html.

Text

Wolfram Research (2019), WindingCount, Wolfram Language function, https://reference.wolfram.com/language/ref/WindingCount.html.

CMS

Wolfram Language. 2019. "WindingCount." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/WindingCount.html.

APA

Wolfram Language. (2019). WindingCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/WindingCount.html

BibTeX

@misc{reference.wolfram_2026_windingcount, author="Wolfram Research", title="{WindingCount}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/WindingCount.html}", note=[Accessed: 14-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_windingcount, organization={Wolfram Research}, title={WindingCount}, year={2019}, url={https://reference.wolfram.com/language/ref/WindingCount.html}, note=[Accessed: 14-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /