Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added calculation of the distance between a line and a point#40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vitcpp merged 1 commit intopostgrespro:masterfromDarya177777:master
Aug 11, 2023

Conversation

Darya177777
Copy link
Contributor

No description provided.

@esabol
Copy link
Contributor

esabol commentedAug 2, 2023
edited
Loading

@Darya177777 : CI tests failed. Make sure your fork is sync'ed with this repo. You might need to just update the line numbers in some expected output files?

@Darya177777
Copy link
ContributorAuthor

Darya177777 commentedAug 4, 2023
edited
Loading

@esabol ,@vitcpp : All tests fixed. Please, re-review.

Copy link
Contributor

@esabolesabol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you for this! Looks pretty good to me. Just some minor changes, I think.

@@ -331,7 +331,7 @@
a non-boolean operator returning the distance between two
objects in radians. Currently,
<application>pgSphere</application> supports only distances
between points, circles, and between point andcircle. If the
between points, circles,between pointandcircle, andbetween point andline. If the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Does this line exceed 79 characters? If so, please word-wrap.

IMMUTABLE STRICT;

COMMENT ON FUNCTION dist(sline, spoint) IS
'distance between spherical line and spherical point';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

All the other COMMENT ON FUNCTIONs in this file start with "returns..." I know that seems redundant, but I think it's best to fit in with the convention of the other COMMENTs.

@@ -134,4 +134,34 @@ SELECT sline ( spoint '(0, 0d)', spoint '(0.000001d, 0d)' ) #
f
(1 row)


-- checking the distance between a line and a point
SELECT round( CAST(sline '( 90d, 0d, 0d, XYZ ), 40d ' <-> spoint '( 0d, 90d )' as numeric), 14);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What about the distance between a point and a line? I.e., the commutative property. Is that implemented? If not, it should be. If it is, then it should be tested.

SELECT round( CAST(spoint '( 0d, 90d )' <-> sline '( 90d, 0d, 0d, XYZ ), 40d ' as numeric), 14);

@Darya177777
Copy link
ContributorAuthor

All fixed.

@esabol
Copy link
Contributor

All fixed.

OK, looking better!@vitcpp will probably have some comments as well.

@vitcpp
Copy link
Contributor

@Darya177777 Could you also please rebase on the newest version and update the upgrade script upgrade_scripts/pg_sphere--1.2.3--1.3.0.sql.in. Such script is used when updating the extension to a newer version using ALTER EXTENSION UPDATE TO command. Once you have introduced a new function the upgrade script should be updated.

src/line.c Outdated

vector3d_spoint(&fp, &v_beg);
vector3d_spoint(&sp, &v_end);
if (FPle(spoint_dist(p, &fp), spoint_dist(p, &sp)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would propose to this code faster like this:
fpdist = spoint_dist(p, &fp);
spdist = spoint_dist(p, &sp);
return Min(fpdist, spdist);

esabol reacted with thumbs up emoji
src/line.c Outdated
Datum
sphereline_point_distance(PG_FUNCTION_ARGS)
{
SLine *s = (SLine *) PG_GETARG_POINTER(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would propose to add const prefix in local variable declarations.

esabol reacted with thumbs up emoji
src/line.c Outdated
Datum
sphereline_point_distance_com(PG_FUNCTION_ARGS)
{
SPoint *p = (SPoint *) PG_GETARG_POINTER(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would propose to add const prefix in local variable declarations.

esabol reacted with thumbs up emoji
0.87266462599717
(1 row)

SELECT round( CAST(sline '( 90d, 0d, 0d, XYZ ), 40d ' <-> spoint '( 0d, 90d )' as numeric), 14) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think round(CAST... is not necessary.
I would propose to add SET extra_float_digits TO -3; in the beginning of file. It reduces the number of output digits.

I've attached the modified line.sql
line.sql.zip

esabol reacted with thumbs up emoji
@vitcpp
Copy link
Contributor

vitcpp commentedAug 7, 2023
edited
Loading

@Darya177777 Please, ignore this comment. It seems I was wrong when claimed these cases to be wrong.

@Darya177777 I've found one case when a distance seems to be wrong:
image
image
Could you please check it?

@vitcpp
Copy link
Contributor

@Darya177777 Could you please squash two commits into one.

@@ -0,0 +1,227 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This file is generated. It should not be added in the commit. Could you please remove it?

@@ -0,0 +1,272 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This file should be removed from the commit.

doc/x20.html Outdated
@@ -0,0 +1,243 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

doc/x46.html Outdated
@@ -0,0 +1,423 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

@@ -0,0 +1,37 @@
SET client_min_messages TO NOTICE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

@@ -0,0 +1,37 @@
Running in no-clean mode. Mistakes will not be cleaned up.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

@@ -0,0 +1,376 @@
2023-08-08 15:16:01.222 +07 postmaster[14615] LOG: starting PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

logfile Outdated
@@ -0,0 +1,749 @@
2023-08-08 14:58:03.794 +07 [12364] LOG: starting PostgreSQL 15.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove this file from the commit.

@Darya177777Darya177777force-pushed themaster branch 2 times, most recently fromf44e926 tof62c70fCompareAugust 8, 2023 10:07
@vitcpp
Copy link
Contributor

PR seems to be ok. I need to do some testing before merge.

@esabol
Copy link
Contributor

@Darya177777 Could you please squash two commits into one.

@vitcpp, doesn't GitHub automatically squash commits on merge these days? I've been under the impression that it does, but maybe I'm used to GitLab.

@vitcpp
Copy link
Contributor

@esabol I'm not sure about github feature to squash commits. I will check it. I'm concerned which final comment will appear in commit after squashing. I'm not sure that simple joining of commit messages is a good idea. Furthermore, it is harder to review multiple commits where latest commit overwrites some changes of the previous commit. PR should contain the final version of the changes. It can contain multiple commits but these commits should be used to logically separate the changes. They should not touch the same code.

@vitcpp
Copy link
Contributor

@Darya177777 Could you please fix the tests? Thank you.

src/sscan.c Outdated
@@ -1,6 +1,6 @@
#line 2 "sscan.c"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This file is generated. It should be removed from the commit.

@Darya177777Darya177777force-pushed themaster branch 2 times, most recently fromd201938 to337928eCompareAugust 10, 2023 14:40
@vitcpp
Copy link
Contributor

@Darya177777 You have added sscan.c file to the commit. It shouldn't be added. Could you please remove it from the commit.

@Darya177777
Copy link
ContributorAuthor

@vitcpp , All fixed

@esabol
Copy link
Contributor

@esabol I'm not sure about github feature to squash commits. I will check it. I'm concerned which final comment will appear in commit after squashing. I'm not sure that simple joining of commit messages is a good idea. Furthermore, it is harder to review multiple commits where latest commit overwrites some changes of the previous commit. PR should contain the final version of the changes. It can contain multiple commits but these commits should be used to logically separate the changes. They should not touch the same code.

@vitcpp, you can edit the merge commit message to whatever you want when squashing and merging, according to this:https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits

@vitcpp
Copy link
Contributor

@vitcpp, you can edit the merge commit message to whatever you want when squashing and merging, according to this:https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits

@esabol Thank you very much! I will take a look.

@vitcppvitcpp requested a review fromesabolAugust 11, 2023 05:50
Copy link
Contributor

@vitcppvitcpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@Darya177777 It seems we missed to make some changes in pg_sphere--1.2.3--1.3.0.sql.in. This script is used to upgrate pgsphere versions in the existing database. Just copy the contents of pgs_line.sql.in into this file.

@Darya177777
Copy link
ContributorAuthor

@vitcpp I have made some changes in pg_sphere--1.2.3--1.3.0.sql.in. Please, re-review.

Copy link
Contributor

@esabolesabol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me.

@vitcppvitcpp mentioned this pull requestAug 11, 2023
@vitcppvitcpp merged commit4fafc35 intopostgrespro:masterAug 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vitcppvitcppvitcpp approved these changes

@esabolesabolesabol approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Darya177777@esabol@vitcpp

[8]ページ先頭

©2009-2025 Movatter.jp