コード例 #1
0
ファイル: vector2d.cpp プロジェクト: FlopsKa/libvec2d
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()));
}
コード例 #2
0
ファイル: vector2d.cpp プロジェクト: FlopsKa/libvec2d
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;
}
コード例 #3
0
ファイル: vector2d.cpp プロジェクト: FlopsKa/libvec2d
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;
}
コード例 #4
0
ファイル: vector2d.cpp プロジェクト: FlopsKa/libvec2d
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;
}
コード例 #5
0
ファイル: vector2d.cpp プロジェクト: FlopsKa/libvec2d
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;
}