2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FGrpFloatVector4.cpp
20 * @brief This is the implementation for %FloatVector4 class.
23 #include <FGrpFloatVector4.h>
24 #include <FGrpFloatPoint3.h>
25 #include <FBaseFloat.h>
26 #include <FBaseSysLog.h>
29 namespace Tizen { namespace Graphics
31 FloatVector4::FloatVector4(void)
40 FloatVector4::FloatVector4(const FloatVector4& rhs)
49 FloatVector4::FloatVector4(const FloatPoint3& point)
58 FloatVector4::FloatVector4(const float vector[4])
67 FloatVector4::FloatVector4(float x, float y, float z, float w)
76 FloatVector4::~FloatVector4(void)
81 FloatVector4::operator ==(const FloatVector4& rhs) const
88 return (x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w);
92 FloatVector4::operator =(const FloatVector4& rhs)
106 FloatVector4::operator *(float value) const
108 return FloatVector4(x * value, y * value, z * value, w * value);
112 FloatVector4::operator /(float value) const
114 return FloatVector4(x / value, y / value, z / value, w / value);
118 FloatVector4::operator +(const FloatVector4& rhs) const
120 return FloatVector4(x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w);
124 FloatVector4::operator -(const FloatVector4& rhs) const
126 return FloatVector4(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
130 FloatVector4::operator +=(const FloatVector4& rhs)
141 FloatVector4::operator -=(const FloatVector4& rhs)
152 FloatVector4::DotProduct(const FloatVector4& rhs) const
154 return ((x * rhs.x) +
161 FloatVector4::operator *(const FloatVector4& rhs) const
163 return DotProduct(rhs);
167 operator *(const float& value, const FloatVector4& rhs)
173 operator /(const float& value, const FloatVector4& rhs)
179 FloatVector4::Equals(const Tizen::Base::Object& obj) const
181 const FloatVector4* pVector = dynamic_cast <const FloatVector4*>(&obj);
188 return (*this == *pVector);
192 FloatVector4::GetHashCode(void) const
194 return (Tizen::Base::Float::GetHashCode(x) +
195 Tizen::Base::Float::GetHashCode(y) +
196 Tizen::Base::Float::GetHashCode(z) +
197 Tizen::Base::Float::GetHashCode(w));
201 FloatVector4::GetLength(void) const
203 return sqrt((x * x) + (y * y) + (z * z) + (w * w));
207 FloatVector4::GetNormal(void) const
209 float length = GetLength();
211 return (*this / length);
215 FloatVector4::Normalize(void)
217 float length = GetLength();
225 }} // Tizen::Graphics