Revert "[Tizen] Temporary fix, Will be removed later, Fix Emul crash issue"
[platform/core/uifw/dali-core.git] / dali / public-api / math / vector3.cpp
index 9afb55b..2b410d0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/math/quaternion.h>
 
+// EXTERNAL INCLUDES
+#include <math.h>
+#include <ostream>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/math/math-utils.h>
 #include <dali/internal/render/common/performance-monitor.h>
 
-// EXTERNAL INCLUDES
-#include <math.h>
-#include <iostream>
-
 namespace Dali
 {
 using Internal::PerformanceMonitor;
@@ -179,149 +179,4 @@ Vector3 Clamp( const Vector3& v, const float& min, const float& max )
   return result;
 }
 
-Vector3 FitKeepAspectRatio( const Vector3& target, const Vector3& source )
-{
-  float scale = 0.0f;
-
-  if ( fabsf(source.x) > 0.0f )
-  {
-    scale = target.x / source.x;
-  }
-
-  if ( fabsf(source.y) > 0.0f )
-  {
-    if ( scale > Math::MACHINE_EPSILON_1 )
-    {
-      scale =  std::min( scale, target.y / source.y );
-    }
-    else
-    {
-      scale = target.y / source.y;
-    }
-  }
-
-  if ( fabsf(source.z) > 0.0f )
-  {
-    if ( scale > Math::MACHINE_EPSILON_1 )
-    {
-      scale =  std::min( scale, target.z / source.z );
-    }
-    else
-    {
-      scale = target.z / source.z;
-    }
-  }
-
-  if ( scale < Math::MACHINE_EPSILON_1 )
-  {
-    scale = 1.0f;
-  }
-
-  return Vector3( scale, scale, scale );
-}
-
-Vector3 FillKeepAspectRatio( const Vector3& target, const Vector3& source )
-{
-  float scale = 0.0f;
-
-  if ( fabsf(source.x) > 0.0f )
-  {
-    scale = target.x / source.x;
-  }
-
-  if ( fabsf(source.y) > 0.0f )
-  {
-    if ( scale > Math::MACHINE_EPSILON_1 )
-    {
-      scale =  std::max( scale, target.y / source.y );
-    }
-    else
-    {
-      scale = target.y / source.y;
-    }
-  }
-
-  if ( fabsf(source.z) > 0.0f )
-  {
-    if ( scale > Math::MACHINE_EPSILON_1 )
-    {
-      scale =  std::max( scale, target.z / source.z );
-    }
-    else
-    {
-      scale = target.z / source.z;
-    }
-  }
-
-  if ( scale < Math::MACHINE_EPSILON_1 )
-  {
-    scale = 1.0f;
-  }
-
-  return Vector3( scale, scale, scale );
-}
-
-Vector3 FillXYKeepAspectRatio( const Vector3& target, const Vector3& source )
-{
-  float scale = 0.0f;
-
-  if ( fabsf(source.x) > 0.0f )
-  {
-    scale = target.x / source.x;
-  }
-
-  if ( fabsf(source.y) > 0.0f )
-  {
-    if ( scale > Math::MACHINE_EPSILON_1 )
-    {
-      scale =  std::max( scale, target.y / source.y );
-    }
-    else
-    {
-      scale = target.y / source.y;
-    }
-  }
-
-  if ( scale < Math::MACHINE_EPSILON_1 )
-  {
-    scale = 1.0f;
-  }
-
-  return Vector3( scale, scale, scale );
-}
-
-Vector3 ShrinkInsideKeepAspectRatio( const Vector3& target, const Vector3& source )
-{
-  // calculate source size vs target size to see if we need to shrink
-  float widthScale = 1.0f;
-  if( target.width < source.width )
-  {
-    // not enough width, width needs to shrink
-    widthScale = target.width / source.width;
-  }
-  float heightScale = 1.0f;
-  if( target.height < source.height )
-  {
-    // not enough height, height needs to shrink
-    heightScale = target.height / source.height;
-  }
-  float depthScale = 1.0f;
-  if( target.depth < source.depth )
-  {
-    // not enough depth, depth needs to shrink
-    depthScale = target.depth / source.depth;
-  }
-  // use smaller of the scales
-  float scale = std::min( std::min( widthScale, heightScale ), depthScale );
-
-  // check if we need to scale
-  if( scale < 1.0f )
-  {
-    // scale natural size to fit inside
-    return Vector3( scale, scale, scale );
-  }
-  // there is enough space so use source size
-  return Vector3::ONE;
-}
-
 } // namespace Dali