In
mathematics
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, an orientation of a
curve
In mathematics, a curve (also called a curved line in older texts) is an object similar to a line, but that does not have to be straight.
Intuitively, a curve may be thought of as the trace left by a moving point. This is the definition that ...
is the choice of one of the two possible
directions for travelling on the curve. For example, for
Cartesian coordinates
In geometry, a Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of real numbers called ''coordinates'', which are the signed distances to the point from two fixed perpendicular o ...
, the -axis is traditionally oriented toward the right, and the -axis is upward oriented.
In the case of a
plane simple closed curve (that is, a curve in the plane whose starting point is also the end point and which has no other self-intersections), the curve is said to be positively oriented or counterclockwise oriented, if one always has the curve interior to the left (and consequently, the curve exterior to the right), when traveling on it. Otherwise, that is if left and right are exchanged, the curve is negatively oriented or clockwise oriented. This definition relies on the fact that every simple closed curve admits a well-defined interior, which follows from the
Jordan curve theorem
In topology, the Jordan curve theorem (JCT), formulated by Camille Jordan in 1887, asserts that every ''Jordan curve'' (a plane simple closed curve) divides the plane into an "interior" region Boundary (topology), bounded by the curve (not to be ...
.
The
inner loop
In computer programs, an important form of control flow is the Loop (computing), loop which causes a block of code to be executed more than once. A common idiom is to have a loop Nested loop, nested inside another loop, with the contained loop be ...
of a beltway road in a country where people drive on the right side of the road is an example of a negatively oriented (
clockwise
Two-dimensional rotation can occur in two possible directions or senses of rotation. Clockwise motion (abbreviated CW) proceeds in the same direction as a clock's hands relative to the observer: from the top to the right, then down and then to ...
) curve. In
trigonometry
Trigonometry () is a branch of mathematics concerned with relationships between angles and side lengths of triangles. In particular, the trigonometric functions relate the angles of a right triangle with ratios of its side lengths. The fiel ...
, the
unit circle
In mathematics, a unit circle is a circle of unit radius—that is, a radius of 1. Frequently, especially in trigonometry, the unit circle is the circle of radius 1 centered at the origin (0, 0) in the Cartesian coordinate system in the Eucli ...
is traditionally oriented
counterclockwise
Two-dimensional rotation can occur in two possible directions or senses of rotation. Clockwise motion (abbreviated CW) proceeds in the same direction as a clock's hands relative to the observer: from the top to the right, then down and then to ...
.
The concept of ''orientation'' of a curve is just a particular case of the notion of
orientation
Orientation may refer to:
Positioning in physical space
* Map orientation, the relationship between directions on a map and compass directions
* Orientation (housing), the position of a building with respect to the sun, a concept in building des ...
of a
manifold
In mathematics, a manifold is a topological space that locally resembles Euclidean space near each point. More precisely, an n-dimensional manifold, or ''n-manifold'' for short, is a topological space with the property that each point has a N ...
(that is, besides orientation of a curve one may also speak of orientation of a
surface
A surface, as the term is most generally used, is the outermost or uppermost layer of a physical object or space. It is the portion or region of the object that can first be perceived by an observer using the senses of sight and touch, and is ...
,
hypersurface
In geometry, a hypersurface is a generalization of the concepts of hyperplane, plane curve, and surface. A hypersurface is a manifold or an algebraic variety of dimension , which is embedded in an ambient space of dimension , generally a Euclidea ...
, etc.).
Orientation of a curve is associated with
parametrization of its points by a real variable. A curve may have equivalent parametrizations when there is a
continuous
Continuity or continuous may refer to:
Mathematics
* Continuity (mathematics), the opposing concept to discreteness; common examples include
** Continuous probability distribution or random variable in probability and statistics
** Continuous ...
''increasing''
monotonic function
In mathematics, a monotonic function (or monotone function) is a function between ordered sets that preserves or reverses the given order. This concept first arose in calculus, and was later generalized to the more abstract setting of or ...
relating the parameter of one curve to the parameter of the other. When there is a ''decreasing'' continuous function relating the parameters, then the parametric representations are ''opposite'' and the orientation of the curve is reversed.
[ Chuan-Chih Hsiung (1981) ''A First Course in Differential Geometry'', page 84, ]John Wiley & Sons
John Wiley & Sons, Inc., commonly known as Wiley (), is an American Multinational corporation, multinational Publishing, publishing company that focuses on academic publishing and instructional materials. The company was founded in 1807 and pr ...
Orientation of a simple polygon
In two dimensions, given an ordered set of three or more connected vertices (points) (such as in
connect-the-dots) which forms a
simple polygon
In geometry, a simple polygon is a polygon that does not Intersection (Euclidean geometry), intersect itself and has no holes. That is, it is a Piecewise linear curve, piecewise-linear Jordan curve consisting of finitely many line segments. The ...
, the orientation of the resulting
polygon
In geometry, a polygon () is a plane figure made up of line segments connected to form a closed polygonal chain.
The segments of a closed polygonal chain are called its '' edges'' or ''sides''. The points where two edges meet are the polygon ...
is directly related to the
sign of the angle at any
vertex of the
convex hull
In geometry, the convex hull, convex envelope or convex closure of a shape is the smallest convex set that contains it. The convex hull may be defined either as the intersection of all convex sets containing a given subset of a Euclidean space, ...
of the polygon, for example, of the angle ABC in the picture. In computations, the sign of the smaller angle formed by a pair of vectors is typically determined by the sign of the
cross product
In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two vectors in a three-dimensional oriented Euclidean vector space (named here E), and ...
of the vectors. The latter one may be calculated as the sign of the
determinant
In mathematics, the determinant is a Scalar (mathematics), scalar-valued function (mathematics), function of the entries of a square matrix. The determinant of a matrix is commonly denoted , , or . Its value characterizes some properties of the ...
of their orientation matrix. In the particular case when the two vectors are defined by two
line segment
In geometry, a line segment is a part of a line (mathematics), straight line that is bounded by two distinct endpoints (its extreme points), and contains every Point (geometry), point on the line that is between its endpoints. It is a special c ...
s with common endpoint, such as the sides BA and BC of the angle ABC in our example, the orientation matrix may be defined as follows:
:
A formula for its determinant may be obtained, e.g., using the method of
cofactor expansion
In linear algebra, the Laplace expansion, named after Pierre-Simon Laplace, also called cofactor expansion, is an expression of the determinant of an -matrix as a weighted sum of minors, which are the determinants of some - submatrices of . Spe ...
:
:
If the determinant is negative, then the polygon is oriented clockwise. If the determinant is positive, the polygon is oriented counterclockwise. The determinant is non-zero if points A, B, and C are non-
collinear
In geometry, collinearity of a set of Point (geometry), points is the property of their lying on a single Line (geometry), line. A set of points with this property is said to be collinear (sometimes spelled as colinear). In greater generality, t ...
. In the above example, with points ordered A, B, C, etc., the determinant is negative, and therefore the polygon is clockwise.
Practical considerations
In practical applications, the following considerations are commonly taken into account.
One does not need to construct the convex hull of a polygon to find a suitable vertex. A common choice is the vertex of the polygon with the smallest X-coordinate. If there are several of them, the one with the smallest Y-coordinate is picked. It is guaranteed to be a vertex of the convex hull of the polygon. Alternatively, the vertex with the smallest Y-coordinate among the ones with the largest X-coordinates or the vertex with the smallest X-coordinate among the ones with the largest Y-coordinates (or any other of 8 "smallest, largest" X/Y combinations) will do as well. Once a vertex of the convex hull is chosen, one can then apply the formula using the previous and next vertices, even if those are not on the convex hull, as there can be no local concavity on this vertex.
If the orientation of a
convex polygon
In geometry, a convex polygon is a polygon that is the boundary of a convex set. This means that the line segment between two points of the polygon is contained in the union of the interior and the boundary of the polygon. In particular, it is ...
is sought, then, of course, any vertex may be picked.
For numerical reasons, the following equivalent formula for the determinant is commonly used:
:
The latter formula has four multiplications less. What is more important in computer computations involved in most practical applications, such as
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
or
CAD, the absolute values of the multipliers are usually smaller (e.g., when A, B, C are within the same
quadrant), thus giving a smaller
numerical error In software engineering and mathematics, numerical error is the error in Numerical computation, the numerical computations.
Types
It can be the combined effect of two kinds of error in a calculation.
The first is referred to as Round-off error and ...
or, in the extreme cases, avoiding the
arithmetic overflow
In computer programming, an integer overflow occurs when an arithmetic operation on integers attempts to create a numeric value that is outside of the range that can be represented with a given number of digits – either higher than the maximu ...
.
When it is not known in advance that the sequence of points defines a simple polygon, the following things must be kept in mind.
For a
self-intersecting polygon (
complex polygon
The term ''complex polygon'' can mean two different things:
* In geometry, a polygon in the unitary plane, which has two complex dimensions.
* In computer graphics, a polygon whose boundary is not simple.
Geometry
In geometry, a complex pol ...
) (or for any self-intersecting curve) there is no natural notion of the "interior", hence the orientation is not defined. At the same time, in
geometry
Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician w ...
and
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
there are a number of concepts to replace the notion of the "interior" for closed non-simple curves; see, e.g., "
flood fill" and "
winding number
In mathematics, the winding number or winding index of a closed curve in the plane (mathematics), plane around a given point (mathematics), point is an integer representing the total number of times that the curve travels counterclockwise aroun ...
".
In "mild" cases of self-intersection, with
degenerate vertices when three consecutive points are allowed be on the same
straight line
In geometry, a straight line, usually abbreviated line, is an infinitely long object with no width, depth, or curvature, an idealization of such physical objects as a straightedge, a taut string, or a ray of light. Lines are spaces of dimens ...
and form a zero-degree angle, the concept of "interior" still makes sense, but an extra care must be taken in selection of the tested angle. In the given example, imagine point A to lie on segment BC. In this situation the angle ABC and its determinant will be 0, hence useless. A solution is to test consecutive corners along the polygon (BCD, DEF,...) until a non-zero determinant is found (unless all points lie on the same
straight line
In geometry, a straight line, usually abbreviated line, is an infinitely long object with no width, depth, or curvature, an idealization of such physical objects as a straightedge, a taut string, or a ray of light. Lines are spaces of dimens ...
). (Notice that the points C, D, E are on the same line and form a 180-degree angle with zero determinant.)
Local concavity
Once the orientation of a polygon formed from an ordered set of vertices is known, the
concavity of a local region of the polygon can be determined using a second orientation matrix. This matrix is composed of three consecutive vertices which are being examined for concavity. For example, in the polygon pictured above, if we wanted to know whether the sequence of points F-G-H is
concave
Concave or concavity may refer to:
Science and technology
* Concave lens
* Concave mirror
Mathematics
* Concave function, the negative of a convex function
* Concave polygon
A simple polygon that is not convex is called concave, non-convex or ...
,
convex
Convex or convexity may refer to:
Science and technology
* Convex lens, in optics
Mathematics
* Convex set, containing the whole line segment that joins points
** Convex polygon, a polygon which encloses a convex set of points
** Convex polytop ...
, or collinear (flat), we construct the matrix
:
If the determinant of this matrix is 0, then the sequence is collinear - neither concave nor convex. If the determinant has the same sign as that of the orientation matrix for the entire polygon, then the sequence is convex. If the signs differ, then the sequence is concave. In this example, the polygon is negatively oriented, but the determinant for the points F-G-H is positive, and so the sequence F-G-H is concave.
The following table illustrates rules for determining whether a sequence of points is convex, concave, or flat:
See also
*
Differential geometry of curves
Differential geometry of curves is the branch of geometry that deals with smooth curves in the plane and the Euclidean space by methods of differential and integral calculus.
Many specific curves have been thoroughly investigated using the ...
*
Directed line segment
In geometry, a line segment is a part of a straight line that is bounded by two distinct endpoints (its extreme points), and contains every point on the line that is between its endpoints. It is a special case of an '' arc'', with zero curvatu ...
*
Orientability
In mathematics, orientability is a property of some topological spaces such as real vector spaces, Euclidean spaces, surfaces, and more generally manifolds that allows a consistent definition of "clockwise" and "anticlockwise". A space is o ...
*
Convex hull
In geometry, the convex hull, convex envelope or convex closure of a shape is the smallest convex set that contains it. The convex hull may be defined either as the intersection of all convex sets containing a given subset of a Euclidean space, ...
*
Signed arc length
References
External links
* http://www.math.hmc.edu/faculty/gu/curves_and_surfaces/curves/_topology.html {{Webarchive, url=https://web.archive.org/web/20041223152256/http://www.math.hmc.edu/faculty/gu/curves_and_surfaces/curves/_topology.html , date=2004-12-23 (page is not found on 2023.07.27)
Curve orientationat
MathWorld
''MathWorld'' is an online mathematics reference work, created and largely written by Eric W. Weisstein. It is sponsored by and licensed to Wolfram Research, Inc. and was partially funded by the National Science Foundation's National Science ...
Orientation
Orientation may refer to:
Positioning in physical space
* Map orientation, the relationship between directions on a map and compass directions
* Orientation (housing), the position of a building with respect to the sun, a concept in building des ...
Orientation (geometry)
Polygons