inside2trans: test points against a 2-transition surface

View source: R/trans2.R

inside2transR Documentation

test points against a 2-transition surface

Description

This function tests points for being inside the 2-transition surface associated with a zonohedron.

Usage

inside2trans( x, p )

Arguments

x

a zonohedron object

p

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.

Details

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.

Value

inside2trans() returns a data.frame with N rows and these columns:

p

the given point

distance

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.

linkingnumber

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).

inside

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).

timecalc

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.

Note

The standard definition of the linking number of a point and a surface uses intersections with rays, see the vignette The 2-Transition Subcomplex and the 2-Transition Surface for the precise definition. This is fine in theory, but in practice does not handle well the case when the ray intersects the boundary of a parallelogram. So this function uses an integral formula for the degree of a linking map that reduces to summing the signed area of a lot of spherical triangles, see Spivak p. 75 and Guillemin and Pollack p. 188.

References

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.

See Also

inside()


zonohedra documentation built on Sept. 11, 2024, 5:20 p.m.