Class MonitorHelpers
- Namespace
- Whim
- Assembly
- Whim.dll
Helper methods for converting between the coordinate systems.
public static class MonitorHelpers
- Inheritance
-
MonitorHelpers
- Inherited Members
Methods
NormalizeAbsolutePoint(IRectangle<int>, IPoint<int>, bool)
Converts the
point from the system's coordinate system to the unit square,
where the unit square is the monitor's working area, accounting for the origin of the monitor.
This is good for converting absolute positions.public static IPoint<double> NormalizeAbsolutePoint(this IRectangle<int> monitor, IPoint<int> point, bool respectSign = false)
Parameters
monitorIRectangle<int>pointIPoint<int>- The point to translate, in the system's coordinate system.
respectSignbool- Whether to respect the sign. For example, values in [-infinity, 0] will become [-1, 0].
Returns
NormalizeDeltaPoint(IRectangle<int>, IPoint<int>)
Converts the
point from the system's coordinate system to the unit square,
where the unit square is the monitor's working area, ignoring the origin of the monitor.
This is good for converting deltas.public static IPoint<double> NormalizeDeltaPoint(this IRectangle<int> monitor, IPoint<int> point)
Parameters
monitorIRectangle<int>pointIPoint<int>
Returns
NormalizeRectangle(IRectangle<int>, IRectangle<int>)
Converts the
rectangle from the unit square to the
monitor's coordinate system. The rectangle is clamped to the monitor's bounds.public static IRectangle<double> NormalizeRectangle(this IRectangle<int> monitor, IRectangle<int> rectangle)
Parameters
monitorIRectangle<int>rectangleIRectangle<int>- The point to translate.
Returns
- IRectangle<double>
- The converted point, where x and y are in the range [0, 1].
ToMonitor(IRectangle<int>, IRectangle<double>)
Converts the
rectangle from the unit square to the
monitor's coordinate system.public static IRectangle<int> ToMonitor(this IRectangle<int> monitor, IRectangle<double> rectangle)
Parameters
monitorIRectangle<int>rectangleIRectangle<double>- The rectangle to translate.
Returns
- IRectangle<int>
- The converted rectangle.