Skip to content

Commit 5628fdf

Browse files
author
alexeev-dev
committed
refactor/feat: improve physics/kinematics
1 parent 00da670 commit 5628fdf

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

include/libnumerixpp/physics/kinematics.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,18 @@ namespace physics::kinematics {
120120
double time) -> double;
121121

122122
/**
123-
* @brief Calculates the speed of rectilinear motion.
123+
* @brief Calculates the speed of rectilinear motion.
124124
*
125125
* To calculate speed, you can use the formula V0 + a * t, where v is speed, t is time.
126126
*
127-
* @param[in] end_speed The end speed
128-
* @param[in] acceleration The acceleration
129-
* @param[in] time The time
127+
* @param[in] end_speed The end speed
128+
* @param[in] acceleration The acceleration
129+
* @param[in] time The time
130130
*
131-
* @return The speed of rectilinear motion.
131+
* @return The speed of rectilinear motion.
132132
*/
133-
auto calculate_speed_of_rectilinear_motion(double end_speed, double acceleration, double time) -> double;
133+
auto calculate_speed_of_rectilinear_motion(double end_speed, double acceleration,
134+
double time) -> double;
134135
} // namespace physics::kinematics
135136

136137
#endif // LIBNUMERIXPP_PHYSICS_KINEMATICS_HPP

src/computerscience/core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace computerscience {
6060
}
6161

6262
auto convert_binary_to_hexadecimal(std::string &binary) -> std::string {
63-
int decimal = convert_binary_to_decimal(binary);
63+
int const decimal = convert_binary_to_decimal(binary);
6464
std::string hexadecimal = convert_decimal_to_hexadecimal(decimal);
6565

6666
return hexadecimal;

src/physics/kinematics.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ namespace physics::kinematics {
2929
return acceleration;
3030
}
3131

32-
auto calculate_speed_of_rectilinear_motion(double end_speed, double acceleration, double time) -> double {
33-
double speed = end_speed + acceleration * time;
32+
auto calculate_speed_of_rectilinear_motion(double end_speed, double acceleration,
33+
double time) -> double {
34+
double const speed = end_speed + acceleration * time;
3435

3536
return speed;
3637
}

test/source/libnumerixpp_test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
#include <catch2/catch_test_macros.hpp>
33
#include <vector>
4-
#include <iostream>
54

65
#include "libnumerixpp/computerscience/core.hpp"
76
#include "libnumerixpp/mathematics/core.hpp"
@@ -16,13 +15,15 @@ TEST_CASE("Check physics module", "[physics]") {
1615

1716
auto path = physics::kinematics::calculate_path(speed, time);
1817

19-
REQUIRE(physics::kinematics::calculate_acceleration_of_rectilinear_motion(10.0, 15.0, 3) == 1.66666666666666674);
18+
REQUIRE(physics::kinematics::calculate_acceleration_of_rectilinear_motion(10.0, 15.0, 3) ==
19+
1.66666666666666674);
2020
REQUIRE(path == 50.0);
2121
REQUIRE(physics::kinematics::calculate_speed(path, time) == 10.0);
2222
REQUIRE(physics::kinematics::calculate_path(speed, time) == path);
2323
REQUIRE(physics::kinematics::calculate_time(path, speed) == time);
2424
REQUIRE(physics::kinematics::calculate_final_velocity(10.0, 10.0, 10.0) == 110.0);
2525
REQUIRE(physics::kinematics::calculate_final_position(10.0, 10.0, 10.0, 10.0) == 610.0);
26+
REQUIRE(physics::kinematics::calculate_speed_of_rectilinear_motion(10.0, 5.0, 5.0) == 35.0);
2627
}
2728

2829
TEST_CASE("Check mathematics-quadratic", "[mathematics-quadratic]") {

0 commit comments

Comments
 (0)