GeographicLib: LocalCartesian.hpp Source File (original) (raw)

39 private:

41 static const size_t dim_ = 3;

42 static const size_t dim2_ = dim_ * dim_;

44 real _lat0, _lon0, _h0;

45 real _x0, _y0, _z0, _r[dim2_];

46 void IntForward(real lat, real lon, real h, real& x, real& y, real& z,

47 real M[dim2_]) const;

48 void IntReverse(real x, real y, real z, real& lat, real& lon, real& h,

49 real M[dim2_]) const;

50 void MatrixMultiply(real M[dim2_]) const;

51 public:

52

53

54

55

56

57

58

59

60

61

62

63

65 const Geocentric& earth = Geocentric::WGS84())

66 : _earth(earth)

67 { Reset(lat0, lon0, h0); }

68

69

70

71

72

73

74

75

76

80

81

82

83

84

85

86

87

88

89

90 void Reset(real lat0, real lon0, real h0 = 0);

91

92

93

94

95

96

97

98

99

100

101

102

103

104 void Forward(real lat, real lon, real h, real& x, real& y, real& z)

105 const {

106 IntForward(lat, lon, h, x, y, z, NULL);

107 }

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135 void Forward(real lat, real lon, real h, real& x, real& y, real& z,

136 std::vector& M)

137 const {

138 if (M.end() == M.begin() + dim2_) {

139 real t[dim2_];

140 IntForward(lat, lon, h, x, y, z, t);

141 std::copy(t, t + dim2_, M.begin());

142 } else

143 IntForward(lat, lon, h, x, y, z, NULL);

144 }

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161 void Reverse(real x, real y, real z, real& lat, real& lon, real& h)

162 const {

163 IntReverse(x, y, z, lat, lon, h, NULL);

164 }

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191 void Reverse(real x, real y, real z, real& lat, real& lon, real& h,

192 std::vector& M)

193 const {

194 if (M.end() == M.begin() + dim2_) {

195 real t[dim2_];

196 IntReverse(x, y, z, lat, lon, h, t);

197 std::copy(t, t + dim2_, M.begin());

198 } else

199 IntReverse(x, y, z, lat, lon, h, NULL);

200 }

201

202

203

204

205

206

207

209

210

211

212

214

215

216

217

219

220

221

222

223

224

226

227

228

229

230

232

233

234 };