Merge changes Ia2ec4b45,Ied29583a into devel/master
[platform/core/uifw/dali-toolkit.git] / plugins / dali-swig / manual / csharp / Position.cs
1 namespace Dali {
2   namespace CSharp {
3     using System;
4
5     public class Position
6     {
7       public float[] v;
8
9       /**
10        * @brief default constructor
11        *
12        * @since 1.0.0
13        */
14       public Position()
15       {
16         v = new float[3];
17       }
18
19       /**
20        * @brief constructor
21        *
22        * @since 1.0.0
23        * @param [in] a The Position X.
24        * @param [in] b The Position Y.
25        * @param [in] c The Position Z.
26        */
27       public Position(float a, float b, float c):this()
28       {
29         v[0] = a;
30         v[1] = b;
31         v[2] = c;
32       }
33
34       /**
35        * @brief constructor
36        *
37        * @since 1.0.0
38        * @param [in] o The Vector Position X, Y, Z.
39        */
40       public Position(Vector3 o)
41         : this(o.x, o.y, o.z)
42       {
43       }
44
45
46       ///< name "X", type float (Position X value)
47       //@since 1.0.0
48       public float X
49       {
50         get { return v[0]; }
51         set { v[0] = value; }
52       }
53
54       ///< name "Y", type float (Position Y value)
55       //@since 1.0.0
56       public float Y
57       {
58         get { return v[1]; }
59         set { v[1] = value; }
60       }
61
62       ///< name "Z", type float (Position Z value)
63       //@since 1.0.0
64       public float Z
65       {
66         get { return v[2]; }
67         set { v[2] = value; }
68       }
69
70       /**
71        * @brief operator+
72        *
73        * @since 1.0.0
74        * @param [in] l The Position to add.
75        * @param [in] r The Position to add
76        * @return A reference to this
77        */
78       public static Position operator +(Position l, Position r)
79       {
80         return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z);
81       }
82
83       /**
84        * @brief operator-
85        *
86        * @since 1.0.0
87        * @param [in] l The Position to substract.
88        * @param [in] r The Position to substract
89        * @return A reference to this
90        */
91       public static Position operator -(Position l, Position r)
92       {
93         return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z);
94       }
95
96       /**
97        * @brief operator*
98        *
99        * @since 1.0.0
100        * @param [in] a The Position to multiply.
101        * @param [in] b The Position to multiply
102        * @return A reference to this
103        */
104       public static Position operator *(Position a, double b)
105       {
106         return new Position((float)(a.X * b), (float)(a.Y * b), (float)(a.Z * b));
107       }
108
109       /**
110        * @brief operator/
111        *
112        * @since 1.0.0
113        * @param [in] a The Position to divide.
114        * @param [in] b The Position to divide
115        * @return float value of division operation
116        */
117       public static float operator /(Position a, Position b)
118       {
119         return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z));
120       }
121
122       /**
123        * @brief Equals
124        *
125        * @since 1.0.0
126        * @param [in] o The Position object to compare.
127        * @return bool, whether object equal or not
128        */
129       public override bool Equals(object obj)
130       {
131         Position r = obj as Position;
132         if (r == null)
133         {
134           return false;
135         }
136         return this.X == r.X && this.Y == r.Y && this.Z == r.Z;
137       }
138
139       /**
140        * @brief Clone
141        *
142        * @since 1.0.0
143        * @return Position object
144        */
145       public Position Clone()
146       {
147         Position copy = new Position(X, Y, Z);
148         return copy;
149       }
150     }
151   }
152
153 }