Orientation
Страница в процессе перевода. |
Many geometric processing algorithms for 2D geometries rely on the concept of orientation
, which is illustrated below.
#
Meshes.OrientationType
— Type
OrientationType
The different types of orientation of a ring. Possible values are CW
and CCW
.
#
Meshes.orientation
— Function
orientation(geom)
Returns the orientation of the geometry geom
as either counter-clockwise (CCW) or clockwise (CW).
For polygons without holes, the function returns the orientation of the boundary, which is a Ring
:
tri = Triangle((0, 0), (1, 0), (0, 1))
orientation(tri)
CCW::OrientationType = 1
tri = Triangle((0, 0), (0, 1), (1, 0))
orientation(tri)
CW::OrientationType = 0
For polygons with holes, the function returns a vector with the orientation of all constituent rings:
outer = [(0, 0), (1, 0), (1, 1), (0, 1)]
hole1 = [(0.2, 0.2), (0.2, 0.4), (0.4, 0.4), (0.4, 0.2)]
hole2 = [(0.6, 0.2), (0.6, 0.4), (0.8, 0.4), (0.8, 0.2)]
poly = PolyArea([outer, hole1, hole2])
orientation(poly)
3-element Vector{OrientationType}:
CCW::OrientationType = 1
CW::OrientationType = 0
CW::OrientationType = 0