00001 package Algorithms; 00002 00003 import debuggingCode.Debug; 00004 import Encoder.EncoderEdge; 00005 import ImageStuff.*; 00006 00007 public class RicoSingleton { 00008 00012 private float euclidischelengte; 00016 private float hoogte; 00020 private float rico_edge; 00024 private float rico_normale; 00025 private static RicoSingleton instance; 00026 00027 private RicoSingleton(GenericEdge e,boolean USE_FUNCTION_VALUE) { 00028 euclidischelengte=0; hoogte=0; rico_edge=0; rico_normale=0; 00029 init(e,USE_FUNCTION_VALUE); 00030 } 00031 00032 private void init(GenericEdge e,boolean USE_FUNCTION_VALUE){ 00033 calculateRicoNormalOn(e,USE_FUNCTION_VALUE); 00034 } 00035 00036 private float calculateRicoNormalOn(GenericEdge e,boolean USE_FUNCTION_VALUE){ 00037 euclidischelengte= e.getEuclidischeLengte(); 00038 if(USE_FUNCTION_VALUE){ 00039 hoogte=Image.getInstance().getPuntOpEnty(e.getEind()).getZ()-Image.getInstance().getPuntOpEnty(e.getBegin()).getZ(); 00040 } 00041 else{ 00042 hoogte=e.getEind().getZ()-e.getBegin().getZ(); 00043 } 00044 rico_edge=hoogte/euclidischelengte; 00045 rico_normale=-euclidischelengte/hoogte; 00046 return rico_normale; 00047 } 00048 00049 public float getRicoEdge(){ 00050 return this.rico_edge; 00051 } 00052 00053 public float getRicoNormale(){ 00054 return this.rico_normale; 00055 } 00056 00057 public static RicoSingleton getInstance(GenericEdge e,boolean USE_FUNCTION_VALUE){ 00058 if(instance!=null){instance.init(e,USE_FUNCTION_VALUE);return instance;} 00059 instance= new RicoSingleton(e,USE_FUNCTION_VALUE); 00060 if(Debug.DEBUG && Debug.DEBUG_RICOSINGLETON) {Debug.print("Creatie van RicoSingleton");} 00061 return instance; 00062 } 00063 }
1.5.5