Geometric Operations#
-
template<typename T>
std::array<Geometry::Point2D<T>, 4> Geometry::create_normalized_quad()# Generate a normalized quad from [0 - 1] in the order top-left, top-right, bot-left, bot-right. This can then be used to e.g. create a homography.
-
template<typename T>
std::array<Geometry::Point2D<T>, 4> Geometry::create_quad(T width, T height)# Generate a quad from [0 - width/height] in the order top-left, top-right, bot-left, bot-right. This can then be used to e.g. create a homography.
-
template<typename T>
void Geometry::Operations::move(std::vector<Point2D<T>> &points, Point2D<T> offset)# Move the points by the given offset in-place
- Parameters:
points – The points to move
offset – The offset to move by
-
template<typename T>
void Geometry::Operations::move(std::vector<Vertex<T>> &vertices, Point2D<T> offset)# Move the vertices by the given offset in-place
- Parameters:
vertices – The vertices to move
offset – The offset to move by
-
template<typename T>
void Geometry::Operations::rotate(std::vector<Point2D<T>> &points, double angle, Point2D<T> center)# Rotate the points around the center by the provided angle in-place.
- Parameters:
points – The points to rotate
angle – The angle to rotate by in radians
center – The center point to rotate about
-
template<typename T>
void Geometry::Operations::rotate(std::vector<Vertex<T>> &vertices, double angle, Point2D<T> center)# Rotate the vertices around the center by the provided angle in-place.
- Parameters:
vertices – The vertices to rotate
angle – The angle to rotate by in radians
center – The center point to rotate about
-
template<typename T>
void Geometry::Operations::scale(std::vector<Point2D<T>> &points, Point2D<T> scalar, Point2D<T> center)# Scale the points around the center by the factor in-place
- Parameters:
points – The points to scale
scalar – The scalar
center – The center point to scale about
-
template<typename T>
void Geometry::Operations::scale(std::vector<Point2D<T>> &points, double factor, Point2D<T> center)# Scale the points around the center by the factor in-place
- Parameters:
points – The points to scale
factor – The scalar factor
center – The center point to scale about
-
template<typename T>
void Geometry::Operations::scale(std::vector<Vertex<T>> &vertices, Point2D<T> scalar, Point2D<T> center)# Scale the vertices around the center by the factor in-place
- Parameters:
vertices – The vertices to scale
scalar – The scalar
center – The center point to scale about
-
template<typename T>
void Geometry::Operations::scale(std::vector<Vertex<T>> &vertices, double factor, Point2D<T> center)# Scale the vertices around the center by the factor in-place
- Parameters:
vertices – The vertices to scale
factor – The scalar factor
center – The center point to scale about
-
template<typename T>
void Geometry::Operations::transform(std::vector<Point2D<T>> &points, const Eigen::Matrix<T, 3, 3> &matrix)# Apply a 3x3 transformation matrix to the points
- Parameters:
points – The points to transform
matrix – The transformation matrix to apply
-
template<typename T>
void Geometry::Operations::transform(std::vector<Vertex<T>> &vertices, const Eigen::Matrix<T, 3, 3> &matrix)# Apply a 3x3 transformation matrix to the vertices
- Parameters:
vertices – The vertices to transform
matrix – The transformation matrix to apply
-
template<typename T>
Eigen::Matrix<T, 3, 3> Geometry::Operations::create_transformation_matrix(Point2D<T> move, T angle, Point2D<T> scale, Point2D<T> pivot)# Create a transformation matrix from the given translation, rotation and scalar factors.
- Parameters:
move – The translation factor
angle – The angle to rotate by, in radians
scale – The scalar factor
pivot – The pivot to perform the transformation around
-
template<typename T>
Eigen::Matrix<T, 3, 3> Geometry::Operations::create_transformation_matrix(T move_x, T move_y, T angle, T scale_x, T scale_y, Point2D<T> pivot)# Create a transformation matrix from the given translation, rotation and scalar factors.
- Parameters:
move_x – The x component to move by
move_y – The y component to move by
angle – The angle to rotate by, in radians
scale_x – The x component of the scale
scale_y – The y component of the scale
pivot – The pivot to perform the transformation around
-
template<typename T>
Eigen::Matrix3d Geometry::Operations::create_homography_matrix(const std::array<Point2D<T>, 4> &source_points, const std::array<Point2D<T>, 4> &destination_points)# Compute a 3x3 homography transformation matrix based on the given source and destination quad
- Parameters:
source_points – The points from which we want to compute the homography
destination_points – The points to which we want to transform.