/** * Returns true iff node n is left of oriented plane abc. * Perturbation of coordinates ensures that the node is not in the plane. */ private static boolean leftOfPlane(Node a, Node b, Node c, Node n) { return Geometry.leftOfPlane( a._x,a._y,a._z, b._x,b._y,b._z, c._x,c._y,c._z, n._x,n._y,n._z)>0.0; }
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); }
/** * Returns true iff point (x,y,z) is left of oriented plane abc. */ private static boolean leftOfPlane( Node a, Node b, Node c, double x, double y, double z) { return Geometry.leftOfPlane( a._x,a._y,a._z, b._x,b._y,b._z, c._x,c._y,c._z, x,y,z)>0.0; }
ra = Geometry.leftOfPlane(pa,pb,pc,pd); rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("0 leftOfPlane: "+String.format("%26.18e",ra)); ra = Geometry.leftOfPlane(pa,pb,pc,pd); rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("+ leftOfPlane: "+String.format("%26.18e",ra)); ra = Geometry.leftOfPlane(pa,pb,pc,pd); rf = Geometry.leftOfPlaneFast(pa,pb,pc,pd); trace("- leftOfPlane: "+String.format("%26.18e",ra));
/** * Determines whether this face is visible from the specified point. * This face is visible if the point lies strictly right of the oriented * plane ABC of this face. * @param x the x coordinate of the point. * @param y the y coordinate of the point. * @param z the z coordinate of the point. * @return true, if visible; false, otherwise. */ public boolean isVisibleFromPoint(double x, double y, double z) { return Geometry.leftOfPlane( _a._x,_a._y,_a._z, _b._x,_b._y,_b._z, _c._x,_c._y,_c._z, x,y,z)<0.0; }
for (nplane=0; sw.time()<maxtime; nplane+=niter) { for (int iter=0; iter<niter; ++iter) { Geometry.leftOfPlane(xa,ya,za,xb,yb,zb,xc,yc,zc,xd,yd,zd);
/** * 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. * @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 leftOfPlane( double[] pa, double[] pb, double[] pc, double[] pd) { return leftOfPlane( 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. * @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 leftOfPlane( float[] pa, float[] pb, float[] pc, float[] pd) { return leftOfPlane( pa[0],pa[1],pa[2], pb[0],pb[1],pb[2], pc[0],pc[1],pc[2], pd[0],pd[1],pd[2]); }
double bds = bdx*bdx+bdy*bdy+bdz*bdz; double cds = cdx*cdx+cdy*cdy+cdz*cdz; double scale = 0.5/leftOfPlane(xa,ya,za,xb,yb,zb,xc,yc,zc,xd,yd,zd); po[0] = xd+(float)(scale*(ads*(bdy*cdz-cdy*bdz)+ bds*(cdy*adz-ady*cdz)+
double bds = bdx*bdx+bdy*bdy+bdz*bdz; double cds = cdx*cdx+cdy*cdy+cdz*cdz; double scale = 0.5/leftOfPlane(xa,ya,za,xb,yb,zb,xc,yc,zc,xd,yd,zd); po[0] = xd+scale*(ads*(bdy*cdz-cdy*bdz)+ bds*(cdy*adz-ady*cdz)+
/** * Creates the first tet in the mesh from four nodes. */ private void createFirstTet() { Check.state(_nnode==4,"exactly four nodes available for first tet"); Node n0 = _nroot; Node n1 = n0._next; Node n2 = n1._next; Node n3 = n2._next; double orient = Geometry.leftOfPlane( n0._x,n0._y,n0._z, n1._x,n1._y,n1._z, n2._x,n2._y,n2._z, n3._x,n3._y,n3._z); if (orient==0.0) { trace("orient="+orient); trace("n0=("+n0._x+","+n0._y+","+n0._z+")"); trace("n1=("+n1._x+","+n1._y+","+n1._z+")"); trace("n2=("+n2._x+","+n2._y+","+n2._z+")"); trace("n3=("+n3._x+","+n3._y+","+n3._z+")"); } Check.state(orient!=0,"four nodes for first tet are not co-planar"); if (orient>0.0) { makeTet(n0,n1,n2,n3); } else { makeTet(n0,n2,n1,n3); } }
double d0 = Geometry.leftOfPlane(x1,y1,z1,x2,y2,z2,x3,y3,z3,x,y,z); if (d0>0.0) { Tet tetNabor = tet.tetNabor(n0); double d1 = Geometry.leftOfPlane(x3,y3,z3,x2,y2,z2,x0,y0,z0,x,y,z); if (d1>0.0) { Tet tetNabor = tet.tetNabor(n1); double d2 = Geometry.leftOfPlane(x3,y3,z3,x0,y0,z0,x1,y1,z1,x,y,z); if (d2>0.0) { Tet tetNabor = tet.tetNabor(n2); double d3 = Geometry.leftOfPlane(x0,y0,z0,x2,y2,z2,x1,y1,z1,x,y,z); if (d3>0.0) { Tet tetNabor = tet.tetNabor(n3);