I have the following code
#pragma once
#include "material.h"
#include "../Math/vector.h"
#include <cmath>
class LambertianMaterial : public Material
{
public:
LambertianMaterial(Vector rho);
Vector brdf(Vector wi) const
{
return mRho / M_PI; // Error here
}
private:
Vector mRho;
};
In the line corresponding to the return statement of brdf I am getting the following error
Invalid operands to binary expression ('const Vector' and 'double')
In the class vector I have declared the operator/
like
Vector operator/(const float a);
I was thinking of redefining the method to
friend Vector operator/(const Vector& v, const float& a);
Is this a good way of doing it or is there a way so that the current definition of the operator accounts for the const Vector
case?