Revision: 51592
          http://brlcad.svn.sourceforge.net/brlcad/?rev=51592&view=rev
Author:   starseeker
Date:     2012-07-19 14:01:47 +0000 (Thu, 19 Jul 2012)
Log Message:
-----------
nevermind exposing the coplanar subroutine - do that only if it looks like the 
standard routine is a significant performance overhead (doubtful)

Modified Paths:
--------------
    brlcad/trunk/include/bn.h
    brlcad/trunk/src/libbn/tri_tri.c

Modified: brlcad/trunk/include/bn.h
===================================================================
--- brlcad/trunk/include/bn.h   2012-07-19 11:02:23 UTC (rev 51591)
+++ brlcad/trunk/include/bn.h   2012-07-19 14:01:47 UTC (rev 51592)
@@ -1682,13 +1682,6 @@
  * Journal of Graphics Tools, 2(2), 1997
  */
 
-BN_EXPORT extern int bn_coplanar_tri_tri(point_t V0,   
-                                        point_t V1,
-                                        point_t V2,
-                                        point_t U0,
-                                        point_t U1,
-                                        point_t U2);
-
 BN_EXPORT extern int bn_tri_tri_isect(point_t V0,
                                       point_t V1,
                                       point_t V2,
@@ -1706,8 +1699,6 @@
                                                 point_t *isectpt1,
                                                 point_t *isectp2);
 
-
-
 /*----------------------------------------------------------------------*/
 /* vlist.c */
 #define BN_VLIST_CHUNK 35              /**< @brief 32-bit mach => just less 
than 1k */

Modified: brlcad/trunk/src/libbn/tri_tri.c
===================================================================
--- brlcad/trunk/src/libbn/tri_tri.c    2012-07-19 11:02:23 UTC (rev 51591)
+++ brlcad/trunk/src/libbn/tri_tri.c    2012-07-19 14:01:47 UTC (rev 51592)
@@ -7,13 +7,6 @@
  * Updated June 1999: removed the divisions -- a little faster now!
  * Updated October 1999: added {} to CROSS and SUB macros 
  *
- * Calculate whether two coplanar triangles intersect:
- *
- * int bn_coplanar_tri_tri(point_t V0, point_t V1, point_t V2, 
- *                        point_t U0, point_t U1, point_t U2)
- * parameters: vertices of triangle 1: V0,V1,V2
- *             vertices of triangle 2: U0,U1,U2
- *
  * Calculate whether two triangles intersect:
  *
  * int bn_tri_tri_isect(point_t V0, point_t V1, point_t V2, 
@@ -140,28 +133,12 @@
   }                                         \
 }
 
-int bn_coplanar_tri_tri(point_t V0,point_t V1,point_t V2,
+int bn_coplanar_tri_tri(point_t N, point_t V0,point_t V1,point_t V2,
                      point_t U0,point_t U1,point_t U2)
 {
    fastf_t A[3];
    short i0,i1;
-   point_t E1, E2, N, N2;
  
-   /* Unlike the vanilla tri/tri intersection routine, BRL-CAD will
-    * re-verify coplanar status of the triangles here to make the coplanar
-    * test a "stand-alone" function, accepting the slight performance
-    * hit the re-calculation imposes. */
-   VSUB2(E1,V1,V0);
-   VSUB2(E2,V2,V0);
-   VCROSS(N,E1,E2);
-   VSUB2(E1,U1,U0);
-   VSUB2(E2,U2,U0);
-   VCROSS(N2,E1,E2);
-   VCROSS(E2, N, N2);
-   if (!VNEAR_ZERO(E2, EPSILON)) {
-      return -1;     
-   }
- 
    /* first project onto an axis-aligned plane, that maximizes the area */
    /* of the triangles, compute indices: i0,i1. */
    A[0]=FABS(N[0]);
@@ -237,7 +214,7 @@
         else \
         { \
                 /* triangles are coplanar */ \
-                return bn_coplanar_tri_tri(V0,V1,V2,U0,U1,U2); \
+                return bn_coplanar_tri_tri(N1,V0,V1,V2,U0,U1,U2); \
         } \
 }
 
@@ -501,7 +478,7 @@
   /* compute interval for triangle 1 */
   *coplanar=compute_intervals_isectline(V0,V1,V2,vp0,vp1,vp2,dv0,dv1,dv2,
                                       
dv0dv1,dv0dv2,&isect1[0],&isect1[1],isectpointA1,isectpointA2);
-  if(*coplanar) return bn_coplanar_tri_tri(V0,V1,V2,U0,U1,U2);     
+  if(*coplanar) return bn_coplanar_tri_tri(N1,V0,V1,V2,U0,U1,U2);     
 
 
   /* compute interval for triangle 2 */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to