/** * Determines if a point d is left of the plane defined by the * points a, b, and c. The latter are assumed to be in CCW order, * as viewed from the right side of the plane. * <p> * <em>Note: this fast method may return an incorrect result.</em> * @param pa {x,y,z} coordinates of point a. * @param pb {x,y,z} coordinates of point b. * @param pc {x,y,z} coordinates of point c. * @param pd {x,y,z} coordinates of point d. * @return positive, if left of plane; * negative, if right of plane; * zero, otherwise. */ public static double leftOfPlaneFast( double[] pa, double[] pb, double[] pc, double[] pd) { return leftOfPlaneFast( pa[0],pa[1],pa[2], pb[0],pb[1],pb[2], pc[0],pc[1],pc[2], pd[0],pd[1],pd[2]); }
/** * Determines if a point d is left of the plane defined by the * points a, b, and c. The latter are assumed to be in CCW order, * as viewed from the right side of the plane. * <p> * <em>Note: this fast method may return an incorrect result.</em> * @param pa {x,y,z} coordinates of point a. * @param pb {x,y,z} coordinates of point b. * @param pc {x,y,z} coordinates of point c. * @param pd {x,y,z} coordinates of point d. * @return positive, if left of plane; * negative, if right of plane; * zero, otherwise. */ public static double leftOfPlaneFast( float[] pa, float[] pb, float[] pc, float[] pd) { return leftOfPlaneFast( pa[0],pa[1],pa[2], pb[0],pb[1],pb[2], pc[0],pc[1],pc[2], pd[0],pd[1],pd[2]); }
public void testLeftOfPlaneSpecial() { double[] pa = {99.50000003392293,125.85383672388726,4.712236446160304}; double[] pb = {91.50000003119546,125.85383641401195,4.712236443259705}; double[] pc = {107.5000000366504,125.85383703376256,4.712236449060903}; double[] pd = {27.50000030246409,125.8538208916998,122.28777353807229}; double ra = Geometry.leftOfPlane(pa,pb,pc,pd); double rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); assertTrue(ra==0.0); assertTrue(rf!=0.0); }
public void testLeftOfPlaneSpecial2() { double[] pa = {111.50000056515266,125.85385176546224,4.712249324321081}; double[] pb = {123.50000062597627,125.85385229716680,4.712249325708733}; double[] pc = {105.50000053474086,125.85385224976321,4.712249323627476}; double[] pd = { 93.50000047391725,125.85385171805865,4.712249322239824}; double ra = Geometry.leftOfPlane(pa,pb,pc,pd); double rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); assertTrue(ra==0.0); assertTrue(rf!=0.0); }
rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("0 leftOfPlane: "+String.format("%26.18e",ra)); trace("0 leftOfPlaneFast: "+String.format("%26.18e",rf)); rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("+ leftOfPlane: "+String.format("%26.18e",ra)); trace("+ leftOfPlaneFast: "+String.format("%26.18e",rf)); rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("- leftOfPlane: "+String.format("%26.18e",ra)); trace("- leftOfPlaneFast: "+String.format("%26.18e",rf));
for (nplane=0; sw.time()<maxtime; nplane+=niter) { for (int iter=0; iter<niter; ++iter) { Geometry.leftOfPlaneFast(xa,ya,za,xb,yb,zb,xc,yc,zc,xd,yd,zd);