Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/bezierTrack/src/coordinates.cc @ 3105

Last change on this file since 3105 was 3023, checked in by bensch, 20 years ago

orxonox/branches/bezierTrack: just an idea of how the new Coordinate-System might look like. Many things have to be done here too.

File size: 1.6 KB
Line 
1
2#include "coordinates.h"
3
4void Coordinate::setCoord (Coord coord, COORD_TYPE cType)
5{
6  setPosition (coord.position, cType);
7  setRotation (coord.rotation, cType);
8}
9
10void Coordinate::setPosition (Vector position, COORD_TYPE cType)
11{
12  if (cType == WORLD)
13    worldCoord.position = position;
14
15  else if (cType == TRACK)
16    worldCoord.position = position; // set it like (position + world::get_instance->track->getPosition(WORLD));
17
18  else if (cType == LOCAL)
19    worldCoord.position = Vector (0,0,0); // have to think about this one.... if it makes sense at all.
20}
21
22void Coordinate::setRotation (Quaternion rotation, COORD_TYPE cType)
23{
24  if (cType == WORLD)
25    worldCoord.rotation = rotation;
26  else if (cType == TRACK)
27    worldCoord.rotation = rotation; // it like (rotation * world::get_instance->track->getRotation(WORLD));
28  else if (cType == LOCAL)
29    worldCoord.rotation = Quaternion();
30}
31
32Coord Coordinate::getCoord (COORD_TYPE cType) const
33{
34  Coord tmpCoord;
35  tmpCoord.position = getPosition (cType);
36  tmpCoord.rotation = getRotation (cType);
37}
38
39Vector Coordinate::getPosition (COORD_TYPE cType) const
40{
41
42  if (cType == WORLD)
43    return worldCoord.position;
44  else if (cType == TRACK)
45    return worldCoord.position; // should be like (WorldCoord - world::get_instance->track->getPosition(WORLD));
46  else if (cType == LOCAL)
47    return Vector (0,0,0);
48
49}
50
51Quaternion Coordinate::getRotation (COORD_TYPE cType) const
52{
53
54  if (cType == WORLD)
55    return worldCoord.rotation;
56  else if (cType == TRACK)
57    return worldCoord.rotation; // should be like (WorldCoord - world::get_instance->track->getRotation(WORLD));
58  else if (cType == LOCAL)
59    return Quaternion ();
60
61}
62
Note: See TracBrowser for help on using the repository browser.