You are on page 1of 7

Project Report

NEWS READER APP FOR


ANDROID
Database Management System
(CSE2004)

Submitted To:
Prof. Gayathri R.
large number of devices in the form
Introduction:
of a “.csv” file.
Change, Change is the only
constant in the universe. And with
change, comes a need for Comparison with
development. In the currently
progressing world, the need for existing work:
development has increased
Such existing work has been
drastically, but the development
done only on mass scales, scales that
can’t be done without knowing the
of a city or even a country. In such a
need for it. To be Useful,
large scale, accuracy in analysis of
development has to properly
data becomes lesser important. But
targeted.
this project was based for inside a
campus, with relatively smaller
geographic divisions for building and
Abstract: hence accuracy is of much more
importance.
For targeted development, we
need trends and knowledge. For such Currently, to find if a user is in
purposes, theoretical predictions are given area or not, Nearest
not enough. We need user based Neighbor Approach is used, i.e. his
data. This project is not based on or her distance is calculated from a
getting the GPS locations of users, as fixed point. If the distance is in a pre-
enough work has been done about it defined range, the user is considered
already. This project here is based on to be in that particular area. Even in
how those co-ordinates can be used the best case scenario of the building
to study crowd behaviors based on being a square and the distance limit
those GPS locations collected from a
being the radius of its circumcircle,
Proposed
the amount of inaccuracy is very high.
But in case of a smaller scale, this Methodology:
method is not apt. Hence we need to
know if the given user is inside a Every building can be
building or not more precisely, hence considered into a polygon, not
we have to consider the exact necessarily regular, with n vertices.
dimensions and shape of that And every polygon can be divided
building. into (n-2) triangles.

This scenario is briefed in the Consider a building in the


example given: following shape with vertices A,B,C,D,
and F. Select any one co-ordinate. Let
it be A for instance. Join it with all
other vertices so that it forms
triangles.

For the building (yellow), the


conventional method will give both
point green and red inside the
building, as they both lie within a This way, the entire building is
particular distance from the centre of divided into triangles that cover the
the building. Whereas, we need only entire area of polygon and has no
the red point to be considered inside overlaps.
the building.
Mathematically,

Ar(ABCDEF)=Ar(ABC)+Ar(ACD)
+Ar(ADE)+Ar(AEF)

(Equation 1) From Equation 1 & Equation 2,

When we want to check if Using the property of transitive


there is a user is inside the building or equality,
not. Consider the following point X.
Ar(ABC)+Ar(ACD)+Ar(ADE)+Ar(AEF)=

Ar(ABX)+Ar(BCX)+Ar(CDX)+Ar(DEX)+

Ar(EFX)+Ar(AFX)

(Equation 3)

Using the basic this project, w have


the co-ordinates of all the points, and
since it is all broken down to
triangles, we can calculate the area
using the single mathematical
formula:

Ar(ABC)=0.5*{[Ax * (By - Cy)]+


As if visible, the point X lies inside the [Bx * (Cy - Ay)] +
building ABCDEF. If we join X with all
the vertices of the building, it will [Cx * (Ay - By)]}
create triangles. Again, the triangles
cover the entire polygon without any
kind of overlapping. If and only if, Equation 3 holds
true, the point X lies inside the
So Mathematically: polygon ABCDEF.
Ar(ABCDEF)=Ar(ABX)+Ar(BCX)+ Furthermore, after studying
Ar(CDX)+Ar(DEX)+ the algorithm on various example, it
was found that this particular method
Ar(EFX)+Ar(AFX) of breaking down the polygon into
(Equation 2) triangles doesn’t work on all the
buildings, some very specific and some other manual method, but
extremely low probable concave incorporating such method into the
structures. program will make it inefficient.

So the alternate for this is again a simple


mathematical concept of co-ordinate
Consider the following building:
geometry, i.e. Position of point(x1,y1)
relative to line(Ax+By+C=0).

If (A(x1)+B(y1)+C)(C)>0

The point (x1,y1) will lie on the same side of


the line as the origin.

This building when tried to be broken


into triangles, taking point A as
reference, forms shown triangles. Bit
in doing so, in triangle ADE, the red
area is not actually a part of the
polygon. Also the area in blue is
covered twice, once by triangle ACD In the given scenario,(A(x1)+B(y1)+C)(C) will be
and then again by triangle ADE. positive, whereas, (A(x2)+B(y2)+C)(C) will be
negative. While entering the data about a
So this violates Equation 1. building, preference can be saved for each
Although, the basic concept would edge, whether the required calculation for that
still be valid if we break the polygon particular line is positive or negative for that
into non-overlapping triangles using particular building.
If a point satisfies this condition for
all the edges of a given building, the point Building Blue Orange Red Green Blank
can be considered to be inside the
Experiment Points in Building
building.
1-Polygon 2367 755 1217 312 5349
It is worth noting that this method is
1-N.Neighbour 3794 2179 2192 1277 558
applicable on all buildings, but is less
efficient than the first method. Hence it is 2-Polygon 2371 778 1176 303 5372

not being used in the whole program. So 2-N.Neighbour 3816 2198 2152 1296 538
wherever possible, the use of first
3-Polygon 2335 776 1243 288 5358
technique should be preferred.
3-N. Neighbour 3801 2267 2181 1240 511

Efficiency Comparison: Avg(Polygon) 2357.6 769.6 1212 301 5359.6

Avg(Neighbour) 3803.6 2214.6 2175 1271 535.6


Consider a very basic geographic
setup as follows: Difference 1446 1445 963 970 4824

Error %age 38.02 65.26 44.27 76.31 90.00

(Points in building)

6000
5000 Polygon Area
4000
3000
2000 Nearest Neighour
1000
0
Difference

If we generate 100,000 r andom pair


of co-ordinates, and use both the
Avg error in previously used
algorithms, i.e. the nearest neighbour
methods = 62.77 %
and polygon area, to find in which
building does the point lie in, we get the Hence we can say that this method
results as follows: gives us high precision. Only
imprecision lie in the co-ordinates of
the buildings but that too are
negligible and can’t be taken
precisely enough for perfection.

You might also like