I found in some legacy code I'm dealing with this function (in C++)
Vec3d Minimum()
{
if(this->valid)
{
return minBB;
}
else
{
return NULL;
}
}
where Vec3d is a object that is basically a struct with x,y,z and some operators overloaded (code below).
AFAIK, you can't return a 0 for a user defined object... or is there some automatic cast to zero that I didn't know about? This is just out of curiosity :p
Thanks
class Vec3d
{
public:
double x,y,z;
/// \brief Default constructor initializes x and y to 0
Vec3d();
/** \brief Constructor initializies vector to input parameters x and y and z
*
* \param x Double value that initializes x value of vector
* \param y Double value that initializes y value of vector
* \param z Double value that initializes z value of vector
*/
Vec3d(double x, double y, double z);
/** \brief Copy constructor
*
* \param v Pointer to another vec3i with which to initialize current vec3i
*/
Vec3d(Vec3d* v);
/**\brief Sets a vector (already instantiated) to the input parameters (x,y,z)
*
* \param x Double value that initializes x value of vector
* \param y Double value that initializes y value of vector
* \param z Double value that initializes z value of vector
*
* This method is just so you can change the value of an already instantiated vector
*/
void set(double xi, double yi, double zi);
const Vec3d operator -(const Vec3d &other) const;
const Vec3d operator +(const Vec3d &other) const;
const Vec3d operator *(const double num) const;
const double operator *(const Vec3d &other) const;
const Vec3d operator /(const double num) const;
double magnitude();
};