#include "bbUtilitiesDistance.h" #include "bbUtilitiesPackage.h" namespace bbUtilities { BBTK_ADD_BLACK_BOX_TO_PACKAGE(Utilities,Distance) //BBTK_USER_BLACK_BOX_IMPLEMENTATION(Distance,bbtk::AtomicBlackBox); BBTK_BLACK_BOX_IMPLEMENTATION(Distance,bbtk::AtomicBlackBox); void Distance::Process() { std::string filename = bbGetInputFileNameAxisPoints(); std::string dir = bbGetInputDSDirectory(); std::vector vectx = bbGetInputInX(); std::vector vecty = bbGetInputInY(); std::vector vectz = bbGetInputInZ(); //int vess = bbGetInputVessel(); std::ifstream file; double x0, y0, z0, x1, y1, z1, xps, yps, zps; file.open( filename.c_str() ); if(file.is_open()) { int i=0; std::string line; while(i < 2) { std::getline(file,line); i++; int pos=line.find(" "); int pos2=line.find_last_of(" "); int size=line.size(); std::string xs=line.substr(0,pos); std::string ys=line.substr(pos+1,pos2); std::string zs=line.substr(pos2+1,size); if(i == 1){ x0=atof(xs.c_str()); y0=atof(ys.c_str()); z0=atof(zs.c_str()); }else{ x1=atof(xs.c_str()); y1=atof(ys.c_str()); z1=atof(zs.c_str()); } } file.close(); } std::string temp, num=" ", vessel = "vessel", point = "point", poi=" "; int vess = 1; poi = "S.txt"; num = vess+48; temp = dir+"\\"+vessel+num+"\\"+point+poi; int radio=1; file.open( temp.c_str() ); if(file.is_open()){ std::string line; std::getline(file,line); int pos=line.find(" "); int pos2=line.find_last_of(" "); int size=line.size(); std::string xs=line.substr(0,pos); std::string ys=line.substr(pos+1,pos2); std::string zs=line.substr(pos2+1,size); xps=atof(xs.c_str()); yps=atof(ys.c_str()); zps=atof(zs.c_str()); std::getline(file,line); file.close(); } int sizeX=vectx.size(); int sizeY=vecty.size(); int sizeZ=vectz.size(); if(sizeX==sizeY && sizeX==sizeY && sizeZ==sizeY && sizeX>0 && sizeY>0 && sizeZ>0) { double tempx=vectx[0], tempy=vecty[0], tempz=vectz[0]; //OJO VALIDACION DEL TAMAŅO DE LOS VECTORES for(int i = 0; i < vectx.size()&& tempx!= x1 && tempy!= y1 && tempz!= z1 ; i++){ tempx=vectx[i]; tempy=vecty[i]; tempz=vectz[i]; double dist=sqrt(pow(tempx-xps, 2)+pow(tempy-yps, 2)+pow(tempz-zps, 2)); if(dist > 2.65) { std::cout <<"DISTANCE: " << dist << " POINT: ( " << tempx << ", " << tempy<< ", " << tempz << ")" << std::endl; } } } } void Distance::bbUserSetDefaultValues() { } void Distance::bbUserInitializeProcessing() { } void Distance::bbUserFinalizeProcessing() { } } // EO namespace bbUtilities