Browse Source

Merge pull request #689 from cajun-rat/tidy

Use C++ initialization list
nothinman 10 years ago
parent
commit
15d6116188
1 changed files with 3 additions and 13 deletions
  1. 3
    13
      Marlin/vector_3.cpp

+ 3
- 13
Marlin/vector_3.cpp View File

22
 #ifdef ENABLE_AUTO_BED_LEVELING
22
 #ifdef ENABLE_AUTO_BED_LEVELING
23
 #include "vector_3.h"
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
 vector_3 vector_3::cross(vector_3 left, vector_3 right)
29
 vector_3 vector_3::cross(vector_3 left, vector_3 right)
40
 {
30
 {
62
 
52
 
63
 float vector_3::get_length() 
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
 	return length;
56
 	return length;
67
 }
57
 }
68
  
58
  

Loading…
Cancel
Save