Changeset 1343
- Timestamp:
- May 21, 2008, 4:41:13 PM (17 years ago)
- Location:
- code/branches/hud3/src/orxonox/hud
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.cc
r1342 r1343 69 69 initialOrth_ = Vector3(0.0, 0.0, 1.0); 70 70 currentOrth_ = initialOrth_; 71 plane = Plane(currentDir_, shipPos_); 71 72 72 73 setMetricsMode(Ogre::GMM_PIXELS); … … 92 93 currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_; // according to beni.... 93 94 currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_; 95 plane = Plane(currentDir_, shipPos_); 94 96 95 97 RadarObject* ro = firstRadarObject_; … … 141 143 142 144 float RadarOverlayElement::calcPhi(RadarObject* obj){ 143 return(acos((currentOrth_.dotProduct(firstRadarObject_->pos_ - shipPos_))/ 144 ((firstRadarObject_->pos_ - shipPos_).length()*currentOrth_.length()))); 145 // project difference vector on our plane... 146 Ogre::Vector3 proj = plane.projectVector(obj->pos_ - shipPos_); 147 // ...and find out the angle 148 return(acos((currentOrth_.dotProduct(proj))/ 149 (currentOrth_.length()*proj.length()))); 145 150 } 146 151 -
code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h
r1339 r1343 72 72 Vector3 currentOrth_; 73 73 Vector3 shipPos_; // position of ship 74 Ogre::Plane plane; // plane perpendicular to dir 74 75 75 76 RadarObject* firstRadarObject_; // start of linked list
Note: See TracChangeset
for help on using the changeset viewer.