Exemple #1
0
float vector2d::operator * (vector2d vec) const {
	/*!	\brief Calculates the scalar product of the object it is called on and the vector in the argument and returns the result.
	 *	\param vec vector2d to multiply with.
	 *	\return The scalar product.
	 */
	return ((_x * vec.getX()) + (_y * vec.getY()));
}
Exemple #2
0
vector2d vector2d::operator - (vector2d vec) const {
	/*!	\brief Substracts the vector from the argument from this vector and returns the result.
	 *	\param vec Vector to substract.
	 *	\return The difference.
	 */
	vector2d tmp(_x - vec.getX(), _y - vec.getY());
	return tmp;
}
Exemple #3
0
vector2d vector2d::operator + (vector2d vec) const {
	/*!	\brief Adds the vector from the argument to this vector and returns the result.
	 *	\param vec Vector to add.
	 *	\return The sum.
	 */
	vector2d tmp(_x + vec.getX(), _y + vec.getY());
	return tmp;
}
Exemple #4
0
vector2d vector2d::operator += (vector2d vec) {
	/*!	\brief Adds the vector in the argument and returns the sum.
	 *	\param vec The vektor2d to add.
	 *	\return The resulting vector2d.
	 */
	 _x += vec.getX();
	 _y += vec.getY();
	 
	 return *this;
}
Exemple #5
0
vector2d vector2d::operator -= (vector2d vec) {
	/*!	\brief Substracts the vector in the argument and returns the result.
	 *	\param vec vektor2d to substract.
	 *
	 *	\return The resulting vector2d.
	 */
	 _x -= vec.getX();
	 _y -= vec.getY();
	 
	 return *this;
}