Procházet zdrojové kódy

Merge pull request #689 from cajun-rat/tidy

Use C++ initialization list
nothinman před 10 roky
rodič
revize
15d6116188
1 změnil soubory, kde provedl 3 přidání a 13 odebrání
  1. 3
    13
      Marlin/vector_3.cpp

+ 3
- 13
Marlin/vector_3.cpp Zobrazit soubor

@@ -22,19 +22,9 @@
22 22
 #ifdef ENABLE_AUTO_BED_LEVELING
23 23
 #include "vector_3.h"
24 24
 
25
-vector_3::vector_3()
26
-{
27
-  this->x = 0;
28
-  this->y = 0;
29
-  this->z = 0;
30
-}
25
+vector_3::vector_3() : x(0), y(0), z(0) { }
31 26
 
32
-vector_3::vector_3(float x, float y, float z)
33
-{
34
-	this->x = x;
35
-	this->y = y;
36
-	this->z = z;
37
-}
27
+vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { }
38 28
 
39 29
 vector_3 vector_3::cross(vector_3 left, vector_3 right)
40 30
 {
@@ -62,7 +52,7 @@ vector_3 vector_3::get_normal()
62 52
 
63 53
 float vector_3::get_length() 
64 54
 {
65
-        float length = sqrt((x * x) + (y * y) + (z * z));
55
+	float length = sqrt((x * x) + (y * y) + (z * z));
66 56
 	return length;
67 57
 }
68 58
  

Loading…
Zrušit
Uložit