Browse Source

Fix for bug with improper magnitude returned of earth's field

submodule
T-bone 7 years ago
parent
commit
1409ce82f6
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      Modules/LemmaCore/src/EarthModel.cpp

+ 3
- 3
Modules/LemmaCore/src/EarthModel.cpp View File

@@ -79,7 +79,7 @@ namespace Lemma {
79 79
 		BMag = bfield.norm(  );
80 80
 	    BInc = std::acos (bfield.dot(Vector3r(0,0,1)) / BMag) ;
81 81
 	    BDec = std::acos (bfield.dot(Vector3r(1,0,0)) / BMag) ;
82
-		BFieldUnit = BField.array() / BMag;
82
+		BFieldUnit = BField / BField.norm();
83 83
  	}
84 84
 
85 85
 	void EarthModel::SetMagneticFieldIncDecMag(const Real &inc,
@@ -104,7 +104,7 @@ namespace Lemma {
104 104
 		BField(0) = BMag * cos(BInc*(PI/180.)) * cos(BDec*(PI/180.));
105 105
 		BField(1) = BMag * cos(BInc*(PI/180.)) * sin(BDec*(PI/180.));
106 106
 		BField(2) = BMag * sin(BInc*(PI/180.))  ;
107
-		BFieldUnit = BField.array() / BMag;
107
+		BFieldUnit = BField / BField.norm();
108 108
 	}
109 109
 
110 110
 	// ====================  INQUIRY       =======================
@@ -118,7 +118,7 @@ namespace Lemma {
118 118
 	}
119 119
 
120 120
 	Vector3r EarthModel::GetMagneticFieldUnitVector() {
121
-		return this->BFieldUnit;
121
+		return BField/BField.norm();
122 122
 	}
123 123
 
124 124
 	Real  EarthModel::GetMagneticFieldMagnitude() {

Loading…
Cancel
Save