2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
31 * @param [in] a Width value .
32 * @param [in] b Height value.
34 public Size(float a, float b)
40 * @brief default constructor
51 * @brief constructor with base class object
54 * @param [in] o The Vector2 with Width, Height values.
56 public Size(Vector2 o)
63 * @brief Copy constructor
66 * @param [in] o The Size having Width & Y.
74 ///< name "W", type float (Size Width value)
79 set { width = value; }
82 ///< name "H", type float (Size Height value)
86 get { return height; }
87 set { height = value; }
93 set { width = value; }
98 get { return height; }
99 set { height = value; }
106 * @param [in] l The Size to add.
107 * @param [in] r The Size to add
108 * @return A reference to this
110 public static Size operator +(Size l, Size r)
112 return new Size(l.W + r.W, l.H + r.H);
119 * @param [in] l The Size to substract.
120 * @param [in] r The Size to substract
121 * @return A reference to this
123 public static Size operator -(Size l, Size r)
125 return new Size(l.W - r.W, l.H - r.H);
132 * @param [in] a The Size to multiply
133 * @param [in] b The constant to multiply of type double.
134 * @return A reference to this
136 public static Size operator *(Size a, double b)
138 return new Size((float)(a.W * b), (float)(a.H * b));
145 * @param [in] a The Size to divide.
146 * @param [in] b The Size to divide
147 * @return float of the size division
149 public static float operator /(Size a, Size b)
151 return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H));
158 * @param [in] a The Size object to compare.
159 * @param [in] b The Size object to compare.
160 * @return bool, whether Size are equal or not
162 public static bool operator == (Size a, Size b)
164 return a.W == b.W && a.H == b.H ;
171 * @param [in] a The Size object to compare.
172 * @param [in] b The Size object to compare.
173 * @return bool, whether Size are equal or not
175 public static bool operator != (Size a, Size b)
177 return a.W != b.W || a.H != b.H;
184 * @return int, hascode of Size
186 public override int GetHashCode()
195 * @return returns a copy of Size object
199 Size copy = new Size(W, H);
203 // User-defined conversion from Position to Vector2
204 public static implicit operator Vector2(Size size)
206 return new Vector2(size.width, size.height);
209 public static implicit operator Size(Vector2 vec)
211 return new Size(vec.X, vec.Y);
218 private float height;
221 public Size3D(float a, float b, float c)
235 public Size3D(Vector3 o)
242 public Size3D(Vector2 o)
249 public Size3D(Size3D a)
258 get { return width; }
259 set { width = value; }
264 get { return height; }
265 set { height = value; }
270 get { return depth; }
271 set { depth = value; }
276 get { return width; }
277 set { width = value; }
282 get { return height; }
283 set { height = value; }
288 get { return depth; }
289 set { depth = value; }
294 get { return width; }
295 set { width = value; }
300 get { return height; }
301 set { height = value; }
306 get { return depth; }
307 set { depth = value; }
310 // User-defined conversion from Position to Vector3
311 public static implicit operator Vector3(Size3D size)
313 return new Vector3(size.width, size.height, size.depth);
316 public static implicit operator Size3D(Vector3 vec)
318 return new Size3D(vec.X, vec.Y, vec.Z);