This function tests points for being inside the 2-transition surface associated with a zonohedron.
inside2trans( x, p )
inside2trans()
returns a data.frame
with N rows and these columns:
the given point
the distance from the point to the surface.
This is the true Euclidean distance,
and not a "pseudo-distance" as in the case of inside()
.
If the point is on the surface, the distance
should be 0
up to numerical precision.
the linking number of the point and the surface.
If the point is on the surface (distance==0
),
the (mathematical) linking number is undefined,
and the computed linkingnumber
is NA
(integer).
whether the point is inside the surface; a logical.
This is currently set to linkingnumber != 0
.
If the linkingnumber
is NA
(integer),
then inside
is NA
(logical).
the time to do the calculations, in seconds
If the row names of p
are unique,
they are copied to the row names of the output.
In case of error, the function returns NULL
.
a zonohedron object
an Nx3 numeric matrix. The points to be tested are in the rows.
p
can also be a numeric vector that can be converted
to such a matrix, by row.
If the surface has no self-intersections,
the the definition of whether a point p
is
"inside" is fairly straightforward:
it is where the linking number of
p
and the surface is non-zero.
In fact, if it is non-zero then it must be +1 or -1.
The linking number is analogous the winding number
in 2D, for more discussion see Note.
Unfortunately, there is currently no test for whether the surface has self-intersections, For a bad surface with self-intersections, the linking number might be any integer. Since there is no such test, we simply use the same non-zero linking number rule always.
The computed linkingnumber
is returned so that the user
can apply the non-zero rule, or the even-odd rule,
as appropriate for their situation.
These 2 rules are analogous to the two winding number rules
used for polygons in computer graphics,
see Point in polygon.
The case where a point is on the surface
(i.e. the distance
to the surface is 0) is problematic.
The linkingnumber
is then undefined,
and we currently set inside
to be undefined as well.
Thus inside
should be interpreted as strictly inside.
However, in some situations, the user may want to consider
inside
to be TRUE
in this problematic case.
Or the user may want to consider points that are within
a very small epsilon of the surface,
where roundoff might have occurred, to have inside=FALSE
or inside=NA
.
So the both the computed linkingnumber
and distance
are
returned so the user can use them
to make their own definition of what "inside" means.
Guillemin, Victor and Alan Pollack. Differential Topology. Prentice-Hall. 1974.
Point in polygon --- Wikipedia, The Free Encyclopedia. https://en.wikipedia.org/w/index.php?title=Point_in_polygon&oldid=1139808558. 2023.
Spivak, Michael. A Comprehensive Introduction to Differential Geometry. Volume 1. 3rd edition. Publish or Perish. 1999.
inside()