2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.h
20 * @brief This is the header file for the %FloatVector4 class.
22 * This header file contains the declarations of the %FloatVector4 class.
26 #ifndef _FGRP_FLOAT_VECTOR4_H_
27 #define _FGRP_FLOAT_VECTOR4_H_
29 #include <FBaseObject.h>
31 namespace Tizen { namespace Graphics
37 namespace Tizen { namespace Graphics
41 * @brief This class encapsulates a 4-dimensional vector.
45 * The %FloatVector4 class provides a float precision, four-dimensional vector class.
48 class _OSP_EXPORT_ FloatVector4
49 : public Tizen::Base::Object
53 * This is the default constructor for this class. @n
54 * This constructor initializes the instance to a 4-dimensional zero vector.
61 * This is the copy constructor for the %FloatVector4 class. @n
62 * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of %FloatVector4.
66 * @param[in] rhs An instance of %FloatVector4
68 FloatVector4(const FloatVector4& rhs);
71 * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of %FloatPoint3.
75 * @param[in] point An instance of %FloatPoint3
76 * @remarks The point is converted to normal vector.
78 explicit FloatVector4(const FloatPoint3& point);
81 * This constructor initializes the instance of %FloatVector4 with the attributes of the specified instance of the array.
85 * @param[in] vector The vector with 4 float values
87 explicit FloatVector4(const float vector[4]);
90 * This constructor initializes the instance of %FloatVector4 with floating point numbers for each coordinate.
94 * @param[in] x x component of vector instance
95 * @param[in] y y component of vector instance
96 * @param[in] z z component of vector instance
97 * @param[in] w w component of vector instance
99 FloatVector4(float x, float y, float z, float w);
102 * This destructor overrides Tizen::Base::Object::~Object().
106 virtual ~FloatVector4(void);
109 * Checks whether the current instance and the specified instance of %FloatVector4 are equal.
113 * @return @c true if all members of the current vector instance are equal to the corresponding vector members in the specified instance, @n
115 * @param[in] rhs An instance of %FloatVector4
117 bool operator ==(const FloatVector4& rhs) const;
120 * Checks whether the current instance and the specified instance of %FloatVector4 are not equal.
124 * @return @c true if all vector members of the current instance are not equal to the corresponding vector members in the specified instance, @n
126 * @param[in] rhs An instance of %FloatVector4
128 inline bool operator !=(const FloatVector4& rhs) const
130 return !(*this == rhs);
134 * Assigns the values of the specified instance to the current instance of %FloatVector4.
138 * @return The reference to this instance
139 * @param[in] rhs An instance of %FloatVector4
141 FloatVector4& operator =(const FloatVector4& rhs);
144 * Multiplies the value to each vector members of current instance of %FloatVector4.
148 * @return A new instance of %FloatVector4 containing the resulting value of the operation
149 * @param[in] value A @c float value to multiply
151 FloatVector4 operator *(float value) const;
154 * Divides each vector members of current instance of %FloatVector4 with the specified value.
158 * @return A new instance of %FloatVector4 containing the resulting value of the operation
159 * @param[in] value A @c float value to divide
161 FloatVector4 operator /(float value) const;
164 * Adds the value of the specified instance and the current instance of %FloatVector4.
168 * @return A new instance of %FloatVector4 containing the resulting value of the operation
169 * @param[in] rhs An instance of %FloatVector4
171 FloatVector4 operator +(const FloatVector4& rhs) const;
174 * Subtracts the value of the specified instance from the current instance of %FloatVector4.
178 * @return A new instance of %FloatVector4 containing the resulting value of the operation
179 * @param[in] rhs An instance of %FloatVector4
181 FloatVector4 operator -(const FloatVector4& rhs) const;
184 * Adds the value of the specified instance to the current instance of %FloatVector4.
188 * @return The reference to %FloatVector4 containing the resulting value of the operation
189 * @param[in] rhs An instance of %FloatVector4
191 FloatVector4& operator +=(const FloatVector4& rhs);
194 * Subtracts the value of the specified instance from the current instance of %FloatVector4.
198 * @return The reference to %FloatVector4 containing the resulting value of the operation
199 * @param[in] rhs An instance of %FloatVector4
201 FloatVector4& operator -=(const FloatVector4& rhs);
204 * Calculates the dot product with the specified instance and the current instance of %FloatVector4.
208 * @return The value of the operation.
209 * @param[in] rhs An instance of %FloatVector4
211 float DotProduct(const FloatVector4& rhs) const;
214 * Calculates the dot product with the specified instance and the current instance of %FloatVector4.
218 * @return The value of the operation.
219 * @param[in] rhs An instance of %FloatVector4
221 float operator *(const FloatVector4& rhs) const;
224 * Checks whether the current instance of %FloatVector4 equals the specified instance of %FloatVector4.
228 * @return @c true if the values of the current instance is equal to the value of the specified instance, @n
230 * @param[in] obj An instance of %FloatVector4
231 * @remarks This method overrides Tizen::Base::Object::Equals(). This method uses the values of the Vector components to compare the two instances.
233 virtual bool Equals(const Tizen::Base::Object& obj) const;
236 * Gets the hash value of the current instance of %FloatVector4.
240 * @return The hash value of the current instance
241 * @remarks Two equal instances must return the same hash value. For better performance,
242 * the used hash function must generate a random distribution for all inputs.
244 virtual int GetHashCode(void) const;
247 * Gets the length of the current instance of %FloatVector4.
251 * @return The length of the current instance
253 float GetLength(void) const;
256 * Gets the normal vector of the current instance of %FloatVector4.
260 * @return A new instance of %FloatVector4 containing the resulting value of the operation
262 FloatVector4 GetNormal(void) const;
265 * Normalize the current instance of %FloatVector4.
269 void Normalize(void);
272 * x component of the current instance of %FloatVector4.
279 * y component of the current instance of %FloatVector4.
286 * z component of the current instance of %FloatVector4.
293 * w component of the current instance of %FloatVector4.
300 friend class _FloatVector4Impl;
301 class _FloatVector4Impl* __pImpl;
306 * Gets the instance of %FloatVector4 resulting from the product of the value and the specified instance of %FloatVector4.
310 * @return A new instance of %FloatVector4 containing the resulting value of the operation
311 * @param[in] value A @c float value to multiply
312 * @param[in] rhs An instance of %FloatVector4
314 _OSP_EXPORT_ FloatVector4 operator *(const float& value, const FloatVector4& rhs);
317 * Gets the instance of %FloatVector4 resulting from the divide of the value and the specified instance of %FloatVector4.
321 * @return A new instance of %FloatVector4 containing the resulting value of the operation
322 * @param[in] value A @c float value to divide
323 * @param[in] rhs An instance of %FloatVector4
325 _OSP_EXPORT_ FloatVector4 operator /(const float& value, const FloatVector4& rhs);
327 }} // Tizen::Graphics
329 #endif //_FGRP_FLOAT_VECTOR4_H_