Class Utils
Global utilities and functions.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.Windows.Diagrams.Core.dll
Syntax
public static class Utils
Fields
Epsilon
An infinitesimal value.
Declaration
public const double Epsilon = 1E-06
Field Value
System.Double
|
Methods
ApproximateArc(Point, Point, Double, Double)
Approximates the arc.
Declaration
public static IEnumerable<Point> ApproximateArc(Point topLeft, Point bottomRight, double startAngle, double endAngle)
Parameters
System.Windows.Point
topLeft
The topLeft. |
System.Windows.Point
bottomRight
The bottomRight. |
System.Double
startAngle
The angle in degrees at which the arc starts. |
System.Double
endAngle
The angle in degrees at which the arc ends. |
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
ApproximateBezierCurve(Point[], Int32)
Approximates the Bezier curve as segments represented by a series of points.
Declaration
public static IEnumerable<Point> ApproximateBezierCurve(Point[] bezierPoints, int quality)
Parameters
System.Windows.Point[]
bezierPoints
The Bezier points. |
System.Int32
quality
The quality of the approximation. The greater the value, the more accurate approximation (more approximated points). |
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
ApproximateEllipse(Rect, Double)
Approximates the ellipse defined by the given bounds.
Declaration
public static IList<Point> ApproximateEllipse(this Rect rec, double minSegmentLength = 10)
Parameters
System.Windows.Rect
rec
The bounds of the (not rotated) ellipse. |
System.Double
minSegmentLength
The minimum length an approximating segment should have. |
Returns
System.Collections.Generic.IList<System.Windows.Point>
|
ApproximateRoundedRectangle(Double, Double, Double, Double, Double)
Approximates the rounded rectangle.
Declaration
public static IEnumerable<Point> ApproximateRoundedRectangle(double x, double y, double width, double height, double radius)
Parameters
System.Double
x
The x-coordinate. |
System.Double
y
The y-coordinate. |
System.Double
width
The width. |
System.Double
height
The height. |
System.Double
radius
The radius of the rounding. |
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
ApproximateRoundedRectangle(Rect, Double)
Approximates the rounded rectangle.
Declaration
public static IEnumerable<Point> ApproximateRoundedRectangle(Rect rectangle, double radius)
Parameters
System.Windows.Rect
rectangle
|
System.Double
radius
|
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
ArcConvert(Rect, Double, Double, out Point, out Point, out Boolean, out SweepDirection)
Arcs the convert.
Declaration
public static void ArcConvert(Rect rect, double startAngle, double sweep, out Point startPoint, out Point outsidePoint, out bool largeArc, out SweepDirection dir)
Parameters
System.Windows.Rect
rect
The rec. |
System.Double
startAngle
The start angle. |
System.Double
sweep
The sweep. |
System.Windows.Point
startPoint
The start point. |
System.Windows.Point
outsidePoint
The outside point. |
System.Boolean
largeArc
If set to |
System.Windows.Media.SweepDirection
dir
The direction. |
AreClose(Double, Double)
Checks whether two values are close.
Declaration
public static bool AreClose(double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
AreLinesIntersecting(Point, Point, Point, Point, ref Point)
Returns whether the line (line segments) intersect and returns in the crossingPoint the actual crossing point if they do.
Declaration
public static bool AreLinesIntersecting(Point line1Start, Point line1End, Point line2Start, Point line2End, ref Point crossingPoint)
Parameters
System.Windows.Point
line1Start
The first point of the first line. |
System.Windows.Point
line1End
The second point of the first line. |
System.Windows.Point
line2Start
The first point of the second line. |
System.Windows.Point
line2End
The second point of the second line. |
System.Windows.Point
crossingPoint
The crossing point. |
Returns
System.Boolean
|
BarycentricPercentageFromPoint(Point, Rect)
Returns the barycentric coordinates as percentages with respect to the given rectangle.
Declaration
public static Point BarycentricPercentageFromPoint(Point realPoint, Rect rectangle)
Parameters
System.Windows.Point
realPoint
The real point. |
System.Windows.Rect
rectangle
The rectangle which acts as a barycentric coordinate system. |
Returns
System.Windows.Point
The percentages wrapped in a Point. |
BetweenOrEqual(Double, Double, Double)
Tells you whether the given value sits in the specified interval.
Declaration
public static bool BetweenOrEqual(double value, double lower, double upper)
Parameters
System.Double
value
The value. |
System.Double
lower
The lower. |
System.Double
upper
The upper. |
Returns
System.Boolean
|
CartesianToPolar(Point, Point, ref Double, ref Double)
Converts the Cartesian coordinates to polar coordinates.
Declaration
public static void CartesianToPolar(Point rootPoint, Point otherPoint, ref double angle, ref double rho)
Parameters
System.Windows.Point
rootPoint
|
System.Windows.Point
otherPoint
|
System.Double
angle
|
System.Double
rho
|
Closer(Double, Double, Double)
Given an interval and a value this will output the value which is closer to the given value.
Declaration
public static double Closer(double value, double choice1, double choice2)
Parameters
System.Double
value
|
System.Double
choice1
|
System.Double
choice2
|
Returns
System.Double
|
Closer(Double, Double, Double, out Double, out Double)
Given an interval and a value this will output the value which is closer to the given value.
Declaration
public static void Closer(double value, double choice1, double choice2, out double nearestValue, out double otherValue)
Parameters
System.Double
value
The value. |
System.Double
choice1
The first choice. |
System.Double
choice2
The second choice. |
System.Double
nearestValue
The nearest value. |
System.Double
otherValue
The other value. |
Closer(Point, Point, Point)
Returns the point of the interval which sits the closest to the given point.
Declaration
public static Point Closer(Point point, Point point1, Point point2)
Parameters
System.Windows.Point
point
The point seeking the closes neighbor. |
System.Windows.Point
point1
The first point in the interval. |
System.Windows.Point
point2
The second point in the interval. |
Returns
System.Windows.Point
|
CoerceAngle(Double)
Coerces the given angle. The return angle will be between 0 and 360.
Declaration
public static double CoerceAngle(double angle)
Parameters
System.Double
angle
The angle. |
Returns
System.Double
|
Constrain(Double, Double, Double)
Constrains the specified value to the given interval.
Declaration
public static double Constrain(this double value, double min, double max)
Parameters
System.Double
value
The value to constrain. |
System.Double
min
The min. |
System.Double
max
The max. |
Returns
System.Double
|
Delta(Point, Point)
Returns the vector between the two points.
Declaration
public static Vector Delta(this Point point1, Point point2)
Parameters
System.Windows.Point
point1
The point where the vector starts. |
System.Windows.Point
point2
The points where the vector ends. |
Returns
System.Windows.Vector
|
Determinant(Point, Point)
Determinants the specified point1.
Declaration
public static double Determinant(Point point1, Point point2)
Parameters
System.Windows.Point
point1
The point1. |
System.Windows.Point
point2
The point2. |
Returns
System.Double
|
Distance(Double, Double)
Returns the distance of the point to the origin.
Declaration
public static double Distance(double x, double y)
Parameters
System.Double
x
|
System.Double
y
|
Returns
System.Double
|
DistancePoint(Point, Point, Point)
Calculates the point of the specified line segment which determines the distance from the specified point to the line segment. That is, the perpendicular projection onto the segment.
Declaration
public static Point DistancePoint(Point point, Point lineStart, Point lineEnd)
Parameters
System.Windows.Point
point
The point outside the segment. |
System.Windows.Point
lineStart
The first point defining the segment. |
System.Windows.Point
lineEnd
The second point defining the segment. |
Returns
System.Windows.Point
|
DistanceSquared(Point, Point)
Returns the squared distance between the given points.
Declaration
public static double DistanceSquared(Point point1, Point point2)
Parameters
System.Windows.Point
point1
|
System.Windows.Point
point2
|
Returns
System.Double
|
Dot(Point, Point)
Returns the dot product of the specified points.
Declaration
public static double Dot(Point point1, Point point2)
Parameters
System.Windows.Point
point1
|
System.Windows.Point
point2
|
Returns
System.Double
|
Dot(Vector, Vector)
Returns the dot product of the specified vectors.
Declaration
public static double Dot(Vector vector1, Vector vector2)
Parameters
System.Windows.Vector
vector1
|
System.Windows.Vector
vector2
|
Returns
System.Double
|
DoubleFromMantissaAndExponent(Double, Int32)
Gets a double value from mantissa and exponent.
Declaration
public static double DoubleFromMantissaAndExponent(double value, int exp)
Parameters
System.Double
value
The value. |
System.Int32
exp
The exponential. |
Returns
System.Double
|
EnsureRange(Double, Nullable<Double>, Nullable<Double>)
Ensures the range.
Declaration
public static double EnsureRange(double value, double? min, double? max)
Parameters
System.Double
value
The value. |
System.Nullable<System.Double>
min
The min. |
System.Nullable<System.Double>
max
The max. |
Returns
System.Double
|
FindAngle(Point, Point)
Finds the angle between two points.
Declaration
public static double FindAngle(Point start, Point end)
Parameters
System.Windows.Point
start
|
System.Windows.Point
end
|
Returns
System.Double
|
FindAngle(Point, Point, Point)
Finds the angle between three points.
Declaration
public static double FindAngle(Point firstPoint, Point centralPoint, Point secondPoint)
Parameters
System.Windows.Point
firstPoint
|
System.Windows.Point
centralPoint
|
System.Windows.Point
secondPoint
|
Returns
System.Double
|
FindIntersectionPoint(Rect, Double, Point, Point, GlidingStyle)
Finds the intersection point of a shape and the line segment defined by the point
segmentStart
and segmentEnd
.
Declaration
public static Point FindIntersectionPoint(this Rect rec, double angle, Point segmentStart, Point segmentEnd, GlidingStyle style)
Parameters
System.Windows.Rect
rec
The bounding rectangle of the shape. |
System.Double
angle
The rotation angle. |
System.Windows.Point
segmentStart
The line point which is supposedly inside the shape defined by |
System.Windows.Point
segmentEnd
The other line point which supposedly sits outside the bounds define by |
GlidingStyle
style
The gliding style. |
Returns
System.Windows.Point
|
FindLinesIntersection(Point, Point, Point, Point, Boolean)
Finds the intersection point of the lines defined by the point pairs.
Declaration
public static Point FindLinesIntersection(Point line1Start, Point line1End, Point line2Start, Point line2End, bool acceptNaN = false)
Parameters
System.Windows.Point
line1Start
|
System.Windows.Point
line1End
|
System.Windows.Point
line2Start
|
System.Windows.Point
line2End
|
System.Boolean
acceptNaN
|
Returns
System.Windows.Point
The intersection point. If acceptNaN is |
FindRadian(Point, Point)
Finds the radian between two points.
Declaration
public static double FindRadian(Point start, Point end)
Parameters
System.Windows.Point
start
|
System.Windows.Point
end
|
Returns
System.Double
|
FindRadian(Point, Point, Point)
Finds the radian between three points.
Declaration
public static double FindRadian(Point firstPoint, Point centralPoint, Point secondPoint)
Parameters
System.Windows.Point
firstPoint
|
System.Windows.Point
centralPoint
|
System.Windows.Point
secondPoint
|
Returns
System.Double
|
FromLtrd(Double, Double, Double, Double)
Creates a new rectangle from the left top and right bottom coordinates.
Declaration
[Obsolete("This method will be removed. Use new Rect(new Point(left, top), new Point(right, bottom)).")]
public static Rect FromLtrd(double left, double top, double right, double bottom)
Parameters
System.Double
left
|
System.Double
top
|
System.Double
right
|
System.Double
bottom
|
Returns
System.Windows.Rect
|
GetAssemblyName(Assembly)
Gets the name of the assembly.
Declaration
public static string GetAssemblyName(this Assembly assembly)
Parameters
System.Reflection.Assembly
assembly
The assembly. |
Returns
System.String
|
GetBezierPoint(Collection<Point>, Int32, Double)
Gets the Bezier point at the specified value.
Declaration
public static Point GetBezierPoint(Collection<Point> points, int segment, double value)
Parameters
System.Collections.ObjectModel.Collection<System.Windows.Point>
points
The points. |
System.Int32
segment
The segment. |
System.Double
value
A value in the interval [0,1]. |
Returns
System.Windows.Point
|
GetBottomRightPoint(IEnumerable<Point>)
Gets a point from the maximum X and Y values from the specified points.
Declaration
public static Point GetBottomRightPoint(IEnumerable<Point> points)
Parameters
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
Returns
System.Windows.Point
|
GetBounds(IList<Point>)
Gets the enclosing bounds of the points collection.
Declaration
public static Rect GetBounds(this IList<Point> points)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
The points collection. |
Returns
System.Windows.Rect
|
GetChildElements(XElement)
Gets the only the child elements.
Declaration
public static IEnumerable<XElement> GetChildElements(this XElement element)
Parameters
System.Xml.Linq.XElement
element
The parent element. |
Returns
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>
|
GetEllipsePointAtAngle(Rect, Double)
Returns the point at an angle on the ellipse defined by the specified rectangle.
Declaration
public static Point GetEllipsePointAtAngle(this Rect rect, double angle)
Parameters
System.Windows.Rect
rect
The rect. |
System.Double
angle
The angle in degrees. |
Returns
System.Windows.Point
|
GetEnumValues<T>()
Gets the enumeration values.
Declaration
public static T[] GetEnumValues<T>()
Returns
T[]
|
Type Parameters
T
The type of the enumeration. |
GetNormalizationPoint(IEnumerable<Point>)
Gets the normalization point.
Declaration
public static Point GetNormalizationPoint(this IEnumerable<Point> points)
Parameters
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
Returns
System.Windows.Point
|
GetNormalizedPoints(IEnumerable<Point>)
Gets the normalized points.
Declaration
public static IEnumerable<Point> GetNormalizedPoints(this IEnumerable<Point> points)
Parameters
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
GetProjections(Point, Rect, Point[])
Gets the projected points of the specified point on the given rectangle.
Declaration
public static void GetProjections(Point point, Rect rectangle, Point[] projections)
Parameters
System.Windows.Point
point
|
System.Windows.Rect
rectangle
|
System.Windows.Point[]
projections
|
GetPythagorEqualSide(Double)
Gets the equal sides of a triangle from the Pythagor theorem.
Declaration
public static double GetPythagorEqualSide(double hypotenuse)
Parameters
System.Double
hypotenuse
The hypotenuse. |
Returns
System.Double
|
GetPythagorHypotenuse(Double, Double)
Gets the hypotenuse according to the Pythagoras theorem.
Declaration
public static double GetPythagorHypotenuse(double sideA, double sideB)
Parameters
System.Double
sideA
The first side. |
System.Double
sideB
The second side. |
Returns
System.Double
|
GetTopLeftPoint(IEnumerable<Point>)
Gets a point from the minimum X and Y values from the specified points.
Declaration
public static Point GetTopLeftPoint(IEnumerable<Point> points)
Parameters
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
Returns
System.Windows.Point
|
HasValidArea(Size)
Determines whether [has valid area] [the specified size].
Declaration
public static bool HasValidArea(this Size size)
Parameters
System.Windows.Size
size
The size. |
Returns
System.Boolean
|
Hypotenuse(Double, Double)
Hypotenuses the specified x.
Declaration
public static double Hypotenuse(double x, double y)
Parameters
System.Double
x
The x. |
System.Double
y
The y. |
Returns
System.Double
|
Intersect(Point[])
Determines whether the specified line segments intersect.
Declaration
public static bool Intersect(Point[] points)
Parameters
System.Windows.Point[]
points
|
Returns
System.Boolean
True if the segments intersect, false if not. |
IntersectionPointOnEllipse(Collection<Point>, Point, Point, ref Point)
Calculate the intersection point between a polyline and a line segment.
Declaration
public static bool IntersectionPointOnEllipse(Collection<Point> points, Point org, Point end, ref Point result)
Parameters
System.Collections.ObjectModel.Collection<System.Windows.Point>
points
|
System.Windows.Point
org
|
System.Windows.Point
end
|
System.Windows.Point
result
|
Returns
System.Boolean
|
IntersectionPointOnEllipse(Rect, Point, Point, ref Point)
Calculate the intersection point between an ellipse and a line segment.
Declaration
public static void IntersectionPointOnEllipse(Rect rect, Point lineStart, Point lineEnd, ref Point result)
Parameters
System.Windows.Rect
rect
|
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
System.Windows.Point
result
|
IntersectionPointOnRectangle(Rect, Point, Point, ref Point)
Calculates the intersection point between the specified rectangle and the line segment defined by the specified points.
Declaration
public static void IntersectionPointOnRectangle(Rect rectangle, Point lineStart, Point lineEnd, ref Point intersectionPoint)
Parameters
System.Windows.Rect
rectangle
|
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
System.Windows.Point
intersectionPoint
|
InvertPoint(Point)
Inverts the point.
Declaration
public static Point InvertPoint(this Point point)
Parameters
System.Windows.Point
point
The point. |
Returns
System.Windows.Point
|
IsCounterClockWise(Point, Point, Point)
Determines, given three points, if when travelling from the first to the second to the third, we travel in a counterclockwise direction.
Declaration
public static int IsCounterClockWise(Point point1, Point point2, Point point3)
Parameters
System.Windows.Point
point1
|
System.Windows.Point
point2
|
System.Windows.Point
point3
|
Returns
System.Int32
|
Remarks
1 if the movement is in a counterclockwise direction, -1 if not.
IsEqual(Double, Double)
Determines whether the specified values are equal with Epsilon approximation.
Declaration
public static bool IsEqual(this double value1, double value2)
Parameters
System.Double
value1
The first value. |
System.Double
value2
The second value. |
Returns
System.Boolean
|
IsFiniteDouble(Double)
Determines whether [is finite double] [the specified x].
Declaration
public static bool IsFiniteDouble(double x)
Parameters
System.Double
x
The x. |
Returns
System.Boolean
|
IsGreaterThan(Double, Double)
Determines whether [is greater than] [the specified value1].
Declaration
public static bool IsGreaterThan(double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
IsGreaterThanOrClose(Double, Double)
Determines whether [is greater than or close] [the specified value1].
Declaration
public static bool IsGreaterThanOrClose(double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
IsInClosedInterval(Double, Double, Double)
Determines whether the specified value is in the specified closed interval.
Declaration
public static bool IsInClosedInterval(this double value, double min, double max)
Parameters
System.Double
value
|
System.Double
min
|
System.Double
max
|
Returns
System.Boolean
|
IsInRightOpenInterval(Double, Double, Double)
Determines whether the specified value is in the specified right open interval.
Declaration
public static bool IsInRightOpenInterval(this double value, double min, double max)
Parameters
System.Double
value
|
System.Double
min
|
System.Double
max
|
Returns
System.Boolean
|
IsLessOrEqual(Double, Double)
Determines whether [is less or equal] [the specified value1].
Declaration
public static bool IsLessOrEqual(this double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
IsLessThan(Double, Double)
Determines whether [is less than] [the specified value1].
Declaration
public static bool IsLessThan(double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
IsLessThanOrClose(Double, Double)
Determines whether [is less than or close] [the specified value1].
Declaration
public static bool IsLessThanOrClose(double value1, double value2)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
Returns
System.Boolean
|
IsNanOrInfinity(Double)
Gets whether the value is double or infinity.
Declaration
public static bool IsNanOrInfinity(this double value)
Parameters
System.Double
value
|
Returns
System.Boolean
|
IsNanOrInfinity(Point)
Gets whether the value is NaN or infinite point.
Declaration
public static bool IsNanOrInfinity(this Point value)
Parameters
System.Windows.Point
value
|
Returns
System.Boolean
|
IsNotEqual(Double, Double)
Determines whether the specified values are not equal with Epsilon approximation.
Declaration
public static bool IsNotEqual(this double value1, double value2)
Parameters
System.Double
value1
The first value. |
System.Double
value2
The second value. |
Returns
System.Boolean
|
IsPointInEllipse(Point, Rect)
Returns whether the specified point is inside the ellipse defined by the specified rectangle.
Declaration
public static bool IsPointInEllipse(Point point, Rect rectangle)
Parameters
System.Windows.Point
point
|
System.Windows.Rect
rectangle
|
Returns
System.Boolean
|
IsPointInRectangle(Point, Rect)
Determines whether [is point in rectangle] [the specified point].
Declaration
[Obsolete("This method will be removed. Use rect.Contains(point) instead.", false)]
public static bool IsPointInRectangle(Point point, Rect rect)
Parameters
System.Windows.Point
point
The point. |
System.Windows.Rect
rect
The rectangle. |
Returns
System.Boolean
|
IsPointInRectangle(Point, Size)
Determines whether [is point in rectangle] [the specified point].
Declaration
public static bool IsPointInRectangle(Point point, Size size)
Parameters
System.Windows.Point
point
The point. |
System.Windows.Size
size
The size. |
Returns
System.Boolean
|
IsVerySmall(Double)
Determines whether [is very small] [the specified value].
Declaration
public static bool IsVerySmall(this double value)
Parameters
System.Double
value
The value. |
Returns
System.Boolean
|
Length(Point)
Returns the length of the given point considered as a vector.
Declaration
public static double Length(this Point point)
Parameters
System.Windows.Point
point
|
Returns
System.Double
|
Lerp(Double, Double, Double)
Linear interpolation between the two given values.
Declaration
public static double Lerp(double x, double y, double alpha)
Parameters
System.Double
x
The value to be returned when |
System.Double
y
The value to be returned when |
System.Double
alpha
The linear interpolation parameter which usually takes a value in the interval |
Returns
System.Double
|
Lerp(Point, Point, Double)
Linear interpolation between the two given points.
Declaration
public static Point Lerp(Point pointA, Point pointB, double alpha)
Parameters
System.Windows.Point
pointA
The value to be returned when |
System.Windows.Point
pointB
The value to be returned when |
System.Double
alpha
The linear interpolation parameter which usually takes a value in the interval |
Returns
System.Windows.Point
|
Lerp(Vector, Vector, Double)
Linear interpolation between the two given vectors.
Declaration
public static Vector Lerp(Vector vectorA, Vector vectorB, double alpha)
Parameters
System.Windows.Vector
vectorA
The value to be returned when |
System.Windows.Vector
vectorB
The value to be returned when |
System.Double
alpha
The linear interpolation parameter which usually takes a value in the interval |
Returns
System.Windows.Vector
|
Limit(Point, Rect)
Moves the given point into the rectangle by taking the rectangle's intervals as limiting values for the point's coordinates.
Declaration
public static Point Limit(this Point point, Rect rectangle)
Parameters
System.Windows.Point
point
Any point. |
System.Windows.Rect
rectangle
A rectangle which acts as limiting container. |
Returns
System.Windows.Point
|
MiddlePoint(Point, Point)
Returns the middle point between the given points.
Declaration
public static Point MiddlePoint(Point point1, Point point2)
Parameters
System.Windows.Point
point1
A point. |
System.Windows.Point
point2
Another point. |
Returns
System.Windows.Point
Halfway between the two given points. |
MirrorHorizontally(Vector)
Returns the mirrored vector with respect to the X-coordinate.
Declaration
public static Vector MirrorHorizontally(this Vector vector)
Parameters
System.Windows.Vector
vector
The vector to mirror. |
Returns
System.Windows.Vector
The mirrored vector. |
MirrorPoint(Point, Point)
Mirrors the point with respect to the given center.
Declaration
public static Point MirrorPoint(Point point, Point center)
Parameters
System.Windows.Point
point
|
System.Windows.Point
center
|
Returns
System.Windows.Point
|
MirrorPoint(Point, Point, Point)
Returns the opposite of point point with respect to specified line.
Declaration
public static Point MirrorPoint(Point point, Point lineStart, Point lineEnd)
Parameters
System.Windows.Point
point
|
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
Returns
System.Windows.Point
|
MirrorVertically(Vector)
Returns the mirrored vector with respect to the Y-coordinate.
Declaration
public static Vector MirrorVertically(this Vector vector)
Parameters
System.Windows.Vector
vector
The vector to mirror. |
Returns
System.Windows.Vector
The mirrored vector. |
NearestIntersectionPoint(Point, Point, IList<Point>, ref Point)
Calculates the intersection points with each of the given segments and determines the one nearest to the first point.
Declaration
public static bool NearestIntersectionPoint(Point segmentStart, Point segmentEnd, IList<Point> points, ref Point result)
Parameters
System.Windows.Point
segmentStart
|
System.Windows.Point
segmentEnd
|
System.Collections.Generic.IList<System.Windows.Point>
points
|
System.Windows.Point
result
|
Returns
System.Boolean
Returns |
NearestPoint(Point, IEnumerable<Point>)
Gets the nearest point.
Declaration
public static Point NearestPoint(this Point point, IEnumerable<Point> points)
Parameters
System.Windows.Point
point
The point. |
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
Returns
System.Windows.Point
|
Normal(Point, Point)
Normalize the specified point1.
Declaration
public static Vector Normal(Point point1, Point point2)
Parameters
System.Windows.Point
point1
The point1. |
System.Windows.Point
point2
The point2. |
Returns
System.Windows.Vector
|
NormalizeAngle(Double)
Normalizes the specified angle into the [0, 2Pi] interval.
Declaration
public static double NormalizeAngle(double angle)
Parameters
System.Double
angle
The angle. |
Returns
System.Double
The normalize. |
Normalized(Vector)
Normalize the specified vector.
Declaration
public static Vector Normalized(this Vector vector)
Parameters
System.Windows.Vector
vector
The vector. |
Returns
System.Windows.Vector
|
Offset(IEnumerable<Point>, Vector)
Offsets the specified points.
Declaration
public static IList<Point> Offset(this IEnumerable<Point> points, Vector offsetVector)
Parameters
System.Collections.Generic.IEnumerable<System.Windows.Point>
points
The points. |
System.Windows.Vector
offsetVector
The offset vector. |
Returns
System.Collections.Generic.IList<System.Windows.Point>
|
Offset(IList<Point>, IList<Point>, Vector)
Offsets the point collection.
Declaration
public static void Offset(IList<Point> points, IList<Point> originalPoints, Vector offset)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
The points. |
System.Collections.Generic.IList<System.Windows.Point>
originalPoints
The original points. |
System.Windows.Vector
offset
The offset. |
Perpendicular(Vector)
Returns the perpendicular of the specified vector.
Declaration
public static Vector Perpendicular(this Vector vector)
Parameters
System.Windows.Vector
vector
A vector. |
Returns
System.Windows.Vector
|
PointFromBarycentricPercentage(Point, Rect)
Given a percentage and a rectangle this will return the coordinates corresponding to the percentages given.
Declaration
public static Point PointFromBarycentricPercentage(Point percentage, Rect rectangle)
Parameters
System.Windows.Point
percentage
A couple of values in percentage, e.g. a value of (50,50) will return the center of the rectangle. |
System.Windows.Rect
rectangle
The rectangle which acts as the barycentric system. |
Returns
System.Windows.Point
The point corresponding to the barycentric coordinates. |
PointFromBarycentricPercentage(Point, Size)
Given rect1 percentage and a rectangle this will return the coordinates corresponding to the percentages given.
Declaration
public static Point PointFromBarycentricPercentage(Point percentage, Size size)
Parameters
System.Windows.Point
percentage
A couple of values in percentage, e.g. a value of (50,50) will return the center of the rectangle. |
System.Windows.Size
size
The size from which the point will be extracted. |
Returns
System.Windows.Point
The point corresponding to the barycentric coordinates. |
PointOnLine(Point, Point, Double)
Gets a point extending the line by a specified distance.
Declaration
public static Point PointOnLine(Point startPoint, Point endPoint, double distance)
Parameters
System.Windows.Point
startPoint
The start point. |
System.Windows.Point
endPoint
The end point. |
System.Double
distance
The distance. |
Returns
System.Windows.Point
|
PolarToCartesian(Point, Double, Double)
Polar to cartesian coordinates conversion.
Declaration
public static Point PolarToCartesian(Point coordinateCenter, double angle, double rho)
Parameters
System.Windows.Point
coordinateCenter
The coordinate center. |
System.Double
angle
The angle. |
System.Double
rho
The polar radius. |
Returns
System.Windows.Point
|
See Also
PolylineToBezier(Collection<Point>)
The opposite of the approximation method, this attempts to smoothen out the polyline to a Bezier curve.
Declaration
public static IEnumerable<Point> PolylineToBezier(Collection<Point> points)
Parameters
System.Collections.ObjectModel.Collection<System.Windows.Point>
points
The polyline. |
Returns
System.Collections.Generic.IEnumerable<System.Windows.Point>
|
ProjectPointOnLine(Point, Point, Point)
Finds the projection (point) of the given point on the line.
Declaration
public static Point ProjectPointOnLine(Point point, Point lineStart, Point lineEnd)
Parameters
System.Windows.Point
point
|
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
Returns
System.Windows.Point
|
Push(Point, Vector, Double)
Pushes the specified start point onwards in the direction specified by the vector and a length given.
Declaration
public static Point Push(Point start, Vector unitVector, double distance)
Parameters
System.Windows.Point
start
The start. |
System.Windows.Vector
unitVector
The unit vector. |
System.Double
distance
The distance to push. |
Returns
System.Windows.Point
|
RotatePointsAt(IList<Point>, Point, Double)
Rotates the points.
Declaration
public static IList<Point> RotatePointsAt(IList<Point> points, Point pivot, double angle)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
|
System.Windows.Point
pivot
|
System.Double
angle
|
Returns
System.Collections.Generic.IList<System.Windows.Point>
|
RotateTransform(Point, Double)
Rotates the transform.
Declaration
public static RotateTransform RotateTransform(Point center, double angle)
Parameters
System.Windows.Point
center
The center. |
System.Double
angle
The angle. |
Returns
System.Windows.Media.RotateTransform
|
SafeDivide(Double, Double, Double)
Safes the divide.
Declaration
public static double SafeDivide(double value1, double value2, double fallback)
Parameters
System.Double
value1
The value1. |
System.Double
value2
The value2. |
System.Double
fallback
The fallback. |
Returns
System.Double
|
SameSide(Point, Point, Point, Point)
Determine whether point1 and point2 are on the same side of a line.
Declaration
public static bool SameSide(Point lineStart, Point lineEnd, Point point1, Point point2)
Parameters
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
System.Windows.Point
point1
|
System.Windows.Point
point2
|
Returns
System.Boolean
|
SegmentIntersect(Point, Point, Point, Point, ref Point)
Checks whether the segments defined by the specified point pairs intersect and returns the intersection point.
Declaration
public static bool SegmentIntersect(Point segmentStart, Point segmentEnd, Point lineStart, Point lineEnd, ref Point result)
Parameters
System.Windows.Point
segmentStart
|
System.Windows.Point
segmentEnd
|
System.Windows.Point
lineStart
|
System.Windows.Point
lineEnd
|
System.Windows.Point
result
|
Returns
System.Boolean
|
Snap(Double, Int32)
Snaps the specified value.
Declaration
public static double Snap(this double value, int snappingValue)
Parameters
System.Double
value
The value. |
System.Int32
snappingValue
The snapping value. |
Returns
System.Double
|
Square(Double)
Squares the specified value.
Declaration
public static double Square(double value)
Parameters
System.Double
value
Any value. |
Returns
System.Double
|
StairValue(Double, Double, Double)
Returns zero within the given interval and +/-1 whether the value is above or below the interval.
Declaration
public static int StairValue(double value, double lower, double upper)
Parameters
System.Double
value
The argument of the function. |
System.Double
lower
The lower value of the interval. |
System.Double
upper
The upper value of the interval. |
Returns
System.Int32
Zero, -1 or +1 whether the value is below, inside, or above the interval. |
StairValue(Point, Rect)
Returns the StairValue(Double, Double, Double) of the x,y values of the given point with respect to the boundaries of the specified rectangle.
Declaration
public static Vector StairValue(Point point, Rect rectangle)
Parameters
System.Windows.Point
point
The point to test. |
System.Windows.Rect
rectangle
The rectangle which acts as the domain of the stair function. |
Returns
System.Windows.Vector
Zero, -1 or +1 whether the coordinate is below, inside, or above the boundary of the rectangle. |
Swap(ref Double, ref Double)
Swaps the values of the two numbers.
Declaration
public static void Swap(ref double value1, ref double value2)
Parameters
System.Double
value1
A value. |
System.Double
value2
Another value. |
Swap(ref Point, ref Point)
Swaps the values of the two points.
Declaration
public static void Swap(ref Point point1, ref Point point2)
Parameters
System.Windows.Point
point1
A point. |
System.Windows.Point
point2
Another point. |
ToDegrees(Double)
Converts the specified value from radians to degrees.
Declaration
public static double ToDegrees(this double radians)
Parameters
System.Double
radians
|
Returns
System.Double
|
ToDoubleCollection(String)
DoubleCollection from a string representation.
Declaration
public static DoubleCollection ToDoubleCollection(string value)
Parameters
System.String
value
|
Returns
System.Windows.Media.DoubleCollection
|
ToEnum<T>(Object)
Returns value of the enumeration.
Declaration
public static T ToEnum<T>(object value)
Parameters
System.Object
value
The value. |
Returns
T
|
Type Parameters
T
The type of the enumeration. |
ToInvariant(IList<Point>)
Returns a string serialization of the given point collection.
Declaration
public static string ToInvariant(this IList<Point> points)
Parameters
System.Collections.Generic.IList<System.Windows.Point>
points
The points. |
Returns
System.String
|
ToInvariant(Double)
Converts the double to a string representation.
Declaration
public static string ToInvariant(this double value)
Parameters
System.Double
value
The value. |
Returns
System.String
|
ToInvariant(Int32)
Converts the integer to a string representation.
Declaration
public static string ToInvariant(this int value)
Parameters
System.Int32
value
The value. |
Returns
System.String
|
ToInvariant(DoubleCollection)
Converts the double collection to a string representation.
Declaration
public static string ToInvariant(this DoubleCollection collection)
Parameters
System.Windows.Media.DoubleCollection
collection
The collection. |
Returns
System.String
|
ToInvariant(Point)
Converts the point to a string representation.
Declaration
public static string ToInvariant(this Point point)
Parameters
System.Windows.Point
point
The point. |
Returns
System.String
|
ToInvariant(Size)
Converts the point to a string representation.
Declaration
public static string ToInvariant(this Size size)
Parameters
System.Windows.Size
size
The size. |
Returns
System.String
|
ToPoint(String)
Attempts to convert the given string to a points.
Declaration
public static Point? ToPoint(string point)
Parameters
System.String
point
The string representation of the point. |
Returns
System.Nullable<System.Windows.Point>
The Point corresponding to the serialized form. |
ToPoints(String)
Attempts to convert the given string to a list of points.
Declaration
public static IList<Point> ToPoints(string points)
Parameters
System.String
points
The string representation of the points. |
Returns
System.Collections.Generic.IList<System.Windows.Point>
The points corresponding to the serialized form. |
See Also
ToRadians(Double)
Converts the specified value from degrees to radians.
Declaration
public static double ToRadians(this double degrees)
Parameters
System.Double
degrees
|
Returns
System.Double
|
ToRect(Size)
Return a rectangle located a (0.0) with the specified size.
Declaration
public static Rect ToRect(this Size size)
Parameters
System.Windows.Size
size
The s. |
Returns
System.Windows.Rect
A rectangle located at the (0.0). |
ToSize(String)
Sizes from string.
Declaration
public static Size? ToSize(string size)
Parameters
System.String
size
|
Returns
System.Nullable<System.Windows.Size>
|
ToUnit(Point)
Returns a unit point in the direction defined by the given point.
Declaration
public static Point ToUnit(this Point point)
Parameters
System.Windows.Point
point
|
Returns
System.Windows.Point
|
Union(Rect, Rect)
Unions two rectangles.
Declaration
public static Rect Union(Rect rect1, Rect rect2)
Parameters
System.Windows.Rect
rect1
The first rectangle. |
System.Windows.Rect
rect2
The second rectangle. |
Returns
System.Windows.Rect
Union of the two rectangles. |
UnitVector(Double)
Returns a unit vector in the direction specified by the angle.
Declaration
public static Vector UnitVector(double degrees)
Parameters
System.Double
degrees
The angle in degrees. |
Returns
System.Windows.Vector
A unit vector. |
UppercaseFirstLetter(String)
Uppercases the first letter of the string.
Declaration
public static string UppercaseFirstLetter(this string value)
Parameters
System.String
value
An arbitrary string. |
Returns
System.String
|