[Ptinpoly-commits] r17 - in pkg: . R src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 1 13:33:27 CEST 2014


Author: jmaisog
Date: 2014-05-01 13:33:27 +0200 (Thu, 01 May 2014)
New Revision: 17

Modified:
   pkg/DESCRIPTION
   pkg/R/blocks2vf.R
   pkg/src/pinpolyhedronA.cc
Log:


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2014-04-29 01:35:28 UTC (rev 16)
+++ pkg/DESCRIPTION	2014-05-01 11:33:27 UTC (rev 17)
@@ -1,7 +1,7 @@
 Package: ptinpoly
 Title: Point-In-Polyhedron Test (2D and 3D)
-Version: 2.1
-Date: 2014-04-12
+Version: 2.2
+Date: 2014-04-30
 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
@@ -10,6 +10,5 @@
 		within, exactly on, or outside a polygon.
 License: GPL-2
 LazyLoad: yes
-Depends: misc3d
-Suggests: rgl, geometry
+Suggests: misc3d, rgl, geometry
 URL: http://ptinpoly.pbworks.com

Modified: pkg/R/blocks2vf.R
===================================================================
--- pkg/R/blocks2vf.R	2014-04-29 01:35:28 UTC (rev 16)
+++ pkg/R/blocks2vf.R	2014-05-01 11:33:27 UTC (rev 17)
@@ -48,8 +48,30 @@
 
     # Use misc3d function to perform the conversion.
     ta    = makeTriangles(Block1,Block2,Block3)
-    ve    = misc3d:::t2ve(ta)
+    ve    = ptinpoly_t2ve(ta)
     verts = t(ve$vb)
     faces = t(ve$ib)
     return (list(verts,faces))
 }
+
+# The following is from an unexported function T2VE in the misc3d package.
+# To avoid name collisions, the name of the function has been modified here.
+ptinpoly_t2ve <- function(triangles) 
+{
+    vb <- rbind(triangles$v1, triangles$v2, triangles$v3)
+    vbmin <- min(vb)
+    vbmax <- max(vb)
+    S <- 10^5
+    score <- function(v, d) floor(as.vector(v %*% d))
+    scale <- function(v) (1 - 1/S) * (v - vbmin)/(vbmax - vbmin)
+    d <- c(S, S^2, S^3)
+    scores <- score(scale(vb), d)
+    vb <- vb[!duplicated(scores), ]
+    scores <- score(scale(vb), d)
+    ib <- rbind(match(score(scale(triangles$v1), d), scores), 
+        match(score(scale(triangles$v2), d), scores), match(score(scale(triangles$v3), 
+            d), scores))
+    list(vb = t(vb), ib = ib)
+}
+
+

Modified: pkg/src/pinpolyhedronA.cc
===================================================================
--- pkg/src/pinpolyhedronA.cc	2014-04-29 01:35:28 UTC (rev 16)
+++ pkg/src/pinpolyhedronA.cc	2014-05-01 11:33:27 UTC (rev 17)
@@ -375,7 +375,7 @@
 	void **wvti;
 	wrapPointsUpasVerts(wvti);
 	polytree=new Kodtree(wvti,numvert,pofvforcoordnodes3,3,epsoverlap);
-	delete wvti;
+	delete [] wvti;
     polytree->setFuncExinfoShouldbeInCell(ifexinfoshouldbeincell);
 	polytree->setFuncExinfoOverlapBox(ifexinfooverlapbox);
 	for(int i=0; i<numtri; i++)



More information about the Ptinpoly-commits mailing list