MCPcopy Create free account
hub / github.com/carbonengine/trinity / GetDistanceFit

Function GetDistanceFit

trinity/Eve/SpaceObject/EveSpaceObject2.cpp:2332–2347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2330}
2331
2332static float GetDistanceFit( float minDist, float fitScale, Vector3& vec )
2333{
2334 float length = Length( vec );
2335 float scale = 1 - ( length - minDist ) / fitScale;
2336 float val = 2 * scale - 1.0f;
2337 if( val < 0 )
2338 {
2339 val = 1 - pow( std::abs( val ), 0.5f );
2340 }
2341 else
2342 {
2343 val = pow( std::abs( val ), 0.5f ) + 1;
2344 }
2345 val = val * 0.5f;
2346 return val;
2347}
2348
2349static float GetDirectionFit( const Vector3& v0, const Vector3& v1 )
2350{

Callers 1

GetGoodLocatorIndexMethod · 0.85

Calls 1

LengthFunction · 0.85

Tested by

no test coverage detected