Mon, 10 Apr 2023 14:21:17 +0300
rename some functions
src/geometry.cpp | file | annotate | diff | comparison | revisions | |
src/geometry.h | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions |
--- 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 {
--- 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<glm::vec3> 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<glm::vec3>& 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 {
--- 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);