Programmatic representation of a point at infinity along a line segment.

73 Views Asked by At

I am implementing an algorithm to find the kernel of a simple Polygon as given in the paper- "An Optimal Algorithm for Finding the Kernel of a Polygon" by Lee and Preparata. The algorithm describes half-lines as edges along a line segment(edge of the polygon) originating or terminating at a vertex of this line segment(edge of the polygon). Can someone guide me on how this can be represented in a program?

For example, if v0e1v1 is an edge of the polygon from vertex v0 to v1, (^e1v0) is the half-line that is along e1 and terminates at v0.(extends infinitely in one direction)

1

There are 1 best solutions below

4
On BEST ANSWER

There are a few options. The title asks for representing a point at infinity; the standard answer is homogenous coördinates. Finite points embed nicely, so you can have a uniform representation for any line or line segment. There is a slight complication in that opposite directions are normally identified, but with a bit of care you can quotient with only positive scalars without any real problem. One downside is managing the scale factor so that numerics don't bite you. Another is that any code collaborators will likely be unfamiliar with not only projective geometry, but this variant with only positive scalars.

But for representing the ray, you don't necessarily need the point at infinity on it -- point plus direction suffices. Indeed the point at infinity is just a way of encoding direction, though it erases the sign of the ray. Just recording the angle directly is fine, and you needn't then bring in a projective geometry approach. But nice coördinate differences and nice angles aren't typically the same.

Another clean representation is just recording point 0 and point 1, and that point 0 is an end point and point 1 is not. You can have three different types for the lines, rays, and segments, or two flags recording whether the line terminates at that point or not.

Each of these will let you do standard calculations fairly straightforwardly, but with slightly different nuances.

I would recommend the third; it puts off calculations, and hence numerical issues the longest. Different types is more likely to force handling all appropriate cases, though this will vary depending on your programming environment.