Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 28, 2013, 3:58:20 PM (11 years ago)
Author:
wroennin
Message:

Radar.cc: new function call, detectionlimit 10000→1000 ; Math.cc: new function get3DProjection; HUDTemplates.oxo: new HUDRadar

Location:
code/branches/radarDreiD/src/libraries/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/radarDreiD/src/libraries/util/Math.cc

    r8400 r9719  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    147147
    148148    /**
    149         @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
     149        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1).
    150150        @param myposition My position
    151151        @param mydirection My viewing direction
     
    190190            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
    191191    }
     192
     193
     194    /**
     195            @brief Gets the 2D project vector for the 3D Radar .
     196            @param myposition My position
     197            @param mydirection My viewing direction
     198            @param otherposition The position of the other object
     199            @param mapangle The angle you look on the 3Dmap
     200            @param detectionlimit The limit in which objects are shown on the map
     201            @return The viewing direction
     202
     203            Examples:
     204             -
     205        */
     206    orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit)
     207    {
     208        //
     209        orxonox::Vector3 distance = otherposition - myposition;
     210
     211        // project difference vector on our plane
     212        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
     213
     214        //float projectionlength = projection.length();
     215
     216        // project vector for the rotated 3DMap
     217        float xcoordinate = projection.y/(2*detectionlimit);
     218        float ycoordinate = (projection.x*sin(mapangle)+projection.z*cos(mapangle))/(2*detectionlimit);
     219        return orxonox::Vector2(xcoordinate , ycoordinate);
     220    }
     221
    192222
    193223    /**
  • code/branches/radarDreiD/src/libraries/util/Math.h

    r9550 r9719  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    9292    _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
    9393    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
     94    _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
    9495    _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
    9596
Note: See TracChangeset for help on using the changeset viewer.