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.
45 * @param [in] a The Position X.
46 * @param [in] b The Position Y.
47 * @param [in] c The Position Z.
49 public Position(float a, float b, float c)
60 * @param [in] o The Vector Position X, Y, Z.
62 public Position(Vector3 o)
69 ///< name "X", type float (Position X value)
77 ///< name "Y", type float (Position Y value)
85 ///< name "Z", type float (Position Z value)
97 * @param [in] l The Position to add.
98 * @param [in] r The Position to add
99 * @return A reference to this
101 public static Position operator +(Position l, Position r)
103 return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z);
110 * @param [in] l The Position to substract.
111 * @param [in] r The Position to substract
112 * @return A reference to this
114 public static Position operator -(Position l, Position r)
116 return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z);
123 * @param [in] a The Position to multiply.
124 * @param [in] b The constant to multiply of type double.
125 * @return A reference to this
127 public static Position operator *(Position a, double b)
129 return new Position((int)(a.X * b), (int)(a.Y * b), (int)(a.Z * b));
136 * @param [in] a The Position to divide.
137 * @param [in] b The Position to divide
138 * @return float value of division operation
140 public static float operator /(Position a, Position b)
142 return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z));
149 * @param [in] a The Position object to compare.
150 * @param [in] b The Position object to compare.
151 * @return bool, whether Position are equal or not
153 public static bool operator == (Position a, Position b)
155 return a.X == b.X && a.Y == b.Y && a.Z == b.Z;
162 * @param [in] a The Position object to compare.
163 * @param [in] b The Position object to compare.
164 * @return bool, whether Position are equal or not
166 public static bool operator != (Position a, Position b)
168 return a.X != b.X || a.Y != b.Y || a.Z == b.Z;
175 * @return int, hascode of position
177 public override int GetHashCode()
179 return base.GetHashCode();
186 * @return Position object
188 public Position Clone()
190 Position copy = new Position(X, Y, Z);
194 // User-defined conversion from Position to Vector3
195 public static implicit operator Vector3(Position pos)
197 return new Vector3(pos.x, pos.y, pos.z);
200 public static implicit operator Position(Vector3 vec)
202 return new Position(vec.X, vec.Y, vec.Z);