Disabling Nuvoton NCT6791D because of fan full speed bug on Asus Z97 WS.
1 // --------------------------------------------------------------------------------------------------------------------
2 // <copyright file="ScreenPoint.cs" company="OxyPlot">
3 // The MIT License (MIT)
5 // Copyright (c) 2012 Oystein Bjorke
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the
9 // "Software"), to deal in the Software without restriction, including
10 // without limitation the rights to use, copy, modify, merge, publish,
11 // distribute, sublicense, and/or sell copies of the Software, and to
12 // permit persons to whom the Software is furnished to do so, subject to
13 // the following conditions:
15 // The above copyright notice and this permission notice shall be included
16 // in all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 // Describes a point defined in the screen coordinate system.
29 // --------------------------------------------------------------------------------------------------------------------
35 /// Represents a point defined in the screen coordinate system.
38 /// The rendering methods transforms <see cref="DataPoint"/>s to <see cref="ScreenPoint"/>s.
40 public struct ScreenPoint
43 /// The undefined point.
45 public static readonly ScreenPoint Undefined = new ScreenPoint(double.NaN, double.NaN);
58 /// Initializes a new instance of the <see cref="ScreenPoint"/> struct.
66 public ScreenPoint(double x, double y)
73 /// Gets or sets the x-coordinate.
75 /// <value> The x-coordinate. </value>
90 /// Gets or sets the y-coordinate.
92 /// <value> The y-coordinate. </value>
107 /// Determines whether the specified point is undefined.
109 /// <param name="point">
113 /// <c>true</c> if the specified point is undefined; otherwise, <c>false</c> .
115 public static bool IsUndefined(ScreenPoint point)
117 return double.IsNaN(point.X) && double.IsNaN(point.Y);
121 /// Gets the distance to the specified point.
123 /// <param name="point">
129 public double DistanceTo(ScreenPoint point)
131 double dx = point.x - this.x;
132 double dy = point.y - this.y;
133 return Math.Sqrt((dx * dx) + (dy * dy));
137 /// Gets the squared distance to the specified point.
139 /// <param name="point">
143 /// The squared distance.
145 public double DistanceToSquared(ScreenPoint point)
147 double dx = point.x - this.x;
148 double dy = point.y - this.y;
149 return (dx * dx) + (dy * dy);
153 /// Returns a <see cref="System.String"/> that represents this instance.
156 /// A <see cref="System.String"/> that represents this instance.
158 public override string ToString()
160 return this.x + " " + this.y;
164 /// Translates a <see cref="ScreenPoint"/> by a <see cref="ScreenVector"/>.
166 /// <param name="p1"> The point. </param>
167 /// <param name="p2"> The vector. </param>
168 /// <returns> The translated point. </returns>
169 public static ScreenPoint operator +(ScreenPoint p1, ScreenVector p2)
171 return new ScreenPoint(p1.x + p2.x, p1.y + p2.y);
175 /// Subtracts a <see cref="ScreenPoint"/> from a <see cref="ScreenPoint"/>
176 /// and returns the result as a <see cref="ScreenVector"/>.
178 /// <param name="p1"> The point on which to perform the subtraction. </param>
179 /// <param name="p2"> The point to subtract from p1. </param>
180 /// <returns> A <see cref="ScreenVector"/> structure that represents the difference between p1 and p2. </returns>
181 public static ScreenVector operator -(ScreenPoint p1, ScreenPoint p2)
183 return new ScreenVector(p1.x - p2.x, p1.y - p2.y);
187 /// Subtracts a <see cref="ScreenVector"/> from a <see cref="ScreenPoint"/>
188 /// and returns the result as a <see cref="ScreenPoint"/>.
190 /// <param name="point"> The point on which to perform the subtraction. </param>
191 /// <param name="vector"> The vector to subtract from p1. </param>
192 /// <returns> A <see cref="ScreenPoint"/> that represents point translated by the negative vector. </returns>
193 public static ScreenPoint operator -(ScreenPoint point, ScreenVector vector)
195 return new ScreenPoint(point.x - vector.x, point.y - vector.y);