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

Add spoly_is_convex#43

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:masterfromggnmstr:poly_convex
Aug 12, 2023
Merged

Conversation

ggnmstr
Copy link
Contributor

Adds function to determine whether the spoly is convex.
Algorithm based on
https://mathoverflow.net/questions/193569/determining-orientation-of-spherical-polygons

@ggnmstrggnmstrforce-pushed thepoly_convex branch 2 times, most recently fromd89edcf toa0be9d3CompareAugust 3, 2023 09:40
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.

In general everything is ok except of some trivial issues.

ggnmstr reacted with thumbs up emoji
@vitcpp
Copy link
Contributor

vitcpp commentedAug 3, 2023
edited
Loading

@ggnmstr thank you for the PR. I think everything is ok except of some trivial issues. The tests should be fixed - could you please try to run tests without healpix:

  • gmake USE_HEALPIX=0 install
  • gmake USE_HEALPIX=0 test

I would also ask to start the commit comment from capital lettet as it was done for other commits.

ggnmstr and esabol reacted with thumbs up emoji

@ggnmstrggnmstrforce-pushed thepoly_convex branch 3 times, most recently fromb61c748 to5d264e6CompareAugust 4, 2023 03:59
@dura0ok
Copy link

dura0ok commentedAug 4, 2023
edited
Loading

fix_tests.patch
Please@ggnmstr rename it to .patch extension and apply it! This fix your tests!!

@ggnmstr
Copy link
ContributorAuthor

@stepan-neretin7 Thank you, it works, seems like there's a problem with healpix on my computer.

@ggnmstrggnmstr requested a review fromvitcppAugust 4, 2023 05:49
@dura0ok
Copy link

@ggnmstr please, start commit with capital letter

@esabol
Copy link
Contributor

@stepan-neretin7 wrote:

@ggnmstr please, start commit with capital letter

Do you mean the title of the pull request,@stepan-neretin7 ? The one commit message athttps://github.com/postgrespro/pgsphere/pull/43/commits does start with a capital letter.

@dura0ok
Copy link

@stepan-neretin7 wrote:

@ggnmstr please, start commit with capital letter

Do you mean the title of the pull request,@stepan-neretin7 ? The one commit message athttps://github.com/postgrespro/pgsphere/pull/43/commits does start with a capital letter.

Yes, I think it's a good idea. I also suggest that you also specify the issue number in the comment, so that he automatically linked it to the desired issue even before the merge.

@ggnmstrggnmstr changed the titleadd spoly_is_convexAdd spoly_is_convexAug 5, 2023
@vitcpp
Copy link
Contributor

@ggnmstr There are some conflicts. Could you please do rebase on the newest version and fix the conflicts?

@esabol
Copy link
Contributor

esabol commentedAug 5, 2023
edited
Loading

@ggnmstr: CI failures. Please check and fix "make test" results.

https://app.travis-ci.com/github/postgrespro/pgsphere/jobs/607409643

@ggnmstrggnmstrforce-pushed thepoly_convex branch 3 times, most recently from544f4f6 to4570340CompareAugust 6, 2023 04:32
psql:pg_sphere.test.sql:8594: NOTICE: argument type pointkey is only a shell
psql:pg_sphere.test.sql:8600: NOTICE: argument type pointkey is only a shell
psql:pg_sphere.test.sql:9167: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9173: NOTICE: argument type smoc is only a shell
Copy link
Contributor

Choose a reason for hiding this comment

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

Add linefeed to the end of this file.

psql:pg_sphere.test.sql:9181: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9187: NOTICE: argument type smoc is only a shell
psql:pg_sphere.test.sql:9167: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9173: NOTICE: argument type smoc is only a shell
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a linefeed to the end of this file.

@ggnmstrggnmstrforce-pushed thepoly_convex branch 5 times, most recently from2620fa7 toa35e842CompareAugust 6, 2023 07:22
psql:pg_sphere.test.sql:9181: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9187: NOTICE: argument type smoc is only a shell
psql:pg_sphere.test.sql:9167: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9173: NOTICE: argument type smoc is only a shell
Copy link
Contributor

Choose a reason for hiding this comment

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

You are almost there! Change "9167" to "9195" on line 1. Change "9173" to "9201" on line 2.

ggnmstr reacted with thumbs up emoji
esabol

This comment was marked as outdated.

@vitcpp
Copy link
Contributor

To finalize PR the following changes are required:

  • Update pg_sphere--1.2.3--1.3.0.sql. Add command to create the implemented function.
  • Add new function description into Functions -> spoly functions section of the User Manual (gmake pdf).
ggnmstr and esabol reacted with thumbs up emoji

@ggnmstr
Copy link
ContributorAuthor

@stepan-neretin7, this "return null" behavior is common among all functions, I don't think it is possible to change something just in place.

@dura0ok
Copy link

@stepan-neretin7, this "return null" behavior is common among all functions, I don't think it is possible to change something just in place.

but in your code you return false.. Very strange for me..

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.

A couple more minor tweaks, please,@ggnmstr. Thank you!

src/polygon.c Outdated
wsv,
crs;
float8cur = 0,
prev = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the variables on lines 1487-1493 line up vertically for you? They don't line up vertically in the diff output here on GitHub.com.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, they do.

esabol reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

The default tab size on github is 8. It can be changes to 4 in Profile -> Settings -> Appearance -> Tab size... Not sure, how to change it for a specific repository and specific file type.

I changed it. For me it looks like this:

image

src/polygon.h Outdated
/*
* Checks whether a polygon is convex
*/
Datum spherepoly_is_convex(PG_FUNCTION_ARGS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add spaces afterDatum so thatspherepoly_is_convex lines up vertically with the names of the functions above this.

ggnmstr reacted with thumbs up emoji
Spoly is convex
</title>
<para>
Returns true if the specified spherical polygon is convex. Returns false otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this line longer than 79 characters? I can't tell looking at it in the web browser here. If it is, please word-wrap it.

ggnmstr reacted with thumbs up emoji
@ggnmstrggnmstrforce-pushed thepoly_convex branch 3 times, most recently fromff10fe4 toe740d2cCompareAugust 8, 2023 06:04
@vitcpp
Copy link
Contributor

SELECT spoly_is_convex(NULL);

spoly_is_convex
(1 row)

why you return null? is this correct for interface?

I agree, it should return false. The third value is unnecessary. To fix it STRICT keyword should be removed in CREATE FUNCTION command. I also propose to update the tests by adding this case.

ggnmstr and esabol reacted with thumbs up emoji

@ggnmstr
Copy link
ContributorAuthor

@vitcpp. I fixed it and added a test, thanks for the information.

esabol reacted with thumbs up emoji

@dura0ok
Copy link

dura0ok commentedAug 8, 2023
edited
Loading

for (int i = 0; i < poly->npts; i++)
please move the variable initialization to the top of the function
@ggnmstr

ggnmstr reacted with thumbs up emoji

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.

spherepoly_is_convex() functions seems to be ok as the first working version, but the code is not optimized. There are duplicate calculations in the for loop that can slowdown the performance.

esabol reacted with thumbs up emoji
@vitcpp
Copy link
Contributor

There are some conflicts that should be resolved.@ggnmstr Could you please rebase your branch to the latest postgrespro/pgsphere version and fix conflicts?

@ggnmstr
Copy link
ContributorAuthor

spherepoly_is_convex() functions seems to be ok as the first working version, but the code is not optimized. There are duplicate calculations in the for loop that can slowdown the performance.

Yes, I agree with that. I think I'll optimize it a bit later.

esabol reacted with thumbs up emoji

@@ -28,6 +28,7 @@ COMMENT ON FUNCTION spoly_deg(float8[]) IS
refer to the same occurrence and cover its
latitude and longitude, respectively.';

<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the line

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.

Still need to getmake test working.

@@ -33,3 +33,4 @@ psql:pg_sphere.test.sql:8622: NOTICE: argument type pointkey is only a shell
psql:pg_sphere.test.sql:8628: NOTICE: argument type pointkey is only a shell
psql:pg_sphere.test.sql:8634: NOTICE: argument type pointkey is only a shell
psql:pg_sphere.test.sql:8640: NOTICE: argument type pointkey is only a shell

Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add this blank line? I think it should be removed.

Take a look at the diff output at the bottom of the log here:
https://app.travis-ci.com/github/postgrespro/pgsphere/jobs/607714835

You need to change the line numbers in this file to match the results so that there are no differences.

@@ -1,2 +1,3 @@
psql:pg_sphere.test.sql:9207: NOTICE: return type smoc is only a shell
psql:pg_sphere.test.sql:9213: NOTICE: argument type smoc is only a shell

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 blank line. In this file, change "9207" to "9221" and change "9213" to "9227".

@ggnmstrggnmstrforce-pushed thepoly_convex branch 2 times, most recently from006ad50 toe642169CompareAugust 11, 2023 15:35
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! Thank you for your contribution and perseverance,@ggnmstr!

@vitcpp
Copy link
Contributor

@ggnmstr Thank you for your contribution. I plan to merge PR#40 first, your PR will be the next. I guess, new differences may appear - one more iteration may be required to fix the tests. It seems to be a problem of init_test that should be redesigned in the future.

@vitcpp
Copy link
Contributor

@ggnmstr Could you please do one more iteration - re-sync your branch with this repo, resolve conflicts and force-push your changes? Your PR will be the next. Thank you in advance!

ggnmstr reacted with thumbs up emoji

@ggnmstr
Copy link
ContributorAuthor

ggnmstr commentedAug 12, 2023
edited
Loading

@vitcpp, Ok, I did it. The tests are OK, I guess, I just realized that I was typing "HEAPLIX" all the time and then wondering why is it not working on my PC

esabol reacted with thumbs up emoji

@vitcpp
Copy link
Contributor

@ggnmstr Thank you very much!

ggnmstr reacted with thumbs up emoji

@vitcppvitcpp merged commit6720f3a intopostgrespro:masterAug 12, 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.

4 participants
@ggnmstr@vitcpp@dura0ok@esabol

[8]ページ先頭

©2009-2025 Movatter.jp