WOLFRAM

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

CrossingCount [contour,p]

gives a count of the number of times a ray starting from the point p crosses the closed curve contour.

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

CrossingCount [contour,p]

gives a count of the number of times a ray starting from the point p crosses the closed curve contour.

Details and Options

  • CrossingCount is also known as crossing number.
  • CrossingCount is typically used to determine the inclusion of a point in a polygon.
  • If the closed curve contour is selfintersecting, CrossingCount [contour,p] gives the minimal count among all rays starting from the point p.
  • 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.

Examples

open all close all

Basic Examples  (1)

Count how many times a ray starting from the point crosses the closed-curve contour:

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

Scope  (3)

Count how many times a ray starting from the point crosses the closed-curve contour:

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

Polygon boundary curves:

Wolfram Language code: ℛ = Polygon[{{0.35, 0.2}, {0.9, 0.75}, {0.1, 0.55}, {0.9, 0.35}, {0.42, 0.9}}, {1, 2, 3, 4, 5}];
Wolfram Language code: CrossingCount[ℛ, {0.5, 0.7}]
Wolfram Language code: Graphics[{ℛ, Red, Point[{0.5, 0.7}]}]

Polygons with GeoGridPosition :

Wolfram Language code: ℛ = 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"]];
Wolfram Language code: CrossingCount[ℛ, {-0.995, 1.237}]
Wolfram Language code: Region[ℛ, Epilog -> {Red, Point[{-0.995, 1.237}]}]

Applications  (1)

Color points based on the crossing count of a point in the given polygon:

Wolfram Language code: ℛ = DynamicModule[«3»];
Wolfram Language code: points = RandomReal[{0, 1}, {8000, 2}];
Wolfram Language code: counts = CrossingCount[ℛ, points];
Wolfram Language code: Graphics[{AbsolutePointSize[1], Point[points, VertexColors -> {Green, Blue, Red}[[counts + 1]] ]}]

Properties & Relations  (1)

WindingCount 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: {WindingCount[contour, {0.5, 0.5}], CrossingCount[contour, {0.5, 0.5}]}
Wolfram Research (2019), CrossingCount, Wolfram Language function, https://reference.wolfram.com/language/ref/CrossingCount.html.

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

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

Top [フレーム]

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