cpp_drawing/math/transforms.hpp

37 lines
980 B
C++

#pragma once
#include "vector.hpp"
namespace math
{
/**
* Rotate a point `p` around a center point `center` by `angle` radians.
*
* @param center The center point to rotate around
* @param angle The angle in radians to rotate
* @param p The point to be rotated
* @return The rotated point
*/
Vector RotatePoint(const Vector& center, float angle, const Vector& p);
/**
* Scale a point `p` relative to a center point `center` by a `factor`.
*
* @param center The center point to scale relative to
* @param factor The scaling factor
* @param p The point to be scaled
* @return The scaled point
*/
Vector ScalePoint(const Vector& center, float factor, const Vector& p);
/**
* Rotate an angle by another angle
*
* @param originalAngle The original angle in radians
* @param rotationAngle The angle in radians to rotate by
* @return The new angle in radians in range [0, 2*PI)
*/
float RotateAngle(float originalAngle, float rotationAngle);
} // namespace math