Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3304 for code/trunk/src/util


Ignore:
Timestamp:
Jul 18, 2009, 6:23:31 PM (15 years ago)
Author:
rgrieder
Message:

Merged netp6 branch back to the trunk.

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/util/Math.cc

    r3196 r3304  
    136136                return orxonox::Vector2(0, 1);
    137137        }
    138 
    139         float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
    140 
     138       
     139        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
     140        float sin_value = sqrt( 1 - cos_value*cos_value );
     141       
    141142        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    142             return orxonox::Vector2(sin(angle), cos(angle));
    143         else
    144             return orxonox::Vector2(-sin(angle), cos(angle));
     143            return orxonox::Vector2( sin_value, cos_value );
     144        else
     145            return orxonox::Vector2( -sin_value, cos_value );
    145146    }
    146147
     
    175176                return orxonox::Vector2(0, 1);
    176177        }
    177         float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
     178        //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
     179       
     180        float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
     181        float sin_value = sqrt( 1 - cos_value*cos_value );
    178182
    179183        float distancelength = distance.length();
     
    182186
    183187        if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
    184             return orxonox::Vector2(sin(angle) * radius, cos(angle) * radius);
    185         else
    186             return orxonox::Vector2(-sin(angle) * radius, cos(angle) * radius);
     188            return orxonox::Vector2( sin_value * radius, cos_value * radius);
     189        else
     190            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
    187191    }
    188192
  • code/trunk/src/util/Serialise.h

    r3084 r3304  
    408408    template <> inline void loadAndIncrease( const std::string& variable, uint8_t*& mem )
    409409    {
    410         *(std::string*)( &variable ) = std::string((const char *)mem);
     410        *(std::string*)( &variable ) = (const char *)mem;
    411411        mem += variable.length()+1;
    412412    }
     
    414414    template <> inline bool checkEquality( const std::string& variable, uint8_t* mem )
    415415    {
    416         return std::string((const char*)mem)==variable;
     416        //return std::string((const char*)mem)==variable;
     417        return (const char*)mem==variable;
    417418    }
    418419
Note: See TracChangeset for help on using the changeset viewer.