Changeset 1286
- Timestamp:
- May 15, 2008, 3:49:49 PM (17 years ago)
- Location:
- code/branches/hud3/src/orxonox/hud
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc
r1283 r1286 50 50 51 51 void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){ 52 53 52 54 53 int dirX, dirY, dirZ; //flying direction 54 int ortX, ortY, ortZ; //orthogonal direction 55 int dX, dY, dZ; //distance between main ship and the object 56 int vecX, vecY, vecZ; //vector product dir X ort 57 double alpha; //defines the radius in the radar 58 double beta; //defines the angle in the radar 59 bool right; //checks whether the object is on the right side (since cos is not bijective) 55 dirX_ = 1; 56 dirY_ = 0; 57 dirZ_ = 0; 60 58 61 dirX = 1;62 dirY= 0;63 dirZ = 0;59 ortX_ = 0; 60 ortY_ = 0; 61 ortZ_ = 1; 64 62 65 ortX= 0;66 ortY= 0;67 ortZ =1;63 dX_ = 0; 64 dY_ = 0; 65 dZ_ = -1; 68 66 69 dX = 0; 70 dY = 2; 71 dZ = 0; 67 alpha_ = acos((dirX_*dX_+dirY_*dY_+dirZ_*dZ_)/(sqrt(pow(dX_,2)+pow(dY_,2)+pow(dZ_,2))*sqrt(pow(dirX_,2)+pow(dirY_,2)+pow(dirZ_,2)))); 68 beta_ = acos((ortX_*dX_+ortY_*dY_+ortZ_*dZ_)/(sqrt(pow(dX_,2)+pow(dY_,2)+pow(dZ_,2))*sqrt(pow(ortX_,2)+pow(ortY_,2)+pow(ortZ_,2)))); 69 vecX_ = dirY_*ortZ_ - dirZ_*ortY_; 70 vecY_ = dirZ_*ortX_ - dirX_*ortZ_; 71 vecZ_ = dirX_*ortY_ - dirY_*ortX_; 72 72 73 alpha = acos((dirX*dX+dirY*dY+dirZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(dirX,2)+pow(dirY,2)+pow(dirZ,2)))); 74 beta = acos((ortX*dX+ortY*dY+ortZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(ortX,2)+pow(ortY,2)+pow(ortZ,2)))); 75 vecX = dirY*ortZ - dirZ*ortY; 76 vecY = dirZ*ortX - dirX*ortZ; 77 vecZ = dirX*ortY - dirY*ortX; 78 79 if((vecX*dX+vecY*dY+vecZ*dZ)>0){right=true;} 80 else right=false; 73 if((vecX_*dX_+vecY_*dY_+vecZ_*dZ_)>0){right_=true;} 74 else right_=false; 81 75 82 76 setMetricsMode(Ogre::GMM_PIXELS); 83 77 setPosition(left,top); 84 setDimensions(dim -15,dim-20);78 setDimensions(dim,dim); 85 79 setMaterialName("Orxonox/Radar"); 86 80 … … 92 86 container->addChild(point); 93 87 94 if (right ){95 point->setPosition(sin(beta )*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);88 if (right_){ 89 point->setPosition(sin(beta_)*alpha_/3.5*dim/2+dim/2+left-2,-cos(beta_)*alpha_/3.5*dim/2+dim/2+top-2); 96 90 point->setMaterialName("Orxonox/RedPoint"); 97 91 point->setDimensions(5,5); … … 100 94 101 95 else { 102 point->setPosition(-sin(beta )*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);96 point->setPosition(-sin(beta_)*alpha_/3.5*dim/2+dim/2+left-2,-cos(beta_)*alpha_/3.5*dim/2+dim/2+top-2); 103 97 point->setMaterialName("Orxonox/RedPoint"); 104 98 point->setDimensions(5,5); 105 99 point->setMetricsMode(Ogre::GMM_PIXELS); 106 100 } 107 108 109 110 111 } 101 } 102 103 void RadarOverlayElement::setMainShipPosition(int dirX, dirY, dirZ, ortX, ortY, ortZ){ 104 dirX_=dirX; 105 dirY_=dirY; 106 dirZ_=dirZ; 107 ortX_=ortX; 108 ortY_=ortY; 109 ortZ_=ortZ; 110 } 111 112 113 112 114 } 113 115 -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc~
r1283 r1286 50 50 51 51 void RadarOverlayElement::initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container){ 52 53 52 54 53 int dirX, dirY, dirZ; //flying direction 54 int ortX, ortY, ortZ; //orthogonal direction 55 int dX, dY, dZ; //distance between main ship and the object 56 int vecX, vecY, vecZ; //vector product dir X ort 57 double alpha; //defines the radius in the radar 58 double beta; //defines the angle in the radar 59 bool right; //checks whether the object is on the right side (since cos is not bijective) 55 dirX_ = 1; 56 dirY_ = 0; 57 dirZ_ = 0; 60 58 61 dirX = 1;62 dirY= 0;63 dirZ = 0;59 ortX_ = 0; 60 ortY_ = 0; 61 ortZ_ = 1; 64 62 65 ortX= 0;66 ortY= 0;67 ortZ =1;63 dX_ = 0; 64 dY_ = 0; 65 dZ_ = -1; 68 66 69 dX = 2; 70 dY = 0; 71 dZ = 0; 67 alpha_ = acos((dirX_*dX_+dirY_*dY_+dirZ_*dZ_)/(sqrt(pow(dX_,2)+pow(dY_,2)+pow(dZ_,2))*sqrt(pow(dirX_,2)+pow(dirY_,2)+pow(dirZ_,2)))); 68 beta_ = acos((ortX_*dX_+ortY_*dY_+ortZ_*dZ_)/(sqrt(pow(dX_,2)+pow(dY_,2)+pow(dZ_,2))*sqrt(pow(ortX_,2)+pow(ortY_,2)+pow(ortZ_,2)))); 69 vecX_ = dirY_*ortZ_ - dirZ_*ortY_; 70 vecY_ = dirZ_*ortX_ - dirX_*ortZ_; 71 vecZ_ = dirX_*ortY_ - dirY_*ortX_; 72 72 73 alpha = acos((dirX*dX+dirY*dY+dirZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(dirX,2)+pow(dirY,2)+pow(dirZ,2)))); 74 beta = acos((ortX*dX+ortY*dY+ortZ*dZ)/(sqrt(pow(dX,2)+pow(dY,2)+pow(dZ,2))*sqrt(pow(ortX,2)+pow(ortY,2)+pow(ortZ,2)))); 75 vecX = dirY*ortZ - dirZ*ortY; 76 vecY = dirZ*ortX - dirX*ortZ; 77 vecZ = dirX*ortY - dirY*ortX; 78 79 if((vecX*dX+vecY*dY+vecZ*dZ)>0){right=true;} 80 else right=false; 73 if((vecX_*dX_+vecY_*dY_+vecZ_*dZ_)>0){right_=true;} 74 else right_=false; 81 75 82 76 setMetricsMode(Ogre::GMM_PIXELS); 83 77 setPosition(left,top); 84 setDimensions(dim -15,dim-20);78 setDimensions(dim,dim); 85 79 setMaterialName("Orxonox/Radar"); 86 80 … … 92 86 container->addChild(point); 93 87 94 if (right ){95 point->setPosition(sin(beta )*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);88 if (right_){ 89 point->setPosition(sin(beta_)*alpha_/3.5*dim/2+dim/2+left-2,-cos(beta_)*alpha_/3.5*dim/2+dim/2+top-2); 96 90 point->setMaterialName("Orxonox/RedPoint"); 97 91 point->setDimensions(5,5); … … 100 94 101 95 else { 102 point->setPosition(-sin(beta )*alpha/3.14*dim/2+dim/2,-cos(beta)*alpha/3.14*dim/2+dim/2);96 point->setPosition(-sin(beta_)*alpha_/3.5*dim/2+dim/2+left-2,-cos(beta_)*alpha_/3.5*dim/2+dim/2+top-2); 103 97 point->setMaterialName("Orxonox/RedPoint"); 104 98 point->setDimensions(5,5); 105 99 point->setMetricsMode(Ogre::GMM_PIXELS); 106 100 } 107 108 109 110 111 } 101 } 102 103 void setMainShipPosition(int dirX, dirY, dirZ, ortX, ortY, ortZ){ 104 dirX_=dirX; 105 dirY_=dirY; 106 dirZ_=dirZ; 107 ortX_=ortX; 108 ortY_=ortY; 109 ortZ_=ortZ; 110 } 111 112 113 112 114 } 113 115 -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h
r1283 r1286 43 43 { 44 44 private: 45 int number_; 46 45 46 PanelOverlayElement* point[100]; 47 48 int dirX_, dirY_, dirZ_; //flying direction 49 int ortX_, ortY_, ortZ_; //orthogonal direction 50 int dX_, dY_, dZ_; //distance between main ship and the object 51 int vecX_, vecY_, vecZ_; //vector product dir X ort 52 double alpha_; //defines the radius in the radar 53 double beta_; //defines the angle in the radar 54 bool right_; //checks whether the object is on the right side (since cos is not bijective) 55 56 static int ID = 0; 47 57 48 58 public: … … 53 63 54 64 void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container); 65 void setMainShipPosition(int dirX, dirY, dirZ, ortX, ortY, ortZ); 66 67 int newShip(int X, int Y, int Z); 68 69 void resetShip(int shipID, int Y, int Z); 55 70 }; 56 71 } -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h~
r1283 r1286 32 32 #include <string.h> 33 33 #include <OgreOverlayElement.h> 34 #include <OgrePanelOverlayElement.h> 35 34 36 #include <OgrePrerequisites.h> 35 37 #include "../OrxonoxPrereqs.h" … … 41 43 { 42 44 private: 43 int number_; 44 45 46 PanelOverlayElement* point[100]; 47 48 int dirX_, dirY_, dirZ_; //flying direction 49 int ortX_, ortY_, ortZ_; //orthogonal direction 50 int dX_, dY_, dZ_; //distance between main ship and the object 51 int vecX_, vecY_, vecZ_; //vector product dir X ort 52 double alpha_; //defines the radius in the radar 53 double beta_; //defines the angle in the radar 54 bool right_; //checks whether the object is on the right side (since cos is not bijective) 55 56 static int ID; 45 57 46 58 public: … … 51 63 52 64 void initRadarOverlayElement(Real left, Real top, int dim, Ogre::OverlayContainer* container); 65 void setMainShipPosition(int dirX, dirY, dirZ, ortX, ortY, ortZ); 66 67 int newShip(int X, int Y, int Z); 68 69 void resetShip(int shipID, int Y, int Z); 53 70 }; 54 71 }
Note: See TracChangeset
for help on using the changeset viewer.