1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
void Vecteur::load(FILE* fp){
double nb;
if(fscanf(fp, "(%lf,", &nb) == 0) return;
p_x = nb;
if(fscanf(fp, " %lf,", &nb) == 0) return;
p_y = nb;
if(fscanf(fp, " %lf)", &nb) == 0) return;
p_z = nb;
}
bool Vecteur::initString(const char * str){
if(str == NULL) return false;
if(sscanf(str,"(%lf,%lf,%lf)",&p_x,&p_y,&p_z) == 0){
if(sscanf(str,"(%lf,%lf)",&p_x,&p_y) == 0){
if(sscanf(str,"(%lf)",&p_x) == 0){
return false;
}else return true;
}else return true;
}else return true;
}
|