[Ptinpoly-commits] r26 - in pkg: . src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 8 11:11:49 CEST 2014


Author: jmaisog
Date: 2014-05-08 11:11:48 +0200 (Thu, 08 May 2014)
New Revision: 26

Modified:
   pkg/DESCRIPTION
   pkg/src/kodtree.cc
   pkg/src/pinpolyhedronA.cc
Log:


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2014-05-06 11:41:48 UTC (rev 25)
+++ pkg/DESCRIPTION	2014-05-08 09:11:48 UTC (rev 26)
@@ -1,7 +1,7 @@
 Package: ptinpoly
 Title: Point-In-Polyhedron Test (2D and 3D)
 Version: 2.2
-Date: 2014-05-05
+Date: 2014-05-07
 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

Modified: pkg/src/kodtree.cc
===================================================================
--- pkg/src/kodtree.cc	2014-05-06 11:41:48 UTC (rev 25)
+++ pkg/src/kodtree.cc	2014-05-08 09:11:48 UTC (rev 26)
@@ -533,9 +533,9 @@
 
 	if(p[0]<bound[0]||p[1]<bound[1]||p[2]<bound[2]||p[0]>bound[3]||p[1]>bound[4]||p[2]>bound[5])
 		return false;
-	else if(bound[0]!=rootbound[0]&&p[0]==bound[0]||
-		    bound[1]!=rootbound[1]&&p[1]==bound[1]||
-			bound[2]!=rootbound[2]&&p[2]==bound[2] ) //need or not to follow the convention?
+	else if((bound[0]!=rootbound[0]&&p[0]==bound[0])||
+		    (bound[1]!=rootbound[1]&&p[1]==bound[1])||
+			(bound[2]!=rootbound[2]&&p[2]==bound[2]) ) //need or not to follow the convention?
 		return false;
 	else 
 		return true;
@@ -554,9 +554,9 @@
 	}//convention
 	if(p[0]<bound[0]||p[1]<bound[1]||p[2]<bound[2]||p[0]>bound[3]||p[1]>bound[4]||p[2]>bound[5])
 		return false;
-	else if(bound[0]!=rootbound[0]&&p[0]==bound[0]||
-		    bound[1]!=rootbound[1]&&p[1]==bound[1]||
-			bound[2]!=rootbound[2]&&p[2]==bound[2] )
+	else if((bound[0]!=rootbound[0]&&p[0]==bound[0])||
+		    (bound[1]!=rootbound[1]&&p[1]==bound[1])||
+			(bound[2]!=rootbound[2]&&p[2]==bound[2]) )
 		return false;
 	else 
 		return true;
@@ -847,9 +847,9 @@
 }
 bool triSortAs2Nodes(int tri3p[3],int va, int vb){
 
-	if(tri3p[0]==va&&tri3p[1]==vb||
-		tri3p[1]==va&&tri3p[2]==vb||
-		tri3p[2]==va&&tri3p[0]==vb)
+	if((tri3p[0]==va&&tri3p[1]==vb)||
+	   (tri3p[1]==va&&tri3p[2]==vb)||
+	   (tri3p[2]==va&&tri3p[0]==vb))
 		return true;
 	else
 		return false;

Modified: pkg/src/pinpolyhedronA.cc
===================================================================
--- pkg/src/pinpolyhedronA.cc	2014-05-06 11:41:48 UTC (rev 25)
+++ pkg/src/pinpolyhedronA.cc	2014-05-08 09:11:48 UTC (rev 26)
@@ -1147,7 +1147,7 @@
 	for(int i=0; i<4; i++){
 		int index=0;
 		for(int j=0; j<4; j++)
-			if(distpc[i]>distpc[j]||i>j&&distpc[i]==distpc[j])
+			if(distpc[i]>distpc[j]||(i>j&&distpc[i]==distpc[j]))
 				index++;
 		sortsub[index]=pcell->child[i];
 	}
@@ -1316,7 +1316,7 @@
 	if(!pcell||!pcell->isLeaf())
 		jf_error("error gettheclosetsegamongcell");
 	if(pcell->psegar!=0)
-		for(int i=0; i<pcell->psegar->size(); i++){
+		for(unsigned int i=0; i<pcell->psegar->size(); i++){
 			seg=(*(pcell->psegar))[i];
 			getEndPointOfSeg(seg,p0,p1);
 			if((distemp=squareDistPointToSeg(p,p0,p1))<dist){
@@ -1777,23 +1777,23 @@
 }
 bool ifSegOverlapBox2D(double ps[2],double pe[2],double bd[4],double eps){
 
-	double bound[4];
+    double bound[4];
 
-	double a=bd[2]-bd[0];
-	double b=bd[3]-bd[1];
-	bound[0]=bd[0]-eps*a;
-	bound[1]=bd[1]-eps*b;
-	bound[2]=bd[2]+eps*a;
-	bound[3]=bd[3]+eps*b;
+    double a=bd[2]-bd[0];
+    double b=bd[3]-bd[1];
+    bound[0]=bd[0]-eps*a;
+    bound[1]=bd[1]-eps*b;
+    bound[2]=bd[2]+eps*a;
+    bound[3]=bd[3]+eps*b;
 
-	if(ps[0]<bound[0]&&pe[0]<bound[0]||ps[0]>bound[2]&&pe[0]>bound[2]||
-	   ps[1]<bound[1]&&pe[1]<bound[1]||ps[1]>bound[3]&&pe[1]>bound[3]) 
-	   return false;
-	else if(ps[0]>=bound[0]&&ps[1]>=bound[1]&&ps[0]<=bound[2]&&ps[1]<=bound[3]
-	 ||pe[0]>=bound[0]&&pe[1]>=bound[1]&&pe[0]<=bound[2]&&pe[1]<=bound[3])
-		return true;
-	else
-		return if4CornerOfBoxAtDifferentSideOfSeg(ps,pe,bound);
+    if((ps[0]<bound[0]&&pe[0]<bound[0])||(ps[0]>bound[2]&&pe[0]>bound[2])||
+       (ps[1]<bound[1]&&pe[1]<bound[1])||(ps[1]>bound[3]&&pe[1]>bound[3])) 
+        return false;
+    else if((ps[0]>=bound[0]&&ps[1]>=bound[1]&&ps[0]<=bound[2]&&ps[1]<=bound[3])
+          ||(pe[0]>=bound[0]&&pe[1]>=bound[1]&&pe[0]<=bound[2]&&pe[1]<=bound[3]))
+        return true;
+    else
+        return if4CornerOfBoxAtDifferentSideOfSeg(ps,pe,bound);
 }
 bool if4CornerOfBoxAtDifferentSideOfSeg(double ps[2],double pe[2],double bound[4]){
 



More information about the Ptinpoly-commits mailing list