## Forum Stats

• 3,838,757 Users
• 2,262,398 Discussions

Discussions

# How to find the angle between two required vertices in a poly line in plsql

Member Posts: 1
edited May 13, 2013 10:08AM
Here my requirement is to get the angle between two x,y coordinates where they are from a poly line.
Pictorial representation is shown for better understanding

(x2,y2) ..................................... (x3,y3)
.
.
.
.
.
.
.
.
.
.
.
.
(x1,y1)

I want to find angle between (x2,y2) and (x3,y3) or (x1,y1) and (x2,y2). Can you please help me in writing a query to find angle between two vertices of a poly line.

Tagged:

• Member, Moderator Posts: 42,132 Red Diamond
Isn't that just some standard mathematics?
• Member Posts: 3,517 Bronze Crown
```with points as (
select 1 p, 0 x, 1 y from dual union all
select 2 p, 1 x, 1 y from dual union all
select 3 p, 3 x, 3 y from dual
)

select
(180/(asin(1)*2))*
acos(
(p1.x*p2.x+p1.y*p2.y)
/(sqrt( (power(p1.x,2)+power(p1.y,2)))
*sqrt ((power(p2.x,2)+power(p2.y,2))))
)
angle
from
points p1
,points p2
where
p1.p=1 and p2.p=2

ANGLE
"45,00000000000000000000000000000057478745"```
• Member Posts: 9,987 Gold Crown
my requirement is to get the angle between two x,y coordinates
There is no angle between just two coordinates B-)
• Member, Moderator Posts: 42,132 Red Diamond
InoL wrote:
my requirement is to get the angle between two x,y coordinates
There is no angle between just two coordinates B-)
There is if you take the angle against the X or Y axis. B-)
This discussion has been closed.