Changeset 9787
- Timestamp:
- Nov 18, 2013, 1:54:40 PM (11 years ago)
- Location:
- code/branches/radarDreiD/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/src/libraries/util/Math.cc
r9779 r9787 213 213 // y_axsis: myorthonormal (points up) 214 214 // z_axsis: myside (points right) 215 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); 216 orxo ut() << "mydirection " << mydirection << endl;217 orxout() << "mydirection.lenght " << mydirection.length() << endl; 218 orxout() << "myorthonormal " << myorthonormal << endl;219 orxout() << "myorthonormal.lenght " << myorthonormal.length() << endl;220 orxout() << "myside " << myside << endl;221 orxout() << "myside.lenght " << myside.length() << endl;222 223 distance = 5 * distance / detectionlimit; // shrink vector on map 215 216 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object 217 218 distance = 4*distance / detectionlimit; // shrink vector on map 219 if(distance.length() > 1.0f) // if object would wander outside of the map 220 { 221 distance = distance / distance.length(); 222 } 223 224 224 225 225 // inverse of the transform matrix … … 245 245 246 246 // coordinate transformation 247 distance.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z; 248 distance.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z; 249 distance.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z; 250 251 // cap vector for map 247 orxonox::Vector3 distanceShip; 248 distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z; 249 distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z; 250 distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z; 251 252 // cap vector for map if its to long 252 253 //distance.x = clamp<float>(distance.x, -detectionlimit/5, detectionlimit/5); 253 254 //distance.y = clamp<float>(distance.y, -detectionlimit/5, detectionlimit/5); … … 257 258 258 259 // project vector for the rotated 3DMap on screen 259 float xcoordinate = distance.z;260 float ycoordinate = distance.y;261 262 //float xcoordinate = distance.z; // z; cause z direction is to the side263 //float ycoordinate = distance.x*sin(mapangle)+distance.y*cos(mapangle);// -; cause on screen y coordinate points down260 //float xcoordinate = distance.z; 261 //float ycoordinate = distance.y; 262 263 float xcoordinate = distanceShip.z; // z; cause z direction is to the side 264 float ycoordinate = distanceShip.x*sin(mapangle)+distanceShip.y*cos(mapangle);// -; cause on screen y coordinate points down 264 265 return orxonox::Vector2(xcoordinate , ycoordinate); 265 266 } -
code/branches/radarDreiD/src/modules/overlays/hud/HUDRadar.cc
r9779 r9787 171 171 //Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition()); 172 172 Vector2 coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_); 173 if(coord.y < 0) 174 { 175 orxonox::ColourValue color = it->second->getColour(); 176 color.a = 0.5f; 177 it->second->setColour(color); 178 } 179 173 180 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 174 181 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
Note: See TracChangeset
for help on using the changeset viewer.