[Ptinpoly-commits] r12 - in pkg: . man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 11 02:11:16 CEST 2012


Author: jmaisog
Date: 2012-06-11 02:11:16 +0200 (Mon, 11 Jun 2012)
New Revision: 12

Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/man/blocks2vf.Rd
   pkg/man/comb.Rd
   pkg/man/cube.Rd
   pkg/man/fractal.Rd
   pkg/man/pip2d.Rd
   pkg/man/pip3d.Rd
   pkg/man/spiral.Rd
   pkg/man/vf2blocks.Rd
   pkg/src/pinpolyhedronA.cc
Log:
Commented out use of cout in pinpolyhedronA.cc. Changed Carriage Returns to Line Feeds in .Rd documentation files, as well as in the DESCRIPTION and NAMESPACE files. Commented out library(rgl) in Examples, but uncommented out library(misc3d).

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/DESCRIPTION	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,15 +1,15 @@
-Package: ptinpoly
-Title: Point-In-Polyhedron Test (2D and 3D)
-Version: 2.0
-Date: 2011-10-18
-Author: Jose M. Maisog, Yuan Wang, George Luta, Jianfei Liu
-Maintainer: Jose M. Maisog <bravas02 at gmail.com>
-Description: This library provides a function 'pip3d', which tests whether a point in 3D space is
-        within, exactly on, or outside an enclosed surface defined by a triangular mesh.
-		Also provided is a 2D version, 'pip2d', which tests whether a point in 2D space is
-		within, exactly on, or outside a polygon.
-License: GPL-2
-LazyLoad: yes
-Depends: misc3d
-Suggests: rgl, geometry
-URL: http://ptinpoly.pbworks.com
+Package: ptinpoly
+Title: Point-In-Polyhedron Test (2D and 3D)
+Version: 2.01
+Date: 2012-06-10
+Author: Jose M. Maisog, Yuan Wang, George Luta, Jianfei Liu
+Maintainer: Jose M. Maisog <bravas02 at gmail.com>
+Description: This library provides a function 'pip3d', which tests whether a point in 3D space is
+        within, exactly on, or outside an enclosed surface defined by a triangular mesh.
+		Also provided is a 2D version, 'pip2d', which tests whether a point in 2D space is
+		within, exactly on, or outside a polygon.
+License: GPL-2
+LazyLoad: yes
+Depends: misc3d
+Suggests: rgl, geometry
+URL: http://ptinpoly.pbworks.com

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/NAMESPACE	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,5 +1,5 @@
-useDynLib(ptinpoly)
-export(pip2d)
-export(pip3d)
-export(blocks2vf)
-export(vf2blocks)
+useDynLib(ptinpoly)
+export(pip2d)
+export(pip3d)
+export(blocks2vf)
+export(vf2blocks)

Modified: pkg/man/blocks2vf.Rd
===================================================================
--- pkg/man/blocks2vf.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/blocks2vf.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,54 +1,54 @@
-\name{blocks2vf}
-\alias{blocks2vf}
-\title{
-Convertor from 3-Block Representation Representation to Vertices-Faces
-}
-\description{
-Converts a polyhedron from the \dfn{three-block} representation to the \dfn{vertices-faces} representation.
-}
-\usage{blocks2vf(Block1,Block2,Block3)}
-\arguments{
-    \item{Block1}{M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron}
-    \item{Block2}{M by 3 matrix containing the XYZ coordinates of vertex 2 of the M faces of the polyhedron}
-    \item{Block3}{M by 3 matrix containing the XYZ coordinates of vertex 3 of the M faces of the polyhedron}
-}
-\value{
-Returns a list of two matrices.
-The first is a N by 3 matrix containing the XYZ coordinates of the N vertices of the polyhedron.
-The second M by 3 matrix containing indices of the vertices defining the M faces.  See the example below.
-}
-\details{
-The values in the first output matrix can be floating point integers, representing the
-XYZ coordinates of the vertices of the polyhedron.
-
-The values in the second output matrix will be integers with values running from 1 to N,
-where N is the number of vertices.  A value of '1' in this matrix, for example,
-represents the 1st vertex, i.e., the vertex defined by the first row in the
-matrix \code{Vertices}.  Each row in this matrix defines a triangular face in the polyhedron.
-
-This function is the inverse of the \code{vf2blocks} function.
-}
-\note{
-This function requires the \bold{misc3d} library.
-}
-\examples{
-# Load example data.
-data(verts)
-data(faces)
-
-# Use vf2blocks to convert from vertices-faces representation to 3-block representation.
-# Note double square brackets.
-blocks = vf2blocks(verts,faces)
-block1 = blocks[[1]]
-block2 = blocks[[2]]
-block3 = blocks[[3]]
-
-# Now use blocks2vf to convert back to vertices-faces representation.
-# 'verts2' and 'faces2' should encode the same polyhedron as the
-# original 'verts' and 'faces', although perhaps in a different order.
-# Note double square brackets.
-vertsFaces = blocks2vf(block1,block2,block3)
-verts2 = vertsFaces[[1]]
-faces2 = vertsFaces[[2]]
-}
-\keyword{methods}
+\name{blocks2vf}
+\alias{blocks2vf}
+\title{
+Convertor from 3-Block Representation Representation to Vertices-Faces
+}
+\description{
+Converts a polyhedron from the \dfn{three-block} representation to the \dfn{vertices-faces} representation.
+}
+\usage{blocks2vf(Block1,Block2,Block3)}
+\arguments{
+    \item{Block1}{M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron}
+    \item{Block2}{M by 3 matrix containing the XYZ coordinates of vertex 2 of the M faces of the polyhedron}
+    \item{Block3}{M by 3 matrix containing the XYZ coordinates of vertex 3 of the M faces of the polyhedron}
+}
+\value{
+Returns a list of two matrices.
+The first is a N by 3 matrix containing the XYZ coordinates of the N vertices of the polyhedron.
+The second M by 3 matrix containing indices of the vertices defining the M faces.  See the example below.
+}
+\details{
+The values in the first output matrix can be floating point integers, representing the
+XYZ coordinates of the vertices of the polyhedron.
+
+The values in the second output matrix will be integers with values running from 1 to N,
+where N is the number of vertices.  A value of '1' in this matrix, for example,
+represents the 1st vertex, i.e., the vertex defined by the first row in the
+matrix \code{Vertices}.  Each row in this matrix defines a triangular face in the polyhedron.
+
+This function is the inverse of the \code{vf2blocks} function.
+}
+\note{
+This function requires the \bold{misc3d} library.
+}
+\examples{
+# Load example data.
+data(verts)
+data(faces)
+
+# Use vf2blocks to convert from vertices-faces representation to 3-block representation.
+# Note double square brackets.
+blocks = vf2blocks(verts,faces)
+block1 = blocks[[1]]
+block2 = blocks[[2]]
+block3 = blocks[[3]]
+
+# Now use blocks2vf to convert back to vertices-faces representation.
+# 'verts2' and 'faces2' should encode the same polyhedron as the
+# original 'verts' and 'faces', although perhaps in a different order.
+# Note double square brackets.
+vertsFaces = blocks2vf(block1,block2,block3)
+verts2 = vertsFaces[[1]]
+faces2 = vertsFaces[[2]]
+}
+\keyword{methods}

Modified: pkg/man/comb.Rd
===================================================================
--- pkg/man/comb.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/comb.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,29 +1,29 @@
-\name{comb}
-\alias{comb}
-\docType{data}
-\title{
-Sample Data: Comb Polygon
-}
-\description{
-Sample data defining an enclosed comb 2D polygon.
-}
-\usage{data(comb)}
-\examples{
-# Load polygon.
-data(comb)
-
-# Plot the polygon.
-plot(rbind(comb,comb[1,]),type="l")
-
-# Generate 3333 random test points.
-set.seed(1902)
-n       <- 3333
-x1      <- rnorm(n) ; x2 <- rnorm(n)
-X       <- cbind(x1,x2)
-queries <- as.matrix(X)
-
-# Check whether test points are contained in the polygon.
-# Most of these points will lie outside the polygon.
-containment = pip2d(comb,queries);
-}
-\keyword{datasets}
+\name{comb}
+\alias{comb}
+\docType{data}
+\title{
+Sample Data: Comb Polygon
+}
+\description{
+Sample data defining an enclosed comb 2D polygon.
+}
+\usage{data(comb)}
+\examples{
+# Load polygon.
+data(comb)
+
+# Plot the polygon.
+plot(rbind(comb,comb[1,]),type="l")
+
+# Generate 3333 random test points.
+set.seed(1902)
+n       <- 3333
+x1      <- rnorm(n) ; x2 <- rnorm(n)
+X       <- cbind(x1,x2)
+queries <- as.matrix(X)
+
+# Check whether test points are contained in the polygon.
+# Most of these points will lie outside the polygon.
+containment = pip2d(comb,queries);
+}
+\keyword{datasets}

Modified: pkg/man/cube.Rd
===================================================================
--- pkg/man/cube.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/cube.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,46 +1,46 @@
-\name{cube}
-\alias{cube}
-\alias{faces}
-\alias{verts}
-\alias{queries}
-\docType{data}
-\title{
-Sample Data: Simple Cube
-}
-\description{
-This is sample data that defines a simple cube: eight vertices,
-and twelve triangles that make up the six faces.
-
-Also included is an example matrix \code{queries} of five test points.
-The first test point is contained within the cube, the second
-through fourth test points lie exactly on the surface of the
-cube, and the fifth test point lies outside the cube.
-}
-\usage{
-data(verts)
-data(faces)
-data(queries)
-}
-\format{
-\code{verts} is an 8 by 3 matrix containing the XYZ coordinates of the vertices of a simple cube.
-
-\code{faces} is a 12 by 3 matrix containing the indices of the vertices defining the twelve
-triangular faces making up the surface of the cube.
-
-\code{queries} is a 5 by 3 matrix containing the XYZ coordinates of five test points to be
-tested for containment within the cube.
-}
-\examples{
-# Load sample data defining a simple cube. 
-data(verts)
-data(faces)
-
-# Also load sample data for five test points.
-data(queries)
-
-# Test whether each point in 'queries' is contained in
-# the simple cube defined by 'verts' and 'faces'.
-# This should return "1  0  0  0 -1".
-containment = pip3d(verts,faces,queries);
-}
-\keyword{datasets}
+\name{cube}
+\alias{cube}
+\alias{faces}
+\alias{verts}
+\alias{queries}
+\docType{data}
+\title{
+Sample Data: Simple Cube
+}
+\description{
+This is sample data that defines a simple cube: eight vertices,
+and twelve triangles that make up the six faces.
+
+Also included is an example matrix \code{queries} of five test points.
+The first test point is contained within the cube, the second
+through fourth test points lie exactly on the surface of the
+cube, and the fifth test point lies outside the cube.
+}
+\usage{
+data(verts)
+data(faces)
+data(queries)
+}
+\format{
+\code{verts} is an 8 by 3 matrix containing the XYZ coordinates of the vertices of a simple cube.
+
+\code{faces} is a 12 by 3 matrix containing the indices of the vertices defining the twelve
+triangular faces making up the surface of the cube.
+
+\code{queries} is a 5 by 3 matrix containing the XYZ coordinates of five test points to be
+tested for containment within the cube.
+}
+\examples{
+# Load sample data defining a simple cube. 
+data(verts)
+data(faces)
+
+# Also load sample data for five test points.
+data(queries)
+
+# Test whether each point in 'queries' is contained in
+# the simple cube defined by 'verts' and 'faces'.
+# This should return "1  0  0  0 -1".
+containment = pip3d(verts,faces,queries);
+}
+\keyword{datasets}

Modified: pkg/man/fractal.Rd
===================================================================
--- pkg/man/fractal.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/fractal.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,29 +1,29 @@
-\name{fractal}
-\alias{fractal}
-\docType{data}
-\title{
-Sample Data: Fractal Polygon
-}
-\description{
-Sample data defining an enclosed fractal 2D polygon.
-}
-\usage{data(fractal)}
-\examples{
-# Load polygon.
-data(fractal)
-
-# Plot the polygon.
-plot(rbind(fractal,fractal[1,]),type="l")
-
-# Generate 3333 random test points.
-set.seed(1902)
-n       <- 3333
-x1      <- rnorm(n) ; x2 <- rnorm(n)
-X       <- cbind(x1,x2)
-queries <- as.matrix(X)
-
-# Check whether test points are contained in the polygon.
-# Most of these points will lie outside the polygon.
-containment = pip2d(fractal,queries);
-}
-\keyword{datasets}
+\name{fractal}
+\alias{fractal}
+\docType{data}
+\title{
+Sample Data: Fractal Polygon
+}
+\description{
+Sample data defining an enclosed fractal 2D polygon.
+}
+\usage{data(fractal)}
+\examples{
+# Load polygon.
+data(fractal)
+
+# Plot the polygon.
+plot(rbind(fractal,fractal[1,]),type="l")
+
+# Generate 3333 random test points.
+set.seed(1902)
+n       <- 3333
+x1      <- rnorm(n) ; x2 <- rnorm(n)
+X       <- cbind(x1,x2)
+queries <- as.matrix(X)
+
+# Check whether test points are contained in the polygon.
+# Most of these points will lie outside the polygon.
+containment = pip2d(fractal,queries);
+}
+\keyword{datasets}

Modified: pkg/man/pip2d.Rd
===================================================================
--- pkg/man/pip2d.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/pip2d.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,76 +1,76 @@
-\name{pip2d}
-\alias{pip2d}
-\title{
-Test for Point Containment in 2D Polygon
-}
-\description{
-Tests whether points are contained within a two-dimensional polygon.
-}
-\usage{pip2d(Vertices,Queries)}
-\arguments{
-    \item{Vertices}{N by 2 matrix containing the XY coordinates of N vertices of the polygon}
-    \item{Queries}{P by 2 matrix containing the XY coordinates of P points
-	to be tested for containment in the polygon defined by 'Vertices'}
-}
-\details{
-The XY coordinates of the vertices are stored \emph{in order} in the
-matrix \code{Vertices}. It is assumed that the last vertex listed in the matrix
-is connected to the first vertex, so that the polygon does not have a ''hole''.
-}
-\value{
-Returns a vector containing P values, one for each of the P points listed in
-the \code{Queries} matrix.
-
-'1' indicates that the point is contained in the polygon.
-
-'0' indicates that the point lies exactly on the surface of the polygon.
-
-'-1' indicates that the point lies outside the polygon.
-
-'-3' (error) indicates that the \code{Vertices} matrix didn't have two columns
-
-'-6' (error) indicates that the \code{Queries} matrix didn't have two columns
-
-'-8' (error) indicates computational error not otherwise specified
-}
-\note{
-The polygon defined by \code{Vertices} \emph{must} be "non-leaky";
-i.e., it must define an "inside" versus "outside" and must not contain any holes.
-}
-\references{
-W.P. Horn and D.L. Taylor, \emph{A theorem to determine the spatial containment of a point in a planar polygon}, Computer Vision, Graphics and Image Processing, vol. 45, pp. 106-116,1989.
-
-S. Nordbeck and B. Rysedt, \emph{Computer cartography point-in-polygon programs}, BIT, vol. 7, pp. 39-64, 1967.
-
-J.A. Baerentzen and H. Aanaes, \emph{Signed distance computation using the angle weighted pseudo-normal}, IEEE Trans. Visualization and Computer Graphics, vol. 11, no. 3, pp. 243-253, May/June 2005.
-
-J. Liu, Y.Q. Chen, J.M. Maisog, G. Luta, \emph{A new point containment test algorithm for polygon composed of huge number of triangles}, Computer-Aided Design, Volume 42, Issue 12, December 2010, Pages 1143-1150.
-
-\url{http://ptinpoly.pbworks.com/}
-}
-\examples{
-#-------------------------------------------
-# Load sample data defining a comb, spiral, and fractal. 
-data(comb)
-data(spiral)
-data(fractal)
-
-# Plot the comb, spiral, and fractal.
-plot(rbind(comb,comb[1,]),type="l")
-plot(rbind(spiral,spiral[1,]),type="l")
-plot(rbind(fractal,fractal[1,]),type="l")
-
-# Generate 3333 random test points.
-set.seed(1902)
-n       <- 3333
-x1      <- rnorm(n) ; x2 <- rnorm(n)
-X       <- cbind(x1,x2)
-queries <- as.matrix(X)
-
-# Check whether test points are contained in the comb, spiral, and factal.
-# Most of these points will lie outside the polygons.
-containment1 = pip2d(comb,queries);
-containment2 = pip2d(spiral,queries);
-containment3 = pip2d(fractal,queries);
-}
-\keyword{methods}
+\name{pip2d}
+\alias{pip2d}
+\title{
+Test for Point Containment in 2D Polygon
+}
+\description{
+Tests whether points are contained within a two-dimensional polygon.
+}
+\usage{pip2d(Vertices,Queries)}
+\arguments{
+    \item{Vertices}{N by 2 matrix containing the XY coordinates of N vertices of the polygon}
+    \item{Queries}{P by 2 matrix containing the XY coordinates of P points
+	to be tested for containment in the polygon defined by 'Vertices'}
+}
+\details{
+The XY coordinates of the vertices are stored \emph{in order} in the
+matrix \code{Vertices}. It is assumed that the last vertex listed in the matrix
+is connected to the first vertex, so that the polygon does not have a ''hole''.
+}
+\value{
+Returns a vector containing P values, one for each of the P points listed in
+the \code{Queries} matrix.
+
+'1' indicates that the point is contained in the polygon.
+
+'0' indicates that the point lies exactly on the surface of the polygon.
+
+'-1' indicates that the point lies outside the polygon.
+
+'-3' (error) indicates that the \code{Vertices} matrix didn't have two columns
+
+'-6' (error) indicates that the \code{Queries} matrix didn't have two columns
+
+'-8' (error) indicates computational error not otherwise specified
+}
+\note{
+The polygon defined by \code{Vertices} \emph{must} be "non-leaky";
+i.e., it must define an "inside" versus "outside" and must not contain any holes.
+}
+\references{
+W.P. Horn and D.L. Taylor, \emph{A theorem to determine the spatial containment of a point in a planar polygon}, Computer Vision, Graphics and Image Processing, vol. 45, pp. 106-116,1989.
+
+S. Nordbeck and B. Rysedt, \emph{Computer cartography point-in-polygon programs}, BIT, vol. 7, pp. 39-64, 1967.
+
+J.A. Baerentzen and H. Aanaes, \emph{Signed distance computation using the angle weighted pseudo-normal}, IEEE Trans. Visualization and Computer Graphics, vol. 11, no. 3, pp. 243-253, May/June 2005.
+
+J. Liu, Y.Q. Chen, J.M. Maisog, G. Luta, \emph{A new point containment test algorithm for polygon composed of huge number of triangles}, Computer-Aided Design, Volume 42, Issue 12, December 2010, Pages 1143-1150.
+
+\url{http://ptinpoly.pbworks.com/}
+}
+\examples{
+#-------------------------------------------
+# Load sample data defining a comb, spiral, and fractal. 
+data(comb)
+data(spiral)
+data(fractal)
+
+# Plot the comb, spiral, and fractal.
+plot(rbind(comb,comb[1,]),type="l")
+plot(rbind(spiral,spiral[1,]),type="l")
+plot(rbind(fractal,fractal[1,]),type="l")
+
+# Generate 3333 random test points.
+set.seed(1902)
+n       <- 3333
+x1      <- rnorm(n) ; x2 <- rnorm(n)
+X       <- cbind(x1,x2)
+queries <- as.matrix(X)
+
+# Check whether test points are contained in the comb, spiral, and factal.
+# Most of these points will lie outside the polygons.
+containment1 = pip2d(comb,queries);
+containment2 = pip2d(spiral,queries);
+containment3 = pip2d(fractal,queries);
+}
+\keyword{methods}

Modified: pkg/man/pip3d.Rd
===================================================================
--- pkg/man/pip3d.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/pip3d.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,133 +1,133 @@
-\name{pip3d}
-\alias{pip3d}
-\title{
-Test for Point Containment in 3D Polyhedron
-}
-\description{
-Tests whether points are contained within a three-dimensional polyhedron.
-}
-\usage{pip3d(Vertices,Faces,Queries)}
-\arguments{
-    \item{Vertices}{N by 3 matrix containing the XYZ coordinates of N vertices of the polyhedron}
-    \item{Faces}{M by 3 matrix containing the indices of the three vertices defining the M triangular faces of the polyhedron}
-    \item{Queries}{P by 3 matrix containing the XYZ coordinates of P points
-	to be tested for containment in the polyhedron defined by 'Vertices' and 'Faces'}
-}
-\details{
-The values in the \code{Faces} matrix must be integers with values running from 1 to N,
-where N is the number of vertices.  A value of '1' in this matrix, for example,
-represents the 1st vertex, i.e., the vertex defined by the first row in the
-matrix \code{Vertices}.
-}
-\value{
-Returns a vector containing P values, one for each of the P points listed in
-the \code{Queries} matrix.
-
-'1' indicates that the point is contained in the polyhedron.
-
-'0' indicates that the point lies exactly on the surface of the polyhedron.
-
-'-1' indicates that the point lies outside the polyhedron.
-
-'-2' (error) indicates that the polyhedron was topologically defective (e.g., had a hole)
-
-'-3' (error) indicates that the \code{Vertices} matrix didn't have three columns
-
-'-4' (error) indicates that the \code{Faces} matrix didn't have three columns
-
-'-5' (error) indicates that the \code{Faces} matrix was 0- rather than 1-offset
-
-'-6' (error) indicates that the \code{Queries} matrix didn't have three columns
-
-'-7' (error) indicates that two faces in the polyhedron were too close to one another
-
-'-8' (error) indicates computational error not otherwise specified. A possible cause is when two faces of the polygon are extremely close to one another (imagine bending a cylindrical balloon until the two ends meet). Adjusting the spatial smoothness of the data may fix this problem.
-
-}
-\note{
-The polyhedron defined by \code{Vertices} and \code{Faces} \emph{must} be "non-leaky";
-i.e., it must define an "inside" versus "outside" and must not contain any holes.
-
-For an example of external software that could potentially be used to fix defective polyhedra,
-see, e.g., PolyMender (\url{http://www1.cse.wustl.edu/~taoju/code/polymender.htm}).
-
-Previous versions of this function would hang when there were more than two vertices very close
-to one another; this problem was discovered with a polyhedron in which there were multip;le
-duplicate vertices and one triplicate vertex.  The triplicate vertex fulfilled the case of
-"more than two vertices very close to one another", and caused the code to hang.
-The threshold for vertices that are very close to one another has been increased to three.
-It is advisable to make sure that a polyhedron does not have more than three vertices
-that are "very close to one another", and to make sure that there are no duplicate vertices.
-Similarly, it is advisable to make sure that a polyhedron does not have \emph{faces} that
-that are extremely close to one another.
-}
-\references{
-W.P. Horn and D.L. Taylor, \emph{A theorem to determine the spatial containment of a point in a planar polygon}, Computer Vision, Graphics and Image Processing, vol. 45, pp. 106-116,1989.
-
-S. Nordbeck and B. Rysedt, \emph{Computer cartography point-in-polygon programs}, BIT, vol. 7, pp. 39-64, 1967.
-
-J.A. Baerentzen and H. Aanaes, \emph{Signed distance computation using the angle weighted pseudo-normal}, IEEE Trans. Visualization and Computer Graphics, vol. 11, no. 3, pp. 243-253, May/June 2005.
-
-J. Liu, Y.Q. Chen, J.M. Maisog, G. Luta, \emph{A new point containment test algorithm for polyhedron composed of huge number of triangles}, Computer-Aided Design, Volume 42, Issue 12, December 2010, Pages 1143-1150.
-
-\url{http://ptinpoly.pbworks.com/}
-}
-\examples{
-#-------------------------------------------
-# Simple Cube example.
-
-# Load sample data defining a simple cube. 
-data(verts)
-data(faces)
-
-# Also load sample data for five test points.
-data(queries)
-
-# Test whether each point in 'queries' is contained in
-# the simple cube defined by 'verts' and 'faces'.
-# This should return "1  0  0  0 -1".
-containment = pip3d(verts,faces,queries);
-
-#-------------------------------------------
-# Torus example.
-
-# Make a donut-shaped polyhedron.
-# library(misc3d)
-torus <- parametric3d(fx = function(u,v) (1+0.25*cos(v))*cos(u),
-                      fy = function(u,v) (1+0.25*cos(v))*sin(u),
-                      fz = function(u,v) 0.25*sin(v),
-                      u = seq(0,2*pi,length.out=10),
-                      v = seq(0,2*pi,length.out=10),
-                      engine = "none", color="orange", alpha=0.25)
-
-# If desired, this torus can be rendered for visualization, e.g.:
-# library(geometry)
-# library(rgl)
-# library(misc3d)
-drawScene.rgl(torus)
-
-# Convert the torus to vertices-faces representation.
-ve       <- misc3d:::t2ve(torus)
-Vertices <- t(ve$vb)
-Faces    <- t(ve$ib)
-
-# Generate 3333 random test points.
-set.seed(1902)
-n       <- 3333
-x1      <- rnorm(n) ; x2 <- rnorm(n) ; x3 <- rnorm(n)
-X       <- cbind(x1,x2,x3)
-Queries <- as.matrix(X)
-
-# Check whether test points are contained in the torus.
-# Most of these points will lie outside the torus.
-containment = pip3d(Vertices,Faces,Queries);
-
-#-------------------------------------------
-# If you remove one of the faces of the cube, the resulting cube
-# becomes "leaky".  Running 'pip3d' on the resulting defective
-# polyhedron will return -2.
-
-badcube     = faces[1:11,]
-containment = pip3d(verts,badcube,queries);
-}
-\keyword{methods}
+\name{pip3d}
+\alias{pip3d}
+\title{
+Test for Point Containment in 3D Polyhedron
+}
+\description{
+Tests whether points are contained within a three-dimensional polyhedron.
+}
+\usage{pip3d(Vertices,Faces,Queries)}
+\arguments{
+    \item{Vertices}{N by 3 matrix containing the XYZ coordinates of N vertices of the polyhedron}
+    \item{Faces}{M by 3 matrix containing the indices of the three vertices defining the M triangular faces of the polyhedron}
+    \item{Queries}{P by 3 matrix containing the XYZ coordinates of P points
+	to be tested for containment in the polyhedron defined by 'Vertices' and 'Faces'}
+}
+\details{
+The values in the \code{Faces} matrix must be integers with values running from 1 to N,
+where N is the number of vertices.  A value of '1' in this matrix, for example,
+represents the 1st vertex, i.e., the vertex defined by the first row in the
+matrix \code{Vertices}.
+}
+\value{
+Returns a vector containing P values, one for each of the P points listed in
+the \code{Queries} matrix.
+
+'1' indicates that the point is contained in the polyhedron.
+
+'0' indicates that the point lies exactly on the surface of the polyhedron.
+
+'-1' indicates that the point lies outside the polyhedron.
+
+'-2' (error) indicates that the polyhedron was topologically defective (e.g., had a hole)
+
+'-3' (error) indicates that the \code{Vertices} matrix didn't have three columns
+
+'-4' (error) indicates that the \code{Faces} matrix didn't have three columns
+
+'-5' (error) indicates that the \code{Faces} matrix was 0- rather than 1-offset
+
+'-6' (error) indicates that the \code{Queries} matrix didn't have three columns
+
+'-7' (error) indicates that two faces in the polyhedron were too close to one another
+
+'-8' (error) indicates computational error not otherwise specified. A possible cause is when two faces of the polygon are extremely close to one another (imagine bending a cylindrical balloon until the two ends meet). Adjusting the spatial smoothness of the data may fix this problem.
+
+}
+\note{
+The polyhedron defined by \code{Vertices} and \code{Faces} \emph{must} be "non-leaky";
+i.e., it must define an "inside" versus "outside" and must not contain any holes.
+
+For an example of external software that could potentially be used to fix defective polyhedra,
+see, e.g., PolyMender (\url{http://www1.cse.wustl.edu/~taoju/code/polymender.htm}).
+
+Previous versions of this function would hang when there were more than two vertices very close
+to one another; this problem was discovered with a polyhedron in which there were multip;le
+duplicate vertices and one triplicate vertex.  The triplicate vertex fulfilled the case of
+"more than two vertices very close to one another", and caused the code to hang.
+The threshold for vertices that are very close to one another has been increased to three.
+It is advisable to make sure that a polyhedron does not have more than three vertices
+that are "very close to one another", and to make sure that there are no duplicate vertices.
+Similarly, it is advisable to make sure that a polyhedron does not have \emph{faces} that
+that are extremely close to one another.
+}
+\references{
+W.P. Horn and D.L. Taylor, \emph{A theorem to determine the spatial containment of a point in a planar polygon}, Computer Vision, Graphics and Image Processing, vol. 45, pp. 106-116,1989.
+
+S. Nordbeck and B. Rysedt, \emph{Computer cartography point-in-polygon programs}, BIT, vol. 7, pp. 39-64, 1967.
+
+J.A. Baerentzen and H. Aanaes, \emph{Signed distance computation using the angle weighted pseudo-normal}, IEEE Trans. Visualization and Computer Graphics, vol. 11, no. 3, pp. 243-253, May/June 2005.
+
+J. Liu, Y.Q. Chen, J.M. Maisog, G. Luta, \emph{A new point containment test algorithm for polyhedron composed of huge number of triangles}, Computer-Aided Design, Volume 42, Issue 12, December 2010, Pages 1143-1150.
+
+\url{http://ptinpoly.pbworks.com/}
+}
+\examples{
+#-------------------------------------------
+# Simple Cube example.
+
+# Load sample data defining a simple cube. 
+data(verts)
+data(faces)
+
+# Also load sample data for five test points.
+data(queries)
+
+# Test whether each point in 'queries' is contained in
+# the simple cube defined by 'verts' and 'faces'.
+# This should return "1  0  0  0 -1".
+containment = pip3d(verts,faces,queries);
+
+#-------------------------------------------
+# Torus example.
+
+# Make a donut-shaped polyhedron.
+library(misc3d)
+torus <- parametric3d(fx = function(u,v) (1+0.25*cos(v))*cos(u),
+                      fy = function(u,v) (1+0.25*cos(v))*sin(u),
+                      fz = function(u,v) 0.25*sin(v),
+                      u = seq(0,2*pi,length.out=10),
+                      v = seq(0,2*pi,length.out=10),
+                      engine = "none", color="orange", alpha=0.25)
+
+# If desired, this torus can be rendered for visualization, e.g.:
+# library(geometry)
+# library(rgl)
+# library(misc3d)
+# drawScene.rgl(torus)
+
+# Convert the torus to vertices-faces representation.
+ve       <- misc3d:::t2ve(torus)
+Vertices <- t(ve$vb)
+Faces    <- t(ve$ib)
+
+# Generate 3333 random test points.
+set.seed(1902)
+n       <- 3333
+x1      <- rnorm(n) ; x2 <- rnorm(n) ; x3 <- rnorm(n)
+X       <- cbind(x1,x2,x3)
+Queries <- as.matrix(X)
+
+# Check whether test points are contained in the torus.
+# Most of these points will lie outside the torus.
+containment = pip3d(Vertices,Faces,Queries);
+
+#-------------------------------------------
+# If you remove one of the faces of the cube, the resulting cube
+# becomes "leaky".  Running 'pip3d' on the resulting defective
+# polyhedron will return -2.
+
+badcube     = faces[1:11,]
+containment = pip3d(verts,badcube,queries);
+}
+\keyword{methods}

Modified: pkg/man/spiral.Rd
===================================================================
--- pkg/man/spiral.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/spiral.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,29 +1,29 @@
-\name{spiral}
-\alias{spiral}
-\docType{data}
-\title{
-Sample Data: Spiral Polygon
-}
-\description{
-Sample data defining an enclosed spiral 2D polygon.
-}
-\usage{data(spiral)}
-\examples{
-# Load polygon.
-data(spiral)
-
-# Plot the polygon.
-plot(rbind(spiral,spiral[1,]),type="l")
-
-# Generate 3333 random test points.
-set.seed(1902)
-n       <- 3333
-x1      <- rnorm(n) ; x2 <- rnorm(n)
-X       <- cbind(x1,x2)
-queries <- as.matrix(X)
-
-# Check whether test points are contained in the polygon.
-# Most of these points will lie outside the polygon.
-containment = pip2d(spiral,queries);
-}
-\keyword{datasets}
+\name{spiral}
+\alias{spiral}
+\docType{data}
+\title{
+Sample Data: Spiral Polygon
+}
+\description{
+Sample data defining an enclosed spiral 2D polygon.
+}
+\usage{data(spiral)}
+\examples{
+# Load polygon.
+data(spiral)
+
+# Plot the polygon.
+plot(rbind(spiral,spiral[1,]),type="l")
+
+# Generate 3333 random test points.
+set.seed(1902)
+n       <- 3333
+x1      <- rnorm(n) ; x2 <- rnorm(n)
+X       <- cbind(x1,x2)
+queries <- as.matrix(X)
+
+# Check whether test points are contained in the polygon.
+# Most of these points will lie outside the polygon.
+containment = pip2d(spiral,queries);
+}
+\keyword{datasets}

Modified: pkg/man/vf2blocks.Rd
===================================================================
--- pkg/man/vf2blocks.Rd	2011-10-19 02:15:03 UTC (rev 11)
+++ pkg/man/vf2blocks.Rd	2012-06-11 00:11:16 UTC (rev 12)
@@ -1,40 +1,40 @@
-\name{vf2blocks}
-\alias{vf2blocks}
-\title{
-Convertor from Vertices-Faces Representation to 3-Block Representation
-}
-\description{
-Converts a polyhedron from the \dfn{vertices-faces} representation to the \dfn{three-block} representation.
-}
-\usage{vf2blocks(Vertices,Faces)}
-\arguments{
-    \item{Vertices}{N by 3 matrix containing the XYZ coordinates of N vertices}
-    \item{Faces}{M by 3 matrix containing indices of vertices defining M faces}
-}
-\details{
-The values in the \code{Face} matrix must be integers with values running from 1 to N,
-where N is the number of vertices.  A value of '1' in this matrix, for example,
-represents the 1st vertex, i.e., the vertex defined by the first row in the
-matrix \code{Vertices}.
-
-This function is the inverse of the \code{blocks2vf} function.
-}
-\value{
-Returns a list of three matrices.
-The first is an M by 3 matrix containing the XYZ coordinates of vertex 1 of the M faces of the polyhedron.
-The second and third are similarly M by 3 matrices, but contain the XYZ coordinates of
-vertices 2 and 3 of the faces.  See the example below.
-}
-\examples{
-# Load example data.
-data(verts)
-data(faces)
-
-# Use vf2blocks to convert from vertices-faces representation to 3-block representation.
-# Note double square brackets.
-blocks = vf2blocks(verts,faces)
-block1 = blocks[[1]]
-block2 = blocks[[2]]
-block3 = blocks[[3]]
-}
-\keyword{methods}
+\name{vf2blocks}
+\alias{vf2blocks}
+\title{
+Convertor from Vertices-Faces Representation to 3-Block Representation
+}
+\description{
+Converts a polyhedron from the \dfn{vertices-faces} representation to the \dfn{three-block} representation.
+}
+\usage{vf2blocks(Vertices,Faces)}
+\arguments{
+    \item{Vertices}{N by 3 matrix containing the XYZ coordinates of N vertices}
+    \item{Faces}{M by 3 matrix containing indices of vertices defining M faces}
+}
+\details{
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/ptinpoly -r 12


More information about the Ptinpoly-commits mailing list