# HG changeset patch # User Teemu Piippo # Date 1681125677 -10800 # Node ID 171d3f9638a982476a71a53d58a6411657ddcd57 # Parent b2f9ded235a684054a2d9fb293fcdd35240c866f rename some functions diff -r b2f9ded235a6 -r 171d3f9638a9 src/geometry.cpp --- a/src/geometry.cpp Mon Apr 10 14:18:11 2023 +0300 +++ b/src/geometry.cpp Mon Apr 10 14:21:17 2023 +0300 @@ -54,10 +54,10 @@ * @param matrix Matrix to compute * @return scaling vector and unscaled matrix */ -ScalingExtract extractScaling(const glm::mat4& matrix) +unscaled_matrix unscale_matrix(const glm::mat4& matrix) { - ScalingExtract result; - result.scaling = scalingVector(matrix); + unscaled_matrix result; + result.scaling = calculate_matrix_scaling(matrix); result.unscaled = glm::scale(matrix, 1.0f / result.scaling); return result; } @@ -67,7 +67,7 @@ * @param matrix * @return scaling vector */ -glm::vec3 scalingVector(const glm::mat4 matrix) +glm::vec3 calculate_matrix_scaling(const glm::mat4 matrix) { auto component = [](const glm::mat4& matrix, const int i) -> float { diff -r b2f9ded235a6 -r 171d3f9638a9 src/geometry.h --- a/src/geometry.h Mon Apr 10 14:18:11 2023 +0300 +++ b/src/geometry.h Mon Apr 10 14:21:17 2023 +0300 @@ -133,7 +133,7 @@ std::optional linePlaneIntersection( const Line<3>& line, const Plane& plane, const float epsilon = 1e-6f); -glm::vec3 scalingVector(const glm::mat4 matrix); +glm::vec3 calculate_matrix_scaling(const glm::mat4 matrix); LineSegment2D top(const QRectF& rectangle); LineSegment2D bottom(const QRectF& rectangle); LineSegment2D left(const QRectF& rectangle); @@ -142,12 +142,12 @@ convexity_e quadrilateral_convexity(const Quadrilateral& quad); convexity_e polygon_convexity(const std::vector& polygon); Winding winding(const QPolygonF& polygon); -struct ScalingExtract +struct unscaled_matrix { glm::vec3 scaling; glm::mat4 unscaled; }; -ScalingExtract extractScaling(const glm::mat4& matrix); +unscaled_matrix unscale_matrix(const glm::mat4& matrix); struct NPolygon { diff -r b2f9ded235a6 -r 171d3f9638a9 src/main.cpp --- a/src/main.cpp Mon Apr 10 14:18:11 2023 +0300 +++ b/src/main.cpp Mon Apr 10 14:21:17 2023 +0300 @@ -496,7 +496,7 @@ static void set_grid_scale(MainState* state, const float factor) { const glm::mat4 original = state->mainWindow.gridMatrix->value(); - const glm::mat4 unscaled = extractScaling(original).unscaled; + const glm::mat4 unscaled = unscale_matrix(original).unscaled; const glm::mat4 rescaled = factor * unscaled; state->mainWindow.gridMatrix->setValue(rescaled); update_model_grid_matrix(state);