#include "FUiAnim_MathMatrix4.h"
-//sphere coordinates are saved in declared _BoundingVolumeImpl->Min as a center, Max.x as radius
-#define CENTER Min
-#define RADIUS Max.x
+//sphere coordinates are saved in declared _BoundingVolumeImpl->__min as a center, __max.x as radius
+#define CENTER __min
+#define RADIUS __max.x
namespace Tizen{ namespace Ui{ namespace Animations
{
_BoundingVolumeImpl::_BoundingVolumeImpl()
- : State(BOUNDING_VOLUME_STATE_EMPTY)
- , Type(BOUNDING_VOLUME_TYPE_AABB)
- , Min(0.0f)
- , Max(0.0f)
+ : __state(BOUNDING_VOLUME_STATE_EMPTY)
+ , __type(BOUNDING_VOLUME_TYPE_AABB)
+ , __min(0.0f)
+ , __max(0.0f)
{
}
}
+_BoundingVolumeImpl::_BoundingVolumeImpl(const _BoundingVolumeImpl& boundingVolumeImpl)
+ : __state(boundingVolumeImpl.__state)
+ , __type(boundingVolumeImpl.__type)
+ , __min(boundingVolumeImpl.__min)
+ , __max(boundingVolumeImpl.__max)
+{
+}
+
_BoundingVolumeImpl::_BoundingVolumeImpl(const _Math::Vector3& min, const _Math::Vector3& max)
- : State(BOUNDING_VOLUME_STATE_EMPTY)
- , Type(BOUNDING_VOLUME_TYPE_AABB)
- , Min(0.0f)
- , Max(0.0f)
+ : __state(BOUNDING_VOLUME_STATE_EMPTY)
+ , __type(BOUNDING_VOLUME_TYPE_AABB)
+ , __min(0.0f)
+ , __max(0.0f)
{
SysTryReturnVoidResult(NID_UI_ANIM, (min.x <= max.x && min.y <= max.y && min.z <= max.z), E_INVALID_ARG, "Invalid arguments while initializing Bounding Volume Impl max must be higher than min");
//SysTryCatch(NID_UI_ANIM, (min.x <= max.x && min.y <= max.y && min.z <= max.z), , E_INVALID_ARG, "Invalid arguments while initializing Bounding Volume Impl max must be higher than min");
- State = BOUNDING_VOLUME_STATE_VALID;
- Min = min;
- Max = max;
+ __state = BOUNDING_VOLUME_STATE_VALID;
+ __min = min;
+ __max = max;
- if(Min == Max)
+ if(__min == __max)
{
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
//CATCH:
}
_BoundingVolumeImpl::_BoundingVolumeImpl(const _Math::Vector3& center, const float radius)
- : State(BOUNDING_VOLUME_STATE_EMPTY)
- , Type(BOUNDING_VOLUME_TYPE_SPHERE)
- , Min(0.0f)
- , Max(0.0f)
+ : __state(BOUNDING_VOLUME_STATE_EMPTY)
+ , __type(BOUNDING_VOLUME_TYPE_SPHERE)
+ , __min(0.0f)
+ , __max(0.0f)
{
SysTryReturnVoidResult(NID_UI_ANIM, (radius >= 0), E_INVALID_ARG, "Invalid arguments while initializing Bounding Volume Impl radius must be greater than 0");
//SysTryCatch(NID_UI_ANIM, (radius >= 0), , E_INVALID_ARG, "Invalid arguments while initializing Bounding Volume Impl max must be higher than min");
CENTER = center;
RADIUS = radius;
- State = BOUNDING_VOLUME_STATE_VALID;
+ __state = BOUNDING_VOLUME_STATE_VALID;
if(RADIUS == 0)
{
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
//CATCH:
_Math::Vector3
_BoundingVolumeImpl::GetCenter() const
{
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
return _Math::Vector3(
- (Min.x + Max.x) * 0.5f,
- (Min.y + Max.y) * 0.5f,
- (Min.z + Max.z) * 0.5f);
+ (__min.x + __max.x) * 0.5f,
+ (__min.y + __max.y) * 0.5f,
+ (__min.z + __max.z) * 0.5f);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
- return _Math::Vector3(Min);
+ return _Math::Vector3(__min);
break;
default:
{
SysTryReturnResult(NID_UI_ANIM, (min.x <= max.x && min.y <= max.y && min.z <= max.z), E_INVALID_ARG, "Invalid arguments while initializing Bounding Volume Impl max must be higher than min");
- State = BOUNDING_VOLUME_STATE_VALID;
- Min = min;
- Max = max;
+ __state = BOUNDING_VOLUME_STATE_VALID;
+ __min = min;
+ __max = max;
- if(Min == Max)
+ if(__min == __max)
{
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
return E_SUCCESS;
CENTER = center;
RADIUS = radius;
- State = BOUNDING_VOLUME_STATE_VALID;
+ __state = BOUNDING_VOLUME_STATE_VALID;
if(RADIUS == 0)
{
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
return E_SUCCESS;
result
_BoundingVolumeImpl::Get(_Math::Vector3& min, _Math::Vector3& max)
{
- SysTryReturnResult(NID_UI_ANIM, Type == BOUNDING_VOLUME_TYPE_AABB, E_INVALID_ARG, "Invalid arguments while get values of Bounding Volume Impl, type is not BOUNDING_VOLUME_TYPE_AABB");
+ SysTryReturnResult(NID_UI_ANIM, __type == BOUNDING_VOLUME_TYPE_AABB, E_INVALID_ARG, "Invalid arguments while get values of Bounding Volume Impl, type is not BOUNDING_VOLUME_TYPE_AABB");
- min = Min;
- max = Max;
+ min = __min;
+ max = __max;
return E_SUCCESS;
}
result
_BoundingVolumeImpl::Get(_Math::Vector3& center, float& radius)
{
- SysTryReturnResult(NID_UI_ANIM, Type == BOUNDING_VOLUME_TYPE_SPHERE, E_INVALID_ARG, "Invalid arguments while get values of Bounding Volume Impl, type is not BOUNDING_VOLUME_TYPE_AABB");
+ SysTryReturnResult(NID_UI_ANIM, __type == BOUNDING_VOLUME_TYPE_SPHERE, E_INVALID_ARG, "Invalid arguments while get values of Bounding Volume Impl, type is not BOUNDING_VOLUME_TYPE_AABB");
center = CENTER;
radius = RADIUS;
_Math::Vector3
_BoundingVolumeImpl::GetHalfSize() const
{
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
- return _Math::Vector3((Max - Min) * 0.5f);
+ return _Math::Vector3((__max - __min) * 0.5f);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
_Math::Vector3 onePoint;
const float sqrt3 = sqrt(3);
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
- if (volume.State != BOUNDING_VOLUME_STATE_VALID)
+ if (volume.__state != BOUNDING_VOLUME_STATE_VALID)
return E_INVALID_ARG;
- if (State == BOUNDING_VOLUME_STATE_VALID)
+ if (__state == BOUNDING_VOLUME_STATE_VALID)
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - aabb, state valid merge with rhs - aabb
- Merge(volume.Min);
- Merge(volume.Max);
+ Merge(volume.__min);
+ Merge(volume.__max);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - aabb, state valid merge with rhs - sphere
break;
}
}
- else if (State == BOUNDING_VOLUME_STATE_ONE_POINT)
+ else if (__state == BOUNDING_VOLUME_STATE_ONE_POINT)
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - aabb, state one point merge with rhs - aabb
- onePoint = Min;
- Set(volume.Min, volume.Max);
+ onePoint = __min;
+ Set(volume.__min, volume.__max);
Merge(onePoint);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - aabb, state one point merge with rhs - sphere
- onePoint = Min;
+ onePoint = __min;
Set(volume.CENTER - volume.RADIUS * sqrt3, volume.CENTER + volume.RADIUS * sqrt3);
Merge(onePoint);
break;
}
else
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - aabb, state empty merge with rhs - aabb
- Set(volume.Min, volume.Max);
+ Set(volume.__min, volume.__max);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - aabb, state empty merge with rhs - sphere
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
- if (volume.State != BOUNDING_VOLUME_STATE_VALID)
+ if (volume.__state != BOUNDING_VOLUME_STATE_VALID)
return E_INVALID_ARG;
- if (State == BOUNDING_VOLUME_STATE_VALID)
+ if (__state == BOUNDING_VOLUME_STATE_VALID)
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - sphere, state valid merge with rhs - aabb
- Merge(volume.Min);
- Merge(volume.Max);
+ Merge(volume.__min);
+ Merge(volume.__max);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - sphere, state valid merge with rhs - sphere
break;
}
}
- else if (State == BOUNDING_VOLUME_STATE_ONE_POINT)
+ else if (__state == BOUNDING_VOLUME_STATE_ONE_POINT)
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - sphere, state one point merge with rhs - aabb
- Merge(volume.Min);
- Merge(volume.Max);
+ Merge(volume.__min);
+ Merge(volume.__max);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - sphere, state one point merge with rhs - sphere
}
else
{
- switch(volume.Type)
+ switch(volume.__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
//this - sphere, state empty merge with rhs - aabb
- onePoint = volume.Max - volume.Min;
- Set(volume.Min + onePoint/2, onePoint.Length()/2);
+ onePoint = volume.__max - volume.__min;
+ Set(volume.__min + onePoint/2, onePoint.Length()/2);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
//this - sphere, state empty merge with rhs - sphere
{
_Math::Vector3 oldMin;
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
- if (State == BOUNDING_VOLUME_STATE_VALID)
+ if (__state == BOUNDING_VOLUME_STATE_VALID)
{
- Min.SetMin(point);
- Max.SetMax(point);
+ __min.SetMin(point);
+ __max.SetMax(point);
}
- else if (State == BOUNDING_VOLUME_STATE_ONE_POINT)
+ else if (__state == BOUNDING_VOLUME_STATE_ONE_POINT)
{
- Max = point;
- oldMin = Min;
+ __max = point;
+ oldMin = __min;
- Min.SetMin(point);
- Max.SetMax(oldMin);
+ __min.SetMin(point);
+ __max.SetMax(oldMin);
- State = BOUNDING_VOLUME_STATE_VALID;
+ __state = BOUNDING_VOLUME_STATE_VALID;
}
else
{
- Min = point;
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __min = point;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
return E_SUCCESS;
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
- if (State == BOUNDING_VOLUME_STATE_VALID)
+ if (__state == BOUNDING_VOLUME_STATE_VALID)
{
oldMin = point - CENTER;
if(RADIUS < oldMin.Length())
RADIUS = oldMin.Length();
}
}
- else if (State == BOUNDING_VOLUME_STATE_ONE_POINT)
+ else if (__state == BOUNDING_VOLUME_STATE_ONE_POINT)
{
oldMin = point - CENTER;
if(RADIUS < oldMin.Length())
RADIUS = oldMin.Length();
}
- State = BOUNDING_VOLUME_STATE_VALID;
+ __state = BOUNDING_VOLUME_STATE_VALID;
}
else
{
CENTER = point;
- State = BOUNDING_VOLUME_STATE_ONE_POINT;
+ __state = BOUNDING_VOLUME_STATE_ONE_POINT;
}
return E_SUCCESS;
break;
{
_Math::Vector3 translate(world.GetTranslation());
- SysTryReturnResult(NID_UI_ANIM, State == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding box state is not invalid");
+ SysTryReturnResult(NID_UI_ANIM, __state == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding box state is not invalid");
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
- Min += translate;
- Max += translate;
+ __min += translate;
+ __max += translate;
return E_SUCCESS;
break;
result
_BoundingVolumeImpl::Transform(const _Math::Matrix4& world)
{
- SysTryReturnResult(NID_UI_ANIM, State == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding volume state is invalid");
+ SysTryReturnResult(NID_UI_ANIM, __state == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding volume state is invalid");
//for AABB, to allocate variables
- if(Type == BOUNDING_VOLUME_TYPE_AABB)
+ if(__type == BOUNDING_VOLUME_TYPE_AABB)
{
_Math::Vector3 v[] =
{
//far
- _Math::Vector3(Min.x, Max.y, Min.z),
- _Math::Vector3(Max.x, Max.y, Min.z),
- _Math::Vector3(Max.x, Min.y, Min.z),
- _Math::Vector3(Min.x, Min.y, Min.z),
+ _Math::Vector3(__min.x, __max.y, __min.z),
+ _Math::Vector3(__max.x, __max.y, __min.z),
+ _Math::Vector3(__max.x, __min.y, __min.z),
+ _Math::Vector3(__min.x, __min.y, __min.z),
//near
- _Math::Vector3(Min.x, Max.y, Max.z),
- _Math::Vector3(Max.x, Max.y, Max.z),
- _Math::Vector3(Max.x, Min.y, Max.z),
- _Math::Vector3(Min.x, Min.y, Max.z)
+ _Math::Vector3(__min.x, __max.y, __max.z),
+ _Math::Vector3(__max.x, __max.y, __max.z),
+ _Math::Vector3(__max.x, __min.y, __max.z),
+ _Math::Vector3(__min.x, __min.y, __max.z)
};
Reset();
}
}
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
return E_SUCCESS;
void _BoundingVolumeImpl::Reset()
{
- Min = _Math::Vector3();
- Max = _Math::Vector3();
- State = BOUNDING_VOLUME_STATE_EMPTY;
+ __min = _Math::Vector3();
+ __max = _Math::Vector3();
+ __state = BOUNDING_VOLUME_STATE_EMPTY;
}
result _BoundingVolumeImpl::IsBoxTwiceLess(const _BoundingVolumeImpl& box, bool& is)
{
- SysTryReturnResult(NID_UI_ANIM, Type == BOUNDING_VOLUME_TYPE_AABB, E_FAILURE, "Bounding volume type is not invalid (not AABB)");
- SysTryReturnResult(NID_UI_ANIM, box.Type == BOUNDING_VOLUME_TYPE_AABB, E_FAILURE, "Received bounding volume type is not invalid (not AABB)");
- SysTryReturnResult(NID_UI_ANIM, State == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding volume state is not invalid");
- SysTryReturnResult(NID_UI_ANIM, box.State == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Received bounding volume state is not invalid");
+ SysTryReturnResult(NID_UI_ANIM, __type == BOUNDING_VOLUME_TYPE_AABB, E_FAILURE, "Bounding volume type is not invalid (not AABB)");
+ SysTryReturnResult(NID_UI_ANIM, box.__type == BOUNDING_VOLUME_TYPE_AABB, E_FAILURE, "Received bounding volume type is not invalid (not AABB)");
+ SysTryReturnResult(NID_UI_ANIM, __state == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Bounding volume state is not invalid");
+ SysTryReturnResult(NID_UI_ANIM, box.__state == BOUNDING_VOLUME_STATE_VALID, E_FAILURE, "Received bounding volume state is not invalid");
const _Math::Vector3 boxHalf = box.GetHalfSize();
const _Math::Vector3 myQuart = GetHalfSize() / 2.0f;
void _BoundingVolumeImpl::print() const
{
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
- AppLog("min %.3f %.3f %.3f", Min.x, Min.y, Min.z);
- AppLog("max %.3f %.3f %.3f", Max.x, Max.y, Max.z);
+ AppLog("min %.3f %.3f %.3f", __min.x, __min.y, __min.z);
+ AppLog("max %.3f %.3f %.3f", __max.x, __max.y, __max.z);
break;
case BOUNDING_VOLUME_TYPE_SPHERE:
- AppLog("Center %.3f %.3f %.3f, radius %.3f", Min.x, Min.y, Min.z, Max.x);
+ AppLog("Center %.3f %.3f %.3f, radius %.3f", __min.x, __min.y, __min.z, __max.x);
break;
default:
BoundingVolumeState
_BoundingVolumeImpl::GetState() const
{
- return State;
+ return __state;
}
BoundingVolumeType
_BoundingVolumeImpl::GetType() const
{
- return Type;
+ return __type;
}
result
_BoundingVolumeImpl::SetType(BoundingVolumeType newType)
{
- if(Type == newType)
+ if(__type == newType)
{
return E_SUCCESS;
}
_Math::Vector3 min,max;
float r;
- switch(Type)
+ switch(__type)
{
case BOUNDING_VOLUME_TYPE_AABB:
switch(newType)
{
case BOUNDING_VOLUME_TYPE_SPHERE:
//convert aabb to sphere
- min = Min;
- max = Max;
- Min = GetCenter();
- Max.Set(0.0f);
+ min = __min;
+ max = __max;
+ __min = GetCenter();
+ __max.Set(0.0f);
min = (min - max)/2;
- Max.x = min.Length();
- Type = BOUNDING_VOLUME_TYPE_SPHERE;
+ __max.x = min.Length();
+ __type = BOUNDING_VOLUME_TYPE_SPHERE;
break;
default:
{
case BOUNDING_VOLUME_TYPE_AABB:
r = RADIUS;
- Min = GetCenter() - r * sqrt3;
- Max = Min + 2 * r * sqrt3;
- Type = BOUNDING_VOLUME_TYPE_AABB;
+ __min = GetCenter() - r * sqrt3;
+ __max = __min + 2 * r * sqrt3;
+ __type = BOUNDING_VOLUME_TYPE_AABB;
break;
default:
_BoundingVolumeImpl&
_BoundingVolumeImpl::operator =(const _BoundingVolumeImpl& rhs)
{
- Type = rhs.Type;
- State = rhs.State;
- Min = rhs.Min;
- Max = rhs.Max;
+ __type = rhs.__type;
+ __state = rhs.__state;
+ __min = rhs.__min;
+ __max = rhs.__max;
return *this;
}
bool
_BoundingVolumeImpl::operator ==(const _BoundingVolumeImpl& rhs) const
{
- if(Type == rhs.Type && State == rhs.State)
+ if(__type == rhs.__type && __state == rhs.__state)
{
- if(Min == rhs.Min && Max == rhs.Max)
+ if(__min == rhs.__min && __max == rhs.__max)
{
return true;
}
int
_BoundingVolumeImpl::GetHashCode(void) const
{
- return (int)Type * 10000000 + (int)State * 1000000 + Min.x * 100000 + Min.y * 10000 + Min.z * 1000 + Max.x * 100 + Max.y * 10 + Max.z;
+ return (int)__type * 10000000 + (int)__state * 1000000 + __min.x * 100000 + __min.y * 10000 + __min.z * 1000 + __max.x * 100 + __max.y * 10 + __max.z;
}
}}} //namespace Tizen{ namespace Ui{ namespace Animations