Home | Develop | Download | Contact
test_regionrect_create.cpp
1
21#include <Pds/Ra>
22#include <cstdio>
23
24int main(void)
25{
26 Pds::Matrix A(12);
29 Pds::RegionRect R1(3,3,8,8);
30 Pds::RegionRect R2(5,5,8,8);
31 Pds::RegionRect R(5,4,2,2);
32
33 R0.Print("R0:\t");
34 R1.Print("R1:\t");
35 R2.Print("R2:\t");
36 R.Print("R:\t");
37
38 if(R.IsInside(R1)) std::cout<<"R is inside R1"<<std::endl;
39 else std::cout<<"R is not inside R1"<<std::endl;
40
41 if(R.IsInside(R2)) std::cout<<"R is inside R2"<<std::endl;
42 else std::cout<<"R is not inside R2"<<std::endl;
43
44
45 if(R1.IsInside(A)) std::cout<<"R1 is inside A"<<std::endl;
46 else std::cout<<"R1 is not inside A"<<std::endl;
47
48 if(R2.IsInside(A)) std::cout<<"R2 is inside A"<<std::endl;
49 else std::cout<<"R2 is not inside A"<<std::endl;
50
51 if(R1.IsInside(B)) std::cout<<"R1 is inside B"<<std::endl;
52 else std::cout<<"R1 is not inside B"<<std::endl;
53
54 if(R2.IsInside(B)) std::cout<<"R2 is inside B"<<std::endl;
55 else std::cout<<"R2 is not inside B"<<std::endl;
56
57 std::cout<<std::endl;
58
59 std::cout<<"R=R1.Intersection(R2);"<<std::endl;
60 R=R1.Intersection(R2);
61 R.Print("R:\t");
62
63 std::cout<<std::endl;
64
65 std::cout<<"R.LoadString(\"1 2 3 4\");"<<std::endl;
66 R.LoadString("1 2 3 4");
67 R.Print("R:\t");
68
69 std::cout<<std::endl;
70
71 std::cout<<"R.LoadString(\"4 3 2\\t1\");"<<std::endl;
72 R.LoadString("4 3 2\t1");
73 R.Print("R:\t");
74
75 std::cout<<std::endl;
76
77 FILE *fd=fopen("data_region.txt","w");
78 R0.FilePrint(fd);
79 R1.FilePrint(fd);
80 R2.FilePrint(fd);
81 fclose(fd);
82
83 fd=fopen("data_region.txt","r");
84 while(feof(fd)==0)
85 {
86 R.FileScan(fd);
87 R.Print("R:\t");
88 }
89 fclose(fd);
90
91 return 0;
92}
La clase tipo Array . Esta clase genera una agrupación de 2 datos. Para usar incluir Pds/Array.
Definition: Array.hpp:71
La clase tipo Pds::Matrix . Esta clase genera una matriz de Nlin lineas y Ncol columnas....
Definition: Matrix.hpp:96
La estructura tipo Pds::RegionRect . Esta estructura genera una region. Para usar incluir <Pds/Region...
Definition: RegionRect.hpp:64
double R2(const Pds::Matrix &A, const Pds::Matrix &B)
Calcula el coeficiente de determinación o .
int FilePrint(FILE *fd) const
Imprime en un FILE la variable Pds::RegionRect.
void Print(std::string str="") const
Muestra en pantalla el contenido de Pds::RegionRect, elementos separados por tabulador.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed