Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/old.bezierTrack/src/coordinates.h @ 3461

Last change on this file since 3461 was 3028, checked in by bensch, 20 years ago

orxonox/branches/bezierTrack: now Camera follows Path. heavy cleanUp of not used stuff like elyptical Camera and so on…

File size: 2.6 KB
Line 
1/*!
2    \file coordinates.h
3    \brief Basic coordinate system definitions
4*/ 
5
6#ifndef COORDINATES_H
7#define COORDINATES_H
8
9#include "vector.h"
10
11class Track;
12
13//! Coordinates relative to track
14/**
15  This identifies the position of an object on the track system
16*/
17typedef struct
18{
19  unsigned long part;   //!< ID of the track part the object is on
20  Track* track;         //!< This is the current Track to which the Entity belongs to
21  float dist;           //!< The distance that has already been traveled on the track
22  Vector pos;           //!< The position relative to the offset marked by the distance already covered - this is mostly for user interaction/control
23  Quaternion rot;       //!< The direction the object is heading (relative to track direction)
24} Location;
25
26//! Absolute coordinates
27/**
28  This is used to store the position of a object in the rendered coordinate system
29*/
30typedef struct
31{
32  Vector pos;              //!< Absolute x/y/z coordinates
33  Quaternion rot;          //!< Absolute orientation
34} Placement;
35
36
37///////////////////////////////////////////////////////////////////
38////////  NEW COORDINATES, because the old ones were a bit fuzy  //
39///////////////////////////////////////////////////////////////////
40enum COORD_TYPE {WORLD, TRACK, LOCAL};
41
42typedef struct
43{
44  Vector position;
45  Quaternion rotation;
46} Coord;
47
48//! A class to handle coordinates of Objects.
49class Coordinate
50{
51 private:
52  Coord worldCoord;
53
54 public:
55
56  void setCoord (Coord coordinate, COORD_TYPE cType);
57  void setPosition (Vector position, COORD_TYPE cType);
58  void setRotation (Quaternion rotation, COORD_TYPE cType);
59
60  void move (Vector, COORD_TYPE cType); // just move a Object
61
62  Coord getCoord (COORD_TYPE cType) const; 
63  Vector getPosition (COORD_TYPE cType) const; 
64  Quaternion getRotation (COORD_TYPE cType) const; 
65};
66
67
68
69
70
71//! World coordinates:
72/**
73   Absolute coordinates in 3D-space are defined as the coordinates, an Entity has in respect to the absolute Zero point
74*/
75typedef struct
76{
77  Vector position;  //!< absolute position of the Object (the one opengl has to know)
78  Quaternion rot;   //!< absolute rotation
79} WorldCoord;
80
81typedef struct
82{
83  Vector position;  //!< The Vector from the current Path-Position to the Entity. (worldCoord->position - track->worldCoord->position)
84  Quaternion rot;   //!< rotation an entity has to the track.
85} TrackCoord;
86
87typedef struct
88{
89  Vector position;  //!< the coordinate to the object itself. This shoud be 0 for an entity. (can be used for explosions on the ship, shoot and so on.)
90  Quaternion rot;   //!< the Rotation of an object itself. (to easily shoot in different directions)
91} LocalCoord;
92
93#endif
Note: See TracBrowser for help on using the repository browser.