skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder Design System Kit
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class Utils

Global utilities and functions.

Inheritance
System.Object
Utils
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Diagrams.Core
Assembly: Telerik.WinControls.RadDiagram.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
Point topLeft

The topLeft.

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<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
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<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
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<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<Point>

ApproximateRoundedRectangle(Rect, Double)

Approximates the rounded rectangle.

Declaration
public static IEnumerable<Point> ApproximateRoundedRectangle(Rect rectangle, double radius)
Parameters
Rect rectangle

System.Double radius

Returns
System.Collections.Generic.IEnumerable<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
Rect rect

The rec.

System.Double startAngle

The start angle.

System.Double sweep

The sweep.

Point startPoint

The start point.

Point outsidePoint

The outside point.

System.Boolean largeArc

If set to true [large arc].

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
Point line1Start

The first point of the first line.

Point line1End

The second point of the first line.

Point line2Start

The first point of the second line.

Point line2End

The second point of the second line.

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
Point realPoint

The real point.

Rect rectangle

The rectangle which acts as a barycentric coordinate system.

Returns
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
Point rootPoint

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
Point point

The point seeking the closes neighbor.

Point point1

The first point in the interval.

Point point2

The second point in the interval.

Returns
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
Point point1

The point where the vector starts.

Point point2

The points where the vector ends.

Returns
Vector

Determinant(Point, Point)

Determinants the specified point1.

Declaration
public static double Determinant(Point point1, Point point2)
Parameters
Point point1

The point1.

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
Point point

The point outside the segment.

Point lineStart

The first point defining the segment.

Point lineEnd

The second point defining the segment.

Returns
Point

DistanceSquared(Point, Point)

Returns the squared distance between the given points.

Declaration
public static double DistanceSquared(Point point1, Point point2)
Parameters
Point point1

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
Point point1

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
Vector vector1

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
Point start

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
Point firstPoint

Point centralPoint

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
Rect rec

The bounding rectangle of the shape.

System.Double angle

The rotation angle.

Point segmentStart

The line point which is supposedly inside the shape defined by rec.

Point segmentEnd

The other line point which supposedly sits outside the bounds define by rec.

GlidingStyle style

The gliding style.

Returns
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
Point line1Start

Point line1End

Point line2Start

Point line2End

System.Boolean acceptNaN

Returns
Point

The intersection point. If acceptNaN is true line1Start double.NaN is returned if they don't intersect.

FindRadian(Point, Point)

Finds the radian between two points.

Declaration
public static double FindRadian(Point start, Point end)
Parameters
Point start

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
Point firstPoint

Point centralPoint

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
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<Point> points

The points.

System.Int32 segment

The segment.

System.Double value

A value in the interval [0,1].

Returns
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<Point> points

The points.

Returns
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<Point> points

The points collection.

Returns
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
Rect rect

The rect.

System.Double angle

The angle in degrees.

Returns
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<Point> points

The points.

Returns
Point

GetNormalizedPoints(IEnumerable<Point>)

Gets the normalized points.

Declaration
public static IEnumerable<Point> GetNormalizedPoints(this IEnumerable<Point> points)
Parameters
System.Collections.Generic.IEnumerable<Point> points

The points.

Returns
System.Collections.Generic.IEnumerable<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
Point point

Rect rectangle

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<Point> points

The points.

Returns
Point

HasValidArea(Size)

Determines whether [has valid area] [the specified size].

Declaration
public static bool HasValidArea(this Size size)
Parameters
Size size

The size.

Returns
System.Boolean

true if [has valid area] [the specified size]; otherwise, false.

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
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<Point> points

Point org

Point end

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
Rect rect

Point lineStart

Point lineEnd

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
Rect rectangle

Point lineStart

Point lineEnd

Point intersectionPoint

InvertPoint(Point)

Inverts the point.

Declaration
public static Point InvertPoint(this Point point)
Parameters
Point point

The point.

Returns
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
Point point1

Point point2

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

True if the specified values are equal with Epsilon approximation; otherwise, false.

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

True if [is finite double] [the specified x]; otherwise, false.

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

True if [is greater than] [the specified value1]; otherwise, false.

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

True if [is greater than or close] [the specified value1]; otherwise, false.

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

True If [is less or equal] [the specified value1]; otherwise, false.

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

True if [is less than] [the specified value1]; otherwise, false.

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

True if [is less than or close] [the specified value1]; otherwise, false.

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
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

True if the specified values are not equal with Epsilon approximation; otherwise, false.

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
Point point

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
Point point

The point.

Rect rect

The rectangle.

Returns
System.Boolean

true if [is point in rectangle] [the specified point]; otherwise, false.

IsPointInRectangle(Point, Size)

Determines whether [is point in rectangle] [the specified point].

Declaration
public static bool IsPointInRectangle(Point point, Size size)
Parameters
Point point

The point.

Size size

The size.

Returns
System.Boolean

true if [is point in rectangle] [the specified point]; otherwise, false.

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

true if [is very small] [the specified value]; otherwise, false.

Length(Point)

Returns the length of the given point considered as a vector.

Declaration
public static double Length(this Point point)
Parameters
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 alpha is zero.

System.Double y

The value to be returned when alpha is equal to one.

System.Double alpha

The linear interpolation parameter which usually takes a value in the interval [0,1] but which works outside this range nevertheless.

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
Point pointA

The value to be returned when alpha is zero.

Point pointB

The value to be returned when alpha is equal to one.

System.Double alpha

The linear interpolation parameter which usually takes a value in the interval [0,1] but which works outside this range nevertheless.

Returns
Point

Lerp(Vector, Vector, Double)

Linear interpolation between the two given vectors.

Declaration
public static Vector Lerp(Vector vectorA, Vector vectorB, double alpha)
Parameters
Vector vectorA

The value to be returned when alpha is zero.

Vector vectorB

The value to be returned when alpha is equal to one.

System.Double alpha

The linear interpolation parameter which usually takes a value in the interval [0,1] but which works outside this range nevertheless.

Returns
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
Point point

Any point.

Rect rectangle

A rectangle which acts as limiting container.

Returns
Point

MiddlePoint(Point, Point)

Returns the middle point between the given points.

Declaration
public static Point MiddlePoint(Point point1, Point point2)
Parameters
Point point1

A point.

Point point2

Another point.

Returns
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
Vector vector

The vector to mirror.

Returns
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
Point point

Point center

Returns
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
Point point

Point lineStart

Point lineEnd

Returns
Point

MirrorVertically(Vector)

Returns the mirrored vector with respect to the Y-coordinate.

Declaration
public static Vector MirrorVertically(this Vector vector)
Parameters
Vector vector

The vector to mirror.

Returns
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
Point segmentStart

Point segmentEnd

System.Collections.Generic.IList<Point> points

Point result

Returns
System.Boolean

Returns true if a point (non-NaN values) is found, otherwise false.

NearestPoint(Point, IEnumerable<Point>)

Gets the nearest point.

Declaration
public static Point NearestPoint(this Point point, IEnumerable<Point> points)
Parameters
Point point

The point.

System.Collections.Generic.IEnumerable<Point> points

The points.

Returns
Point

Normal(Point, Point)

Normalize the specified point1.

Declaration
public static Vector Normal(Point point1, Point point2)
Parameters
Point point1

The point1.

Point point2

The point2.

Returns
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
Vector vector

The vector.

Returns
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<Point> points

The points.

Vector offsetVector

The offset vector.

Returns
System.Collections.Generic.IList<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<Point> points

The points.

System.Collections.Generic.IList<Point> originalPoints

The original points.

Vector offset

The offset.

Perpendicular(Vector)

Returns the perpendicular of the specified vector.

Declaration
public static Vector Perpendicular(this Vector vector)
Parameters
Vector vector

A vector.

Returns
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
Point percentage

A couple of values in percentage, e.g. a value of (50,50) will return the center of the rectangle.

Rect rectangle

The rectangle which acts as the barycentric system.

Returns
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
Point percentage

A couple of values in percentage, e.g. a value of (50,50) will return the center of the rectangle.

Size size

The size from which the point will be extracted.

Returns
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
Point startPoint

The start point.

Point endPoint

The end point.

System.Double distance

The distance.

Returns
Point

PolarToCartesian(Point, Double, Double)

Polar to cartesian coordinates conversion.

Declaration
public static Point PolarToCartesian(Point coordinateCenter, double angle, double rho)
Parameters
Point coordinateCenter

The coordinate center.

System.Double angle

The angle.

System.Double rho

The polar radius.

Returns
Point

See Also
CartesianToPolar(Point, Point, ref Double, ref Double)

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<Point> points

The polyline.

Returns
System.Collections.Generic.IEnumerable<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
Point point

Point lineStart

Point lineEnd

Returns
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
Point start

The start.

Vector unitVector

The unit vector.

System.Double distance

The distance to push.

Returns
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<Point> points

Point pivot

System.Double angle

Returns
System.Collections.Generic.IList<Point>

RotateTransform(Point, Double)

Rotates the transform.

Declaration
public static RotateTransform RotateTransform(Point center, double angle)
Parameters
Point center

The center.

System.Double angle

The angle.

Returns
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
Point lineStart

Point lineEnd

Point point1

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
Point segmentStart

Point segmentEnd

Point lineStart

Point lineEnd

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
Point point

The point to test.

Rect rectangle

The rectangle which acts as the domain of the stair function.

Returns
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
Point point1

A point.

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
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.

ToHexColor(Color)

Declaration
public static string ToHexColor(Color color)
Parameters
System.Drawing.Color color

Returns
System.String

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<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(SizeF)

Declaration
public static string ToInvariant(this SizeF size)
Parameters
System.Drawing.SizeF size

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(Single)

Converts the double to a string representation.

Declaration
public static string ToInvariant(this float value)
Parameters
System.Single 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
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
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
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<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<Point>

The points corresponding to the serialized form.

See Also
ToPoint(String)
ToInvariant(IList<Point>)

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
Size size

The s.

Returns
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<Size>

ToUnit(Point)

Returns a unit point in the direction defined by the given point.

Declaration
public static Point ToUnit(this Point point)
Parameters
Point point

Returns
Point

Union(Rect, Rect)

Unions two rectangles.

Declaration
public static Rect Union(Rect rect1, Rect rect2)
Parameters
Rect rect1

The first rectangle.

Rect rect2

The second rectangle.

Returns
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
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

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • Step-by-Step Tutorial
  • Sample Applications
  • SDK Samples
  • Visual Studio Extensions
Support Resources
  • Code Library
  • Knowledge Base
  • Videos
Community
  • Forums
  • Blogs
  • Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.