How to implement the st_angle function #308
Replies: 2 comments 2 replies
-
It looks like we convert the 3 points to lat/lon, then compute the bearing
using this
<https://web.archive.org/web/20200416084231/http://mathforum.org/library/drmath/view/55417.html>
algorithm.
The angle is then the difference in the bearing between point2->point3 and
point2->point1
…On Wed, Mar 29, 2023 at 3:35 AM Liqf ***@***.***> wrote:
I want to achieve the same function as the st function in bigquery:
https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_angle
I tried a lot of ways but didn't get the correct result:
const GeoPoint* point1 = (const GeoPoint*)p1; const GeoPoint* point2 =
(const GeoPoint*)p2; const GeoPoint* point3 = (const GeoPoint*)p3; S2Point
normal1 = point2->CrossProd((S2Point&)point1); S2Point normal2 =
point2->CrossProd((S2Point&)point3); *angle = normal1.Angle(normal2);
I want to ask how can I change it
—
Reply to this email directly, view it on GitHub
<#308>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGEMKT7ACCPGA5BPWHOSNDW6P65BANCNFSM6AAAAAAWLWRRMQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Sorry I wasn't clear, say you have a function Bearing written with that
algorithm, then ST_Angle(point1, point2, point3) = Bearing(point2, point3)
- Bearing(point2, point1).
…On Thu, Mar 30, 2023 at 12:22 AM Liqf ***@***.***> wrote:
point2->point1 is point2->operator-((S2Point&)point1); right?
—
Reply to this email directly, view it on GitHub
<#308 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGEMKTN3O7RPA5PRUOAUULW6URCNANCNFSM6AAAAAAWLWRRMQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to achieve the same function as the st_angle function in bigquery:
https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_angle
I tried a lot of ways but didn't get the correct result:
`
`
I want to ask how can I change it Or how can I achieve this function
Beta Was this translation helpful? Give feedback.
All reactions