I have just added an opDiv to this class, but it doesn't seem to pick it up. math/vector.d(30): Error: 'this /= mag' is not a scalar, it is a Vector3

I can't see why that is, becuase my opMul works in the same place. Can anyone point out what I have done wrong?

Class Matrix {

    void normalise()
    {
        const float mag = magnitude();
        if (mag) {
            //this.scalarDivide(mag);
            this /= mag; // Not work
            this *= 1/mag; // Does work.

        }
    }

//    Vector3 opBinary(string op)(Vector3 rhs) if (op=='/')
    Vector3 opDiv(float scalar)
    {
        Vector3 v = this;
        v.scalarDivide(scalar);
        return v;
    }

}


Reply via email to