I have a vector class
class Vector {
public:
double x, y, z;
Vector operator * (Vector& v) {
return Vector(x*v.x, y*v.y, z*v.z);
};
a class Ray
class Ray {
Vector origin, direction;
public:
Ray();
Ray(Vector, Vector);
Vector getRayOrigin() { return origin; }
Vector getRayDirection() { return direction; }
};
and I have a plane class
class Plane {
public:
Vector normal;
double distance;
double Plane::hit(Ray ray) {
Vector rayOrigin = ray.getRayOrigin();
Vector t = normal * rayDirection; // works
Vector tt = normal * ray.getRayOrigin(); // doesn't work
}
I can't figure out why call normal * ray.getRayOrigin()
doesn't work
error: Invalid operands to binary expression 'Vector' and 'Vector'