00001 package commandline.ImageStuff.Topology; 00002 00003 import commandline.debuggingCode.Debug; 00004 00010 public class ConvexAndNormDependent_ConnectionCriterium extends 00011 ImageDependent_ConnectionCriterium { 00012 00013 private ConvexAndNormDependent_ConnectionCriterium(int NORM){ 00014 super(NORM); 00015 } 00016 00017 static ConnectieCriterium getInstance(int NORM){ 00018 if(theInstance!=null && NORM==theInstance.getNORM()){return theInstance;} 00019 // if(!Debug.DISTIBUTION && Debug.DEBUG) Debug.print("ImageDependent_ConnectionCriterium is made with norm:" + NormPakket.getNameForNorm(NORM)); 00020 return new ConvexAndNormDependent_ConnectionCriterium(NORM); 00021 } 00022 00023 public int getType(){ 00024 return ConnectionCriteriumSelector.CONVEX_CONNECTION_CRITERIUM; 00025 } 00026 00027 00028 public GenericTriangleTesselation besteConnectie(TriangleTesselationSet t){ 00029 00030 DistanceBasket basket_best=getErrorBasket(t.getTesselation(TriangleTesselationSet.ENUM[0])); 00031 DistanceBasket tempbasket; 00032 float error=basket_best.getTotalTesselationError(NORM); 00033 float error_temp=0; 00034 int selectie=TriangleTesselationSet.ENUM[0]; 00035 00036 for (int k=1;k!=TriangleTesselationSet.ENUM.length;k++){ // connecties 1 .. 3 00037 GenericTriangleTesselation tes=t.getTesselation(TriangleTesselationSet.ENUM[k]); 00038 if(tes.isConvex()){ // test if the tesselation is convex 00039 tempbasket=getErrorBasket(tes); 00040 error_temp=tempbasket.getTotalTesselationError(NORM); 00041 if(error_temp<error){ 00042 if(Debug.DEBUG_CONVEXITY) Debug.print("convex tesselation found with error smaller than subdivision connectivity"); 00043 error=error_temp; 00044 selectie=TriangleTesselationSet.ENUM[k]; 00045 basket_best=tempbasket; 00046 } 00047 }else{if(Debug.DEBUG_CONVEXITY) Debug.print("no convex tesselation + [" + TriangleTesselationSet.ENUM[k]+"]");} 00048 } 00049 00050 00051 return t.getTesselation(selectie); 00052 } 00053 00054 public String getInformation(){ 00055 return "convex and smallest L_p norm"; 00056 } 00057 }
1.5.5