struct vect{
float x,y,z;
vect(float xx, float yy, float zz){
x=xx;
y=yy;
z=zz;
}
vect(){
x=0;
y=0;
z=0;
}
void normalize(){
float len = sqrt(x*x + y*y + z*z);
x = x/len;
y = y/len;
z = z/len;
}
vect operator-(const vect &other) const{return vect(x-other.x,y-other.y,z-other.z);}
};
bool tri_plane_x(vect *v1, vect *v2, vect *v3, vect *pos, float s){
//removed unnessecary code
if (vv1 != vv2){
vect dir = v2 - v1; // getting an error on this line
dir.normalize();
float d = (pos->x - v1->x)/dir.x;
hy[c] = d * dir.y + v1->y;
hz[c] = d * dir.z + v1->z;
c++;
}
//removed unnessecary code
}
do some one know why this wont compile? is there a error in how i overloaded the function or is this because i am subtracting two pointers to a vect?
./exporter/main.cpp:74:19: error: conversion from ‘long int’ to non-scalar type ‘vect’ requested
here is the compiler error related to this line. (didn't include the whole log as it is just a the same error repeated many times in the code)
i can't see where the "long int" comes from... is there another way of overloading when using pointers?