Closed esabol closed 7 months ago
spoint = spoint
does exist, but what this message means is that we'd need a spoint btree or hash opclass. I'll cook something up.
Would it similarly make sense to add hash opclasses for the other pgsphere types (strans, scircle, spoly)? Probably not as useful as spoint, but for the sake of completeness?
It's (sort of) easy for the types that have canonical representations. scircle is doable, but spoly would need sorting the nodes, and I hear there's open issues with left- and right-handed spolys.
That said, there's a possible minor problem even with spoints: the dreaded "signed zeros" might cause "equal" spoints to have representations differing in the sign. But that only applies to spoints where one coordinate is exactly zero, no idea how likely that is in practise. We might also force all zeros to be +0
either in spoint_hash32 or in spoint_in.
Which types would you be interested in?
On Fri, Nov 03, 2023 at 12:25:40PM -0700, Christoph Berg wrote:
representations differing in the sign. But that only applies to spoints where one coordinate is exactly zero, no idea how likely that is in practise. We might also force all zeros to be
+0
Regrettably, exactly zero happens a lot more often than one would expect – not because nature had some unnatural preference, but because points on coordinate axes are perennial favourites for tests, artificial data, and the lot. And that's not exclusively lazyness, since often it's a lot easier to figure out results manually when you are on an axis.
So, if there's odd behaviour on the axes, that's probably harmless for physics but potentially hazardous for development.
@df7cb asked:
Which types would you be interested in?
Hard to say. I could see using an scircle hash opclass.
I wonder if the error in issue #93 would be helped if there was a hash opclass for strans?
Also, I'm ok with forcing all zeroes to be +0 in the spoint hash function if that "solves" any problems you foresee.
I think this is a reasonable thing to do?
Should equality operators for the pgsphere types be added?