aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/AI.cpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-11 13:18:59 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-11 13:18:59 +0100
commit405bf73b273c7b9a6574d77b4a034d9588c9af1b (patch)
tree4f25ed279519c47d665bcaaaa399962c4fbd7408 /src/crepe/api/AI.cpp
parent543dc375228b520605bb099bc95a23918f75e9f8 (diff)
Removed magic numbers
Diffstat (limited to 'src/crepe/api/AI.cpp')
-rw-r--r--src/crepe/api/AI.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/crepe/api/AI.cpp b/src/crepe/api/AI.cpp
index 472550b..34e1438 100644
--- a/src/crepe/api/AI.cpp
+++ b/src/crepe/api/AI.cpp
@@ -13,10 +13,10 @@ void AI::make_circle_path(float radius, const vec2 & center, float start_angle,
}
// The step size is determined by the radius (step size is in radians)
- float step = 400.0f / radius;
- // Force at least 16 steps (in case of a small radius)
- if (step > 2 * M_PI / 16) {
- step = 2 * M_PI / 16;
+ float step = RADIUS_TO_STEP / radius;
+ // Force at least MIN_STEP steps (in case of a small radius)
+ if (step > 2 * M_PI / MIN_STEP) {
+ step = 2 * M_PI / MIN_STEP;
}
// The path node distance is determined by the step size and the radius
path_node_distance = radius * step * 0.75f;
@@ -42,10 +42,10 @@ void AI::make_oval_path(float radius_x, float radius_y, const vec2 & center, flo
float max_radius = std::max(radius_x, radius_y);
// The step size is determined by the radius (step size is in radians)
- float step = 400.0f / max_radius;
- // Force at least 16 steps (in case of a small radius)
- if (step > 2 * M_PI / 16) {
- step = 2 * M_PI / 16;
+ float step = RADIUS_TO_STEP / max_radius;
+ // Force at least MIN_STEP steps (in case of a small radius)
+ if (step > 2 * M_PI / MIN_STEP) {
+ step = 2 * M_PI / MIN_STEP;
}
// The path node distance is determined by the step size and the radius
path_node_distance = max_radius * step * 0.75f;