Computational

Geometry

Introduction:

Computational geometry is branch of

software engineering, examines calculations for taking care of geometric issue.

In present day Mathematics, Computational graphs has likewise utilized as a part of PC computer

graphics, robotics, VLSI design, computer-aided

design, molecular modeling, metallurgy, manufacturing, textile layout,

forestry, and statistics.

Here, we studies few computational-geometry

algorithms in 2-D, representing each input object by a set of points {p1, p2, p3…}, where each pi = (xi, yi )and xi , yi € R.

Computational geometry can also apply to 3-D and even higher-dimensional spaces

such as 4-D and 5-D,but such problems and their solutions can be very difficult

to visualize.

Line-Segment

Properties:

A convex

combination of two distinct points p1=(x1, y1) and p2 =(x2, y2) is any

point p3 =(x3, y3) such

that for some ? in the range 0 <=?<=1, we have x3 = ?x1 + (1- ?) x2 and y3 = ?y1 + (1- ?) y2. We also write that p3 =
?P1 + (1- ?) P2.
P3 is any point that is on the line passing through p1 and p2 and
between p1 and p2 on the
line. Given two distinct points p1 and p2, the line segment p1p2 is the set of convex combinations of p1 and p2. We
call p1 and p2 the endpoints of segment p1p2.There are some properties of
line segment.
1.
Given two directed
segments p0p1 and p0p2, is p0p1 clockwise from p0p2
with respect to their common endpoint p0?
2.
Given two line segments p0p1 and p1p2, if we
traverse p0p1 and then p1p2,
do we make a left turn at point p1 ?
3.
Do line segments p1p2 and
p3p4 intersect?
Our
methods use only additions, subtractions, multiplications, and comparisons.
Because they are not computationally expensive. We use neither division nor
trigonometric functions, both of which can be computationally expensive and
with round-off error.
Picture ( a)
shows that The cross product of vectors p1 and p2 is the shaded area of the parallelogram
Picture (b) shows that The
lightly shaded region contains vectors that are clockwise from p. and
The darkly shaded region contains vectors that are
counterclockwise from p.
Cross
Product:
The cross item is a 3-D idea. According to
the "right-hand rule" , a vector that is orthogonal to both p1 and p2 and whose magnitude is .
Processing cross items lies at the core of
our line-segment methods. Consider
vectors p1 and p2 as
shown above in Picture(a). We can interpret the cross
product
p1 p2 as the signed area of the parallelogram
formed by the points (0,0), p1 , p2,
and p1 + p2 = (x1+x2, y1 + y2) .An equivalent, but more
useful, definition gives
the cross product as the determinant of a matrix:
p1 is clockwise from p2 with respect to the origin (0,0), If p1 p2 is positive. p1 is
counterclockwise from p2 if Cross Product result is negative.
And Picture (b) above demonstrates the
clockwise and counterclockwise areas in respect to a vector. If the cross item is 0, limit condition emerges; in this case,
the two vectors are collinear, either pointing in similar directions or Inverse
directions.
To determine whether a directed segment p0p1 is closer to a directed
segment p0p2 to their common endpoint p0 in a
clockwise direction or in a counterclockwise direction, That is, we define
p1-p0 denote the vector
and
And we define p2-p0 similarly.
In the above
example here check that the given line-Segments are clockwise or anti
clockwise. if clockwise, make right turn and if anticlockwise make left turn.
If cross product
is positive then it is clockwise otherwise anticlockwise.
Determining whether consecutive segments
turn left or right:
Here question arise whether it turns right or left. We
compute the cross product, if the cross product is negative then it is
anticlockwise and make a left turn. And if cross product is positive then clockwise
and make a right turn. If a cross product is 0 it means that points p0, p1 , and p2 are collinear.
Determining whether two
line segments intersect:
If two line-segments intersect, we check whether each segment
straddles the line containing the other. A segment p1 p2 straddles a line
if point p1 lies on one side of the line and point p2 lies on the other
side. A boundary case is if p1 or p2 lies directly on the line. Two line segments intersect if and
only if these conditions holds:
1. Each segment straddles the line containing the other.
2. Boundary Case condition: An endpoint of one segment lies on the other
segment.
There implements an algorithm called SEGMENTS-INTERSECT return
TRUE if segments p1 p2 and p3p4 intersect and if they do not return FALSE.
It calls the subroutines DIRECTION,
which perform relative orientations using the cross-product, and ON-S EGMENT, which determines whether a point is collinear
with a segment lies on that segment.
Other applications of
cross product:
Here introduce additional uses for cross products:
·
Sort the set of point with
respect to their polar angles.
·
Comprising in sorting.
·
Use red-black trees to maintain
the vertical ordering of a set of line-segments.
·
Two segments that intersect a
given vertical line