[postgis-devel] ForceRHR doesn't?
Michael Fuhr
mike at fuhr.org
Sat Mar 11 23:12:10 PST 2006
On Sat, Mar 11, 2006 at 09:58:10PM -0800, Paul Ramsey wrote:
> It is not clear that there is a function that actually enforces RHR
> in lwgeom... I know there is supposed to be one in GEOS, but I don't
> see it getting called anywhere.
lwpoly_forceRHR() in lwpoly.c looks like it's trying to return a
RHR polygon, doesn't it? That function isn't called from anywhere;
that's what I made lwgeom_forceRHR() call in lieu of lwpoly_reverse().
I'm still wondering if the ptarray_isccw() function that lwpoly_forceRHR()
calls has its return values backwards.
Given a properly working ForceRHR(), you could enforce RHR on a
column with a constraint like the following, no?
ALTER TABLE foo ADD CONSTRAINT geom_rhr CHECK (geom ~= ForceRHR(geom));
Alternatively, you could write a trigger to silently convert the
column to RHR during inserts and updates.
--
Michael Fuhr
More information about the postgis-devel
mailing list