241 |
} |
} |
242 |
}; |
}; |
243 |
|
|
244 |
|
/** Rotate the downwards vector at the origin |
245 |
|
* towards the given point. |
246 |
|
* XXX Document somewhere why! |
247 |
|
* XXX Think: to make more flexible, need separate parent, |
248 |
|
* nadirorigin, nadirpoint, rotatearoundpoint. |
249 |
|
* I.e. the point where the downwards vector needs to face |
250 |
|
* the nadir might not be the center of rotation. |
251 |
|
* This gets quite hairy then. |
252 |
|
*/ |
253 |
|
class NadirOriginCoords { |
254 |
|
public: |
255 |
|
typedef RotateXYCoords BaseTransform; |
256 |
|
enum { NParams = 0 }; |
257 |
|
void derivedParams(CoordSys *super, CoordSys *nadirCS, |
258 |
|
float *params, float *newparams) { |
259 |
|
ZPt origin = super->transform(ZPt(0,0,0)); |
260 |
|
ZPt nadir = nadirCS->transform(ZPt(0,0,0)); |
261 |
|
|
262 |
|
float x = origin.x - nadir.x; |
263 |
|
float y = origin.y - nadir.y; |
264 |
|
float angle = atan2(x, -y); |
265 |
|
|
266 |
|
newparams[0] = angle * 180 / M_PI; |
267 |
|
} |
268 |
|
}; |
269 |
|
|
270 |
/** Translation. |
/** Translation. |
271 |
* Parameter layout: x, y, z |
* Parameter layout: x, y, z |
272 |
*/ |
*/ |
664 |
new TransFactory<TranslateXYZCoords>(), // 6 |
new TransFactory<TranslateXYZCoords>(), // 6 |
665 |
new DerTransFactory<BuoyOnCircleCoords>(), // 7 |
new DerTransFactory<BuoyOnCircleCoords>(), // 7 |
666 |
new NoTransFactory<ConcatCoordSys>(), // 8 |
new NoTransFactory<ConcatCoordSys>(), // 8 |
667 |
|
new DerTransFactory<NadirOriginCoords>(), // 9 |
668 |
0 |
0 |
669 |
}; |
}; |
670 |
|
|