summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorTwistedTwigleg <beard.noah@gmail.com>2017-08-11 15:10:05 -0400
committerRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-16 17:22:23 +0200
commit00f6c859282bb4dab3f6b4f6c20c44222221ebe9 (patch)
treeab3d2bae1ce8e9661480535a6442c94e5aeafd83 /core/math
parentb1ecaaa22b8dd87a75db414cb84ad0f60d5d4cef (diff)
Synchronize parameter names in definition and declaration
Fixes #10244.
Diffstat (limited to 'core/math')
-rw-r--r--core/math/math_2d.cpp16
-rw-r--r--core/math/math_2d.h32
-rw-r--r--core/math/rect3.h42
-rw-r--r--core/math/vector3.h22
4 files changed, 56 insertions, 56 deletions
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index 52e240ed47..956cfe5258 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -281,22 +281,22 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector2 Vector2::slide(const Vector2 &p_n) const {
+Vector2 Vector2::slide(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector2 Vector2::bounce(const Vector2 &p_n) const {
- return -reflect(p_n);
+Vector2 Vector2::bounce(const Vector2 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector2 Vector2::reflect(const Vector2 &p_n) const {
+Vector2 Vector2::reflect(const Vector2 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector2());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index b679371e03..963b5efc43 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -107,9 +107,9 @@ struct Vector2 {
Vector2 cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
- Vector2 slide(const Vector2 &p_vec) const;
- Vector2 bounce(const Vector2 &p_vec) const;
- Vector2 reflect(const Vector2 &p_vec) const;
+ Vector2 slide(const Vector2 &p_normal) const;
+ Vector2 bounce(const Vector2 &p_normal) const;
+ Vector2 reflect(const Vector2 &p_normal) const;
Vector2 operator+(const Vector2 &p_v) const;
void operator+=(const Vector2 &p_v);
@@ -621,9 +621,9 @@ struct Transform2D {
void affine_invert();
Transform2D affine_inverse() const;
- void set_rotation(real_t p_phi);
+ void set_rotation(real_t p_rot);
real_t get_rotation() const;
- _FORCE_INLINE_ void set_rotation_and_scale(real_t p_phi, const Size2 &p_scale);
+ _FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
void rotate(real_t p_phi);
void scale(const Size2 &p_scale);
@@ -660,8 +660,8 @@ struct Transform2D {
_FORCE_INLINE_ Vector2 basis_xform_inv(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform(const Vector2 &p_vec) const;
_FORCE_INLINE_ Vector2 xform_inv(const Vector2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform(const Rect2 &p_vec) const;
- _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_vec) const;
+ _FORCE_INLINE_ Rect2 xform(const Rect2 &p_rect) const;
+ _FORCE_INLINE_ Rect2 xform_inv(const Rect2 &p_rect) const;
operator String() const;
@@ -833,25 +833,25 @@ next4:
return true;
}
-Vector2 Transform2D::basis_xform(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v));
+ tdotx(p_vec),
+ tdoty(p_vec));
}
-Vector2 Transform2D::basis_xform_inv(const Vector2 &v) const {
+Vector2 Transform2D::basis_xform_inv(const Vector2 &p_vec) const {
return Vector2(
- elements[0].dot(v),
- elements[1].dot(v));
+ elements[0].dot(p_vec),
+ elements[1].dot(p_vec));
}
-Vector2 Transform2D::xform(const Vector2 &v) const {
+Vector2 Transform2D::xform(const Vector2 &p_vec) const {
return Vector2(
- tdotx(v),
- tdoty(v)) +
+ tdotx(p_vec),
+ tdoty(p_vec)) +
elements[2];
}
Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const {
diff --git a/core/math/rect3.h b/core/math/rect3.h
index e5d7462009..7c971f5ac7 100644
--- a/core/math/rect3.h
+++ b/core/math/rect3.h
@@ -72,9 +72,9 @@ public:
Rect3 intersection(const Rect3 &p_aabb) const; ///get box where two intersect, empty if no intersection occurs
bool intersects_segment(const Vector3 &p_from, const Vector3 &p_to, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
bool intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3 *r_clip = NULL, Vector3 *r_normal = NULL) const;
- _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &from, const Vector3 &p_dir, real_t t0, real_t t1) const;
+ _FORCE_INLINE_ bool smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const;
- _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_plane, int p_plane_count) const;
+ _FORCE_INLINE_ bool intersects_convex_shape(const Plane *p_planes, int p_plane_count) const;
bool intersects_plane(const Plane &p_plane) const;
_FORCE_INLINE_ bool has_point(const Vector3 &p_point) const;
@@ -326,27 +326,27 @@ inline real_t Rect3::get_shortest_axis_size() const {
return max_size;
}
-bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t t0, real_t t1) const {
+bool Rect3::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real_t t0, real_t t1) const {
- real_t divx = 1.0 / dir.x;
- real_t divy = 1.0 / dir.y;
- real_t divz = 1.0 / dir.z;
+ real_t divx = 1.0 / p_dir.x;
+ real_t divy = 1.0 / p_dir.y;
+ real_t divz = 1.0 / p_dir.z;
Vector3 upbound = position + size;
real_t tmin, tmax, tymin, tymax, tzmin, tzmax;
- if (dir.x >= 0) {
- tmin = (position.x - from.x) * divx;
- tmax = (upbound.x - from.x) * divx;
+ if (p_dir.x >= 0) {
+ tmin = (position.x - p_from.x) * divx;
+ tmax = (upbound.x - p_from.x) * divx;
} else {
- tmin = (upbound.x - from.x) * divx;
- tmax = (position.x - from.x) * divx;
+ tmin = (upbound.x - p_from.x) * divx;
+ tmax = (position.x - p_from.x) * divx;
}
- if (dir.y >= 0) {
- tymin = (position.y - from.y) * divy;
- tymax = (upbound.y - from.y) * divy;
+ if (p_dir.y >= 0) {
+ tymin = (position.y - p_from.y) * divy;
+ tymax = (upbound.y - p_from.y) * divy;
} else {
- tymin = (upbound.y - from.y) * divy;
- tymax = (position.y - from.y) * divy;
+ tymin = (upbound.y - p_from.y) * divy;
+ tymax = (position.y - p_from.y) * divy;
}
if ((tmin > tymax) || (tymin > tmax))
return false;
@@ -354,12 +354,12 @@ bool Rect3::smits_intersect_ray(const Vector3 &from, const Vector3 &dir, real_t
tmin = tymin;
if (tymax < tmax)
tmax = tymax;
- if (dir.z >= 0) {
- tzmin = (position.z - from.z) * divz;
- tzmax = (upbound.z - from.z) * divz;
+ if (p_dir.z >= 0) {
+ tzmin = (position.z - p_from.z) * divz;
+ tzmax = (upbound.z - p_from.z) * divz;
} else {
- tzmin = (upbound.z - from.z) * divz;
- tzmax = (position.z - from.z) * divz;
+ tzmin = (upbound.z - p_from.z) * divz;
+ tzmax = (position.z - p_from.z) * divz;
}
if ((tmin > tzmax) || (tzmin > tmax))
return false;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 6a7974681e..c58a86fbdb 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -108,9 +108,9 @@ struct Vector3 {
_FORCE_INLINE_ real_t angle_to(const Vector3 &p_b) const;
- _FORCE_INLINE_ Vector3 slide(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_vec) const;
- _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_vec) const;
+ _FORCE_INLINE_ Vector3 slide(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_normal) const;
+ _FORCE_INLINE_ Vector3 reflect(const Vector3 &p_normal) const;
/* Operators */
@@ -410,22 +410,22 @@ void Vector3::zero() {
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
-Vector3 Vector3::slide(const Vector3 &p_n) const {
+Vector3 Vector3::slide(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return *this - p_n * this->dot(p_n);
+ return *this - p_normal * this->dot(p_normal);
}
-Vector3 Vector3::bounce(const Vector3 &p_n) const {
- return -reflect(p_n);
+Vector3 Vector3::bounce(const Vector3 &p_normal) const {
+ return -reflect(p_normal);
}
-Vector3 Vector3::reflect(const Vector3 &p_n) const {
+Vector3 Vector3::reflect(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+ ERR_FAIL_COND_V(p_normal.is_normalized() == false, Vector3());
#endif
- return 2.0 * p_n * this->dot(p_n) - *this;
+ return 2.0 * p_normal * this->dot(p_normal) - *this;
}
#endif