2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
22 /// The Point3D is a struct that defines a 3D point.
24 /// <since_tizen> preview </since_tizen>
25 public struct Point3D : IEquatable<Point3D>
28 /// The X-coordinate of a 3D point.
30 /// <since_tizen> preview </since_tizen>
34 /// The Y-coordinate of a 3D point.
36 /// <since_tizen> preview </since_tizen>
40 /// The Z-coordinate of a 3D point.
42 /// <since_tizen> preview </since_tizen>
46 /// A human-readable representation of <see cref="Point3D"/>.
48 /// <returns>The string is formatted as "{{X={0} Y={1} Z={2}}}".</returns>
49 /// <since_tizen> preview </since_tizen>
50 public override string ToString()
52 return string.Format("{{X={0} Y={1} Z={2}}}", X, Y, Z);
56 /// <since_tizen> preview </since_tizen>
57 public override int GetHashCode()
61 int hashCode = X.GetHashCode();
62 hashCode = (hashCode * 397) ^ Y.GetHashCode();
63 hashCode = (hashCode * 397) ^ Z.GetHashCode();
69 /// Indicates whether this instance and a specified object are equal.
71 /// <param name="obj">The object to compare with the current instance.</param>
73 /// true if the object and this instance are of the same type and represent the same value,
76 /// <since_tizen> preview </since_tizen>
77 public override bool Equals(object obj)
79 if (!(obj is Point3D))
82 return Equals((Point3D)obj);
86 /// Indicates whether this instance and a <see cref="Point3D"/> object are equal.
88 /// <param name="other">The <see cref="Point3D"/> to compare with the current instance.</param>
90 /// true if the object and this instance are of the same type and represent the same value.
93 /// <since_tizen> preview </since_tizen>
94 public bool Equals(Point3D other)
96 return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
100 /// Whether both <see cref="Point3D"/>s are equal.
102 /// <param name="p1">A <see cref="Point3D"/> on the left hand side.</param>
103 /// <param name="p2">A <see cref="Point3D"/> on the right hand side.</param>
104 /// <returns>True if both <see cref="Point3D"/>s have equal values.</returns>
105 /// <since_tizen> preview </since_tizen>
106 public static bool operator ==(Point3D p1, Point3D p2)
108 return p1.Equals(p2);
112 /// Whether both <see cref="Point3D"/>s are not equal.
114 /// <param name="p1">A <see cref="Point3D"/> on the left hand side.</param>
115 /// <param name="p2">A <see cref="Point3D"/> on the right hand side.</param>
116 /// <returns>True if both <see cref="Point3D"/>s do not have equal values.</returns>
117 /// <since_tizen> preview </since_tizen>
118 public static bool operator !=(Point3D p1, Point3D p2)
120 return !p1.Equals(p2);