Class
Utils

Global utilities and functions.

Definition

Namespace:Telerik.Windows.Diagrams.Core

Assembly:Telerik.Windows.Diagrams.Core.dll

Syntax:

cs-api-definition
public static class Utils

Inheritance: objectUtils

Fields

Epsilon

An infinitesimal value.

Declaration

cs-api-definition
public const double Epsilon = 1E-06

Field Value

double

Methods

ApproximateArc(Point, Point, double, double)

Approximates the arc.

Declaration

cs-api-definition
public static IEnumerable<Point> ApproximateArc(Point topLeft, Point bottomRight, double startAngle, double endAngle)

Parameters

topLeft

Point

The topLeft.

bottomRight

Point

The bottomRight.

startAngle

double

The angle in degrees at which the arc starts.

endAngle

double

The angle in degrees at which the arc ends.

Returns

IEnumerable<Point>

ApproximateBezierCurve(Point[], int)

Approximates the Bezier curve as segments represented by a series of points.

Declaration

cs-api-definition
public static IEnumerable<Point> ApproximateBezierCurve(Point[] bezierPoints, int quality)

Parameters

bezierPoints

Point[]

The Bezier points.

quality

int

The quality of the approximation. The greater the value, the more accurate approximation (more approximated points).

Returns

IEnumerable<Point>

ApproximateEllipse(Rect, double)

Approximates the ellipse defined by the given bounds.

Declaration

cs-api-definition
public static IList<Point> ApproximateEllipse(this Rect rec, double minSegmentLength = 10)

Parameters

rec

Rect

The bounds of the (not rotated) ellipse.

minSegmentLength

double

The minimum length an approximating segment should have.

Returns

IList<Point>

ApproximateRoundedRectangle(Rect, double)

Approximates the rounded rectangle.

Declaration

cs-api-definition
public static IEnumerable<Point> ApproximateRoundedRectangle(Rect rectangle, double radius)

Parameters

rectangle

Rect

radius

double

Returns

IEnumerable<Point>

ApproximateRoundedRectangle(double, double, double, double, double)

Approximates the rounded rectangle.

Declaration

cs-api-definition
public static IEnumerable<Point> ApproximateRoundedRectangle(double x, double y, double width, double height, double radius)

Parameters

x

double

The x-coordinate.

y

double

The y-coordinate.

width

double

The width.

height

double

The height.

radius

double

The radius of the rounding.

Returns

IEnumerable<Point>

ArcConvert(Rect, double, double, out Point, out Point, out bool, out SweepDirection)

Arcs the convert.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters")]
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.

startAngle

double

The start angle.

sweep

double

The sweep.

startPoint

Point

The start point.

outsidePoint

Point

The outside point.

largeArc

bool

If set to true [large arc].

dir

SweepDirection

The direction.

AreClose(double, double)

Checks whether two values are close.

Declaration

cs-api-definition
public static bool AreClose(double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static bool AreLinesIntersecting(Point line1Start, Point line1End, Point line2Start, Point line2End, ref Point crossingPoint)

Parameters

line1Start

Point

The first point of the first line.

line1End

Point

The second point of the first line.

line2Start

Point

The first point of the second line.

line2End

Point

The second point of the second line.

crossingPoint

Point

The crossing point.

Returns

bool

BarycentricPercentageFromPoint(Point, Rect)

Returns the barycentric coordinates as percentages with respect to the given rectangle.

Declaration

cs-api-definition
public static Point BarycentricPercentageFromPoint(Point realPoint, Rect rectangle)

Parameters

realPoint

Point

The real point.

rectangle

Rect

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

cs-api-definition
public static bool BetweenOrEqual(double value, double lower, double upper)

Parameters

value

double

The value.

lower

double

The lower.

upper

double

The upper.

Returns

bool

CartesianToPolar(Point, Point, ref double, ref double)

Converts the Cartesian coordinates to polar coordinates.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static void CartesianToPolar(Point rootPoint, Point otherPoint, ref double angle, ref double rho)

Parameters

rootPoint

Point

otherPoint

Point

angle

double

rho

double

Closer(Point, Point, Point)

Returns the point of the interval which sits the closest to the given point.

Declaration

cs-api-definition
public static Point Closer(Point point, Point point1, Point point2)

Parameters

point

Point

The point seeking the closes neighbor.

point1

Point

The first point in the interval.

point2

Point

The second point in the interval.

Returns

Point

Closer(double, double, double)

Given an interval and a value this will output the value which is closer to the given value.

Declaration

cs-api-definition
public static double Closer(double value, double choice1, double choice2)

Parameters

value

double

choice1

double

choice2

double

Returns

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

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters")]
public static void Closer(double value, double choice1, double choice2, out double nearestValue, out double otherValue)

Parameters

value

double

The value.

choice1

double

The first choice.

choice2

double

The second choice.

nearestValue

double

The nearest value.

otherValue

double

The other value.

CoerceAngle(double)

Coerces the given angle. The return angle will be between 0 and 360.

Declaration

cs-api-definition
public static double CoerceAngle(double angle)

Parameters

angle

double

The angle.

Returns

double

Constrain(double, double, double)

Constrains the specified value to the given interval.

Declaration

cs-api-definition
public static double Constrain(this double value, double min, double max)

Parameters

value

double

The value to constrain.

min

double

The min.

max

double

The max.

Returns

double

Delta(Point, Point)

Returns the vector between the two points.

Declaration

cs-api-definition
public static Vector Delta(this Point point1, Point point2)

Parameters

point1

Point

The point where the vector starts.

point2

Point

The points where the vector ends.

Returns

Vector

Determinant(Point, Point)

Determinants the specified point1.

Declaration

cs-api-definition
public static double Determinant(Point point1, Point point2)

Parameters

point1

Point

The point1.

point2

Point

The point2.

Returns

double

Distance(double, double)

Returns the distance of the point to the origin.

Declaration

cs-api-definition
public static double Distance(double x, double y)

Parameters

x

double

y

double

Returns

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

cs-api-definition
public static Point DistancePoint(Point point, Point lineStart, Point lineEnd)

Parameters

point

Point

The point outside the segment.

lineStart

Point

The first point defining the segment.

lineEnd

Point

The second point defining the segment.

Returns

Point

DistanceSquared(Point, Point)

Returns the squared distance between the given points.

Declaration

cs-api-definition
public static double DistanceSquared(Point point1, Point point2)

Parameters

point1

Point

point2

Point

Returns

double

Dot(Point, Point)

Returns the dot product of the specified points.

Declaration

cs-api-definition
public static double Dot(Point point1, Point point2)

Parameters

point1

Point

point2

Point

Returns

double

Dot(Vector, Vector)

Returns the dot product of the specified vectors.

Declaration

cs-api-definition
public static double Dot(Vector vector1, Vector vector2)

Parameters

vector1

Vector

vector2

Vector

Returns

double

DoubleFromMantissaAndExponent(double, int)

Gets a double value from mantissa and exponent.

Declaration

cs-api-definition
public static double DoubleFromMantissaAndExponent(double value, int exp)

Parameters

value

double

The value.

exp

int

The exponential.

Returns

double

EnsureRange(double, double?, double?)

Ensures the range.

Declaration

cs-api-definition
public static double EnsureRange(double value, double? min, double? max)

Parameters

value

double

The value.

min

double?

The min.

max

double?

The max.

Returns

double

FindAngle(Point, Point)

Finds the angle between two points.

Declaration

cs-api-definition
public static double FindAngle(Point start, Point end)

Parameters

start

Point

end

Point

Returns

double

FindAngle(Point, Point, Point)

Finds the angle between three points.

Declaration

cs-api-definition
public static double FindAngle(Point firstPoint, Point centralPoint, Point secondPoint)

Parameters

firstPoint

Point

centralPoint

Point

secondPoint

Point

Returns

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

cs-api-definition
public static Point FindIntersectionPoint(this Rect rec, double angle, Point segmentStart, Point segmentEnd, GlidingStyle style)

Parameters

rec

Rect

The bounding rectangle of the shape.

angle

double

The rotation angle.

segmentStart

Point

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

segmentEnd

Point

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

style

GlidingStyle

The gliding style.

Returns

Point

FindLinesIntersection(Point, Point, Point, Point, bool)

Finds the intersection point of the lines defined by the point pairs.

Declaration

cs-api-definition
public static Point FindLinesIntersection(Point line1Start, Point line1End, Point line2Start, Point line2End, bool acceptNaN = false)

Parameters

line1Start

Point

line1End

Point

line2Start

Point

line2End

Point

acceptNaN

bool

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

cs-api-definition
public static double FindRadian(Point start, Point end)

Parameters

start

Point

end

Point

Returns

double

FindRadian(Point, Point, Point)

Finds the radian between three points.

Declaration

cs-api-definition
public static double FindRadian(Point firstPoint, Point centralPoint, Point secondPoint)

Parameters

firstPoint

Point

centralPoint

Point

secondPoint

Point

Returns

double

GetAssemblyName(Assembly)

Gets the name of the assembly.

Declaration

cs-api-definition
public static string GetAssemblyName(this Assembly assembly)

Parameters

assembly

Assembly

The assembly.

Returns

string

GetBezierPoint(Collection<Point>, int, double)

Gets the Bezier point at the specified value.

Declaration

cs-api-definition
public static Point GetBezierPoint(Collection<Point> points, int segment, double value)

Parameters

points

Collection<Point>

The points.

segment

int

The segment.

value

double

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

cs-api-definition
public static Point GetBottomRightPoint(IEnumerable<Point> points)

Parameters

points

IEnumerable<Point>

The points.

Returns

Point

GetBounds(IList<Point>)

Gets the enclosing bounds of the points collection.

Declaration

cs-api-definition
public static Rect GetBounds(this IList<Point> points)

Parameters

points

IList<Point>

The points collection.

Returns

Rect

GetChildElements(XElement)

Gets the only the child elements.

Declaration

cs-api-definition
public static IEnumerable<XElement> GetChildElements(this XElement element)

Parameters

element

XElement

The parent element.

Returns

IEnumerable<XElement>

GetEllipsePointAtAngle(Rect, double)

Returns the point at an angle on the ellipse defined by the specified rectangle.

Declaration

cs-api-definition
public static Point GetEllipsePointAtAngle(this Rect rect, double angle)

Parameters

rect

Rect

The rect.

angle

double

The angle in degrees.

Returns

Point

GetEnumValues<T>()

Gets the enumeration values.

Declaration

cs-api-definition
public static T[] GetEnumValues<T>()

Returns

T[]

GetNormalizationPoint(IEnumerable<Point>)

Gets the normalization point.

Declaration

cs-api-definition
public static Point GetNormalizationPoint(this IEnumerable<Point> points)

Parameters

points

IEnumerable<Point>

The points.

Returns

Point

GetNormalizedPoints(IEnumerable<Point>)

Gets the normalized points.

Declaration

cs-api-definition
public static IEnumerable<Point> GetNormalizedPoints(this IEnumerable<Point> points)

Parameters

points

IEnumerable<Point>

The points.

Returns

IEnumerable<Point>

GetProjections(Point, Rect, Point[])

Gets the projected points of the specified point on the given rectangle.

Declaration

cs-api-definition
public static void GetProjections(Point point, Rect rectangle, Point[] projections)

Parameters

point

Point

rectangle

Rect

projections

Point[]

GetPythagorEqualSide(double)

Gets the equal sides of a triangle from the Pythagor theorem.

Declaration

cs-api-definition
public static double GetPythagorEqualSide(double hypotenuse)

Parameters

hypotenuse

double

The hypotenuse.

Returns

double

GetPythagorHypotenuse(double, double)

Gets the hypotenuse according to the Pythagoras theorem.

Declaration

cs-api-definition
public static double GetPythagorHypotenuse(double sideA, double sideB)

Parameters

sideA

double

The first side.

sideB

double

The second side.

Returns

double

GetTopLeftPoint(IEnumerable<Point>)

Gets a point from the minimum X and Y values from the specified points.

Declaration

cs-api-definition
public static Point GetTopLeftPoint(IEnumerable<Point> points)

Parameters

points

IEnumerable<Point>

The points.

Returns

Point

HasValidArea(Size)

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

Declaration

cs-api-definition
public static bool HasValidArea(this Size size)

Parameters

size

Size

The size.

Returns

bool

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

Hypotenuse(double, double)

Hypotenuses the specified x.

Declaration

cs-api-definition
public static double Hypotenuse(double x, double y)

Parameters

x

double

The x.

y

double

The y.

Returns

double

Intersect(Point[])

Determines whether the specified line segments intersect.

Declaration

cs-api-definition
public static bool Intersect(Point[] points)

Parameters

points

Point[]

Returns

bool

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

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static bool IntersectionPointOnEllipse(Collection<Point> points, Point org, Point end, ref Point result)

Parameters

points

Collection<Point>

org

Point

end

Point

result

Point

Returns

bool

IntersectionPointOnEllipse(Rect, Point, Point, ref Point)

Calculate the intersection point between an ellipse and a line segment.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static void IntersectionPointOnEllipse(Rect rect, Point lineStart, Point lineEnd, ref Point result)

Parameters

rect

Rect

lineStart

Point

lineEnd

Point

result

Point

IntersectionPointOnRectangle(Rect, Point, Point, ref Point)

Calculates the intersection point between the specified rectangle and the line segment defined by the specified points.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
[SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
public static void IntersectionPointOnRectangle(Rect rectangle, Point lineStart, Point lineEnd, ref Point intersectionPoint)

Parameters

rectangle

Rect

lineStart

Point

lineEnd

Point

intersectionPoint

Point

InvertPoint(Point)

Inverts the point.

Declaration

cs-api-definition
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

cs-api-definition
public static int IsCounterClockWise(Point point1, Point point2, Point point3)

Parameters

point1

Point

point2

Point

point3

Point

Returns

int

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

cs-api-definition
public static bool IsEqual(this double value1, double value2)

Parameters

value1

double

The first value.

value2

double

The second value.

Returns

bool

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

IsFiniteDouble(double)

Determines whether [is finite double] [the specified x].

Declaration

cs-api-definition
public static bool IsFiniteDouble(double x)

Parameters

x

double

The x.

Returns

bool

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

IsGreaterThan(double, double)

Determines whether [is greater than] [the specified value1].

Declaration

cs-api-definition
public static bool IsGreaterThan(double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

IsGreaterThanOrClose(double, double)

Determines whether [is greater than or close] [the specified value1].

Declaration

cs-api-definition
public static bool IsGreaterThanOrClose(double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

cs-api-definition
public static bool IsInClosedInterval(this double value, double min, double max)

Parameters

value

double

min

double

max

double

Returns

bool

IsInRightOpenInterval(double, double, double)

Determines whether the specified value is in the specified right open interval.

Declaration

cs-api-definition
public static bool IsInRightOpenInterval(this double value, double min, double max)

Parameters

value

double

min

double

max

double

Returns

bool

IsLessOrEqual(double, double)

Determines whether [is less or equal] [the specified value1].

Declaration

cs-api-definition
public static bool IsLessOrEqual(this double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

IsLessThan(double, double)

Determines whether [is less than] [the specified value1].

Declaration

cs-api-definition
public static bool IsLessThan(double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

IsLessThanOrClose(double, double)

Determines whether [is less than or close] [the specified value1].

Declaration

cs-api-definition
public static bool IsLessThanOrClose(double value1, double value2)

Parameters

value1

double

The value1.

value2

double

The value2.

Returns

bool

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

IsNanOrInfinity(Point)

Gets whether the value is NaN or infinite point.

Declaration

cs-api-definition
public static bool IsNanOrInfinity(this Point value)

Parameters

value

Point

Returns

bool

IsNanOrInfinity(double)

Gets whether the value is double or infinity.

Declaration

cs-api-definition
public static bool IsNanOrInfinity(this double value)

Parameters

value

double

Returns

bool

IsNotEqual(double, double)

Determines whether the specified values are not equal with Epsilon approximation.

Declaration

cs-api-definition
public static bool IsNotEqual(this double value1, double value2)

Parameters

value1

double

The first value.

value2

double

The second value.

Returns

bool

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

cs-api-definition
public static bool IsPointInEllipse(Point point, Rect rectangle)

Parameters

point

Point

rectangle

Rect

Returns

bool

IsPointInRectangle(Point, Size)

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

Declaration

cs-api-definition
public static bool IsPointInRectangle(Point point, Size size)

Parameters

point

Point

The point.

size

Size

The size.

Returns

bool

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

IsVerySmall(double)

Determines whether [is very small] [the specified value].

Declaration

cs-api-definition
public static bool IsVerySmall(this double value)

Parameters

value

double

The value.

Returns

bool

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

Length(Point)

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

Declaration

cs-api-definition
public static double Length(this Point point)

Parameters

point

Point

Returns

double

Lerp(Point, Point, double)

Linear interpolation between the two given points.

Declaration

cs-api-definition
public static Point Lerp(Point pointA, Point pointB, double alpha)

Parameters

pointA

Point

The value to be returned when alpha is zero.

pointB

Point

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

alpha

double

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

cs-api-definition
public static Vector Lerp(Vector vectorA, Vector vectorB, double alpha)

Parameters

vectorA

Vector

The value to be returned when alpha is zero.

vectorB

Vector

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

alpha

double

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

Returns

Vector

Lerp(double, double, double)

Linear interpolation between the two given values.

Declaration

cs-api-definition
public static double Lerp(double x, double y, double alpha)

Parameters

x

double

The value to be returned when alpha is zero.

y

double

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

alpha

double

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

Returns

double

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

cs-api-definition
public static Point Limit(this Point point, Rect rectangle)

Parameters

point

Point

Any point.

rectangle

Rect

A rectangle which acts as limiting container.

Returns

Point

MiddlePoint(Point, Point)

Returns the middle point between the given points.

Declaration

cs-api-definition
public static Point MiddlePoint(Point point1, Point point2)

Parameters

point1

Point

A point.

point2

Point

Another point.

Returns

Point

Halfway between the two given points.

MirrorHorizontally(Vector)

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

Declaration

cs-api-definition
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

cs-api-definition
public static Point MirrorPoint(Point point, Point center)

Parameters

point

Point

center

Point

Returns

Point

MirrorPoint(Point, Point, Point)

Returns the opposite of point point with respect to specified line.

Declaration

cs-api-definition
public static Point MirrorPoint(Point point, Point lineStart, Point lineEnd)

Parameters

point

Point

lineStart

Point

lineEnd

Point

Returns

Point

MirrorVertically(Vector)

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

Declaration

cs-api-definition
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

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static bool NearestIntersectionPoint(Point segmentStart, Point segmentEnd, IList<Point> points, ref Point result)

Parameters

segmentStart

Point

segmentEnd

Point

points

IList<Point>

result

Point

Returns

bool

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

NearestPoint(Point, IEnumerable<Point>)

Gets the nearest point.

Declaration

cs-api-definition
public static Point NearestPoint(this Point point, IEnumerable<Point> points)

Parameters

point

Point

The point.

points

IEnumerable<Point>

The points.

Returns

Point

Normal(Point, Point)

Normalize the specified point1.

Declaration

cs-api-definition
public static Vector Normal(Point point1, Point point2)

Parameters

point1

Point

The point1.

point2

Point

The point2.

Returns

Vector

NormalizeAngle(double)

Normalizes the specified angle into the [0, 2Pi] interval.

Declaration

cs-api-definition
public static double NormalizeAngle(double angle)

Parameters

angle

double

The angle.

Returns

double

The normalize.

Normalized(Vector)

Normalize the specified vector.

Declaration

cs-api-definition
public static Vector Normalized(this Vector vector)

Parameters

vector

Vector

The vector.

Returns

Vector

Offset(IEnumerable<Point>, Vector)

Offsets the specified points.

Declaration

cs-api-definition
public static IList<Point> Offset(this IEnumerable<Point> points, Vector offsetVector)

Parameters

points

IEnumerable<Point>

The points.

offsetVector

Vector

The offset vector.

Returns

IList<Point>

Offset(IList<Point>, IList<Point>, Vector)

Offsets the point collection.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
public static void Offset(IList<Point> points, IList<Point> originalPoints, Vector offset)

Parameters

points

IList<Point>

The points.

originalPoints

IList<Point>

The original points.

offset

Vector

The offset.

Perpendicular(Vector)

Returns the perpendicular of the specified vector.

Declaration

cs-api-definition
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

cs-api-definition
public static Point PointFromBarycentricPercentage(Point percentage, Rect rectangle)

Parameters

percentage

Point

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

rectangle

Rect

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

cs-api-definition
public static Point PointFromBarycentricPercentage(Point percentage, Size size)

Parameters

percentage

Point

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

cs-api-definition
public static Point PointOnLine(Point startPoint, Point endPoint, double distance)

Parameters

startPoint

Point

The start point.

endPoint

Point

The end point.

distance

double

The distance.

Returns

Point

PolarToCartesian(Point, double, double)

Polar to cartesian coordinates conversion.

Declaration

cs-api-definition
public static Point PolarToCartesian(Point coordinateCenter, double angle, double rho)

Parameters

coordinateCenter

Point

The coordinate center.

angle

double

The angle.

rho

double

The polar radius.

Returns

Point

PolylineToBezier(Collection<Point>)

The opposite of the approximation method, this attempts to smoothen out the polyline to a Bezier curve.

Declaration

cs-api-definition
public static IEnumerable<Point> PolylineToBezier(Collection<Point> points)

Parameters

points

Collection<Point>

The polyline.

Returns

IEnumerable<Point>

ProjectPointOnLine(Point, Point, Point)

Finds the projection (point) of the given point on the line.

Declaration

cs-api-definition
public static Point ProjectPointOnLine(Point point, Point lineStart, Point lineEnd)

Parameters

point

Point

lineStart

Point

lineEnd

Point

Returns

Point

Push(Point, Vector, double)

Pushes the specified start point onwards in the direction specified by the vector and a length given.

Declaration

cs-api-definition
public static Point Push(Point start, Vector unitVector, double distance)

Parameters

start

Point

The start.

unitVector

Vector

The unit vector.

distance

double

The distance to push.

Returns

Point

RotatePointsAt(IList<Point>, Point, double)

Rotates the points.

Declaration

cs-api-definition
public static IList<Point> RotatePointsAt(IList<Point> points, Point pivot, double angle)

Parameters

points

IList<Point>

pivot

Point

angle

double

Returns

IList<Point>

RotateTransform(Point, double)

Rotates the transform.

Declaration

cs-api-definition
public static RotateTransform RotateTransform(Point center, double angle)

Parameters

center

Point

The center.

angle

double

The angle.

Returns

RotateTransform

SafeDivide(double, double, double)

Safes the divide.

Declaration

cs-api-definition
public static double SafeDivide(double value1, double value2, double fallback)

Parameters

value1

double

The value1.

value2

double

The value2.

fallback

double

The fallback.

Returns

double

SameSide(Point, Point, Point, Point)

Determine whether point1 and point2 are on the same side of a line.

Declaration

cs-api-definition
public static bool SameSide(Point lineStart, Point lineEnd, Point point1, Point point2)

Parameters

lineStart

Point

lineEnd

Point

point1

Point

point2

Point

Returns

bool

SegmentIntersect(Point, Point, Point, Point, ref Point)

Checks whether the segments defined by the specified point pairs intersect and returns the intersection point.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static bool SegmentIntersect(Point segmentStart, Point segmentEnd, Point lineStart, Point lineEnd, ref Point result)

Parameters

segmentStart

Point

segmentEnd

Point

lineStart

Point

lineEnd

Point

result

Point

Returns

bool

Snap(double, int)

Snaps the specified value.

Declaration

cs-api-definition
public static double Snap(this double value, int snappingValue)

Parameters

value

double

The value.

snappingValue

int

The snapping value.

Returns

double

Square(double)

Squares the specified value.

Declaration

cs-api-definition
public static double Square(double value)

Parameters

value

double

Any value.

Returns

double

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

cs-api-definition
public static Vector StairValue(Point point, Rect rectangle)

Parameters

point

Point

The point to test.

rectangle

Rect

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.

StairValue(double, double, double)

Returns zero within the given interval and +/-1 whether the value is above or below the interval.

Declaration

cs-api-definition
public static int StairValue(double value, double lower, double upper)

Parameters

value

double

The argument of the function.

lower

double

The lower value of the interval.

upper

double

The upper value of the interval.

Returns

int

Zero, -1 or +1 whether the value is below, inside, or above the interval.

Swap(ref Point, ref Point)

Swaps the values of the two points.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static void Swap(ref Point point1, ref Point point2)

Parameters

point1

Point

A point.

point2

Point

Another point.

Swap(ref double, ref double)

Swaps the values of the two numbers.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")]
public static void Swap(ref double value1, ref double value2)

Parameters

value1

double

A value.

value2

double

Another value.

ToDegrees(double)

Converts the specified value from radians to degrees.

Declaration

cs-api-definition
public static double ToDegrees(this double radians)

Parameters

radians

double

Returns

double

ToDoubleCollection(string)

DoubleCollection from a string representation.

Declaration

cs-api-definition
public static DoubleCollection ToDoubleCollection(string value)

Parameters

value

string

Returns

DoubleCollection

ToEnum<T>(object)

Returns value of the enumeration.

Declaration

cs-api-definition
public static T ToEnum<T>(object value)

Parameters

value

object

The value.

Returns

T

ToInvariant(DoubleCollection)

Converts the double collection to a string representation.

Declaration

cs-api-definition
public static string ToInvariant(this DoubleCollection collection)

Parameters

collection

DoubleCollection

The collection.

Returns

string

ToInvariant(IList<Point>)

Returns a string serialization of the given point collection.

Declaration

cs-api-definition
public static string ToInvariant(this IList<Point> points)

Parameters

points

IList<Point>

The points.

Returns

string

ToInvariant(Point)

Converts the point to a string representation.

Declaration

cs-api-definition
public static string ToInvariant(this Point point)

Parameters

point

Point

The point.

Returns

string

ToInvariant(Size)

Converts the point to a string representation.

Declaration

cs-api-definition
public static string ToInvariant(this Size size)

Parameters

size

Size

The size.

Returns

string

ToInvariant(double)

Converts the double to a string representation.

Declaration

cs-api-definition
public static string ToInvariant(this double value)

Parameters

value

double

The value.

Returns

string

ToInvariant(int)

Converts the integer to a string representation.

Declaration

cs-api-definition
public static string ToInvariant(this int value)

Parameters

value

int

The value.

Returns

string

ToPoint(string)

Attempts to convert the given string to a points.

Declaration

cs-api-definition
public static Point? ToPoint(string point)

Parameters

point

string

The string representation of the point.

Returns

Point?

The Point corresponding to the serialized form.

ToPoints(string)

Attempts to convert the given string to a list of points.

Declaration

cs-api-definition
public static IList<Point> ToPoints(string points)

Parameters

points

string

The string representation of the points.

Returns

IList<Point>

The points corresponding to the serialized form.

ToRadians(double)

Converts the specified value from degrees to radians.

Declaration

cs-api-definition
public static double ToRadians(this double degrees)

Parameters

degrees

double

Returns

double

ToRect(Size)

Return a rectangle located a (0.0) with the specified size.

Declaration

cs-api-definition
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

cs-api-definition
public static Size? ToSize(string size)

Parameters

size

string

Returns

Size?

ToUnit(Point)

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

Declaration

cs-api-definition
public static Point ToUnit(this Point point)

Parameters

point

Point

Returns

Point

Union(Rect, Rect)

Unions two rectangles.

Declaration

cs-api-definition
public static Rect Union(Rect rect1, Rect rect2)

Parameters

rect1

Rect

The first rectangle.

rect2

Rect

The second rectangle.

Returns

Rect

Union of the two rectangles.

UnitVector(double)

Returns a unit vector in the direction specified by the angle.

Declaration

cs-api-definition
public static Vector UnitVector(double degrees)

Parameters

degrees

double

The angle in degrees.

Returns

Vector

A unit vector.

UppercaseFirstLetter(string)

Uppercases the first letter of the string.

Declaration

cs-api-definition
public static string UppercaseFirstLetter(this string value)

Parameters

value

string

An arbitrary string.

Returns

string

In this article
DefinitionFieldsEpsilonMethodsApproximateArc(Point, Point, double, double)ApproximateBezierCurve(Point[], int)ApproximateEllipse(Rect, double)ApproximateRoundedRectangle(Rect, double)ApproximateRoundedRectangle(double, double, double, double, double)ArcConvert(Rect, double, double, out Point, out Point, out bool, out SweepDirection)AreClose(double, double)AreLinesIntersecting(Point, Point, Point, Point, ref Point)BarycentricPercentageFromPoint(Point, Rect)BetweenOrEqual(double, double, double)CartesianToPolar(Point, Point, ref double, ref double)Closer(Point, Point, Point)Closer(double, double, double)Closer(double, double, double, out double, out double)CoerceAngle(double)Constrain(double, double, double)Delta(Point, Point)Determinant(Point, Point)Distance(double, double)DistancePoint(Point, Point, Point)DistanceSquared(Point, Point)Dot(Point, Point)Dot(Vector, Vector)DoubleFromMantissaAndExponent(double, int)EnsureRange(double, double?, double?)FindAngle(Point, Point)FindAngle(Point, Point, Point)FindIntersectionPoint(Rect, double, Point, Point, GlidingStyle)FindLinesIntersection(Point, Point, Point, Point, bool)FindRadian(Point, Point)FindRadian(Point, Point, Point)GetAssemblyName(Assembly)GetBezierPoint(Collection<Point>, int, double)GetBottomRightPoint(IEnumerable<Point>)GetBounds(IList<Point>)GetChildElements(XElement)GetEllipsePointAtAngle(Rect, double)GetEnumValues<T>()GetNormalizationPoint(IEnumerable<Point>)GetNormalizedPoints(IEnumerable<Point>)GetProjections(Point, Rect, Point[])GetPythagorEqualSide(double)GetPythagorHypotenuse(double, double)GetTopLeftPoint(IEnumerable<Point>)HasValidArea(Size)Hypotenuse(double, double)Intersect(Point[])IntersectionPointOnEllipse(Collection<Point>, Point, Point, ref Point)IntersectionPointOnEllipse(Rect, Point, Point, ref Point)IntersectionPointOnRectangle(Rect, Point, Point, ref Point)InvertPoint(Point)IsCounterClockWise(Point, Point, Point)IsEqual(double, double)IsFiniteDouble(double)IsGreaterThan(double, double)IsGreaterThanOrClose(double, double)IsInClosedInterval(double, double, double)IsInRightOpenInterval(double, double, double)IsLessOrEqual(double, double)IsLessThan(double, double)IsLessThanOrClose(double, double)IsNanOrInfinity(Point)IsNanOrInfinity(double)IsNotEqual(double, double)IsPointInEllipse(Point, Rect)IsPointInRectangle(Point, Size)IsVerySmall(double)Length(Point)Lerp(Point, Point, double)Lerp(Vector, Vector, double)Lerp(double, double, double)Limit(Point, Rect)MiddlePoint(Point, Point)MirrorHorizontally(Vector)MirrorPoint(Point, Point)MirrorPoint(Point, Point, Point)MirrorVertically(Vector)NearestIntersectionPoint(Point, Point, IList<Point>, ref Point)NearestPoint(Point, IEnumerable<Point>)Normal(Point, Point)NormalizeAngle(double)Normalized(Vector)Offset(IEnumerable<Point>, Vector)Offset(IList<Point>, IList<Point>, Vector)Perpendicular(Vector)PointFromBarycentricPercentage(Point, Rect)PointFromBarycentricPercentage(Point, Size)PointOnLine(Point, Point, double)PolarToCartesian(Point, double, double)PolylineToBezier(Collection<Point>)ProjectPointOnLine(Point, Point, Point)Push(Point, Vector, double)RotatePointsAt(IList<Point>, Point, double)RotateTransform(Point, double)SafeDivide(double, double, double)SameSide(Point, Point, Point, Point)SegmentIntersect(Point, Point, Point, Point, ref Point)Snap(double, int)Square(double)StairValue(Point, Rect)StairValue(double, double, double)Swap(ref Point, ref Point)Swap(ref double, ref double)ToDegrees(double)ToDoubleCollection(string)ToEnum<T>(object)ToInvariant(DoubleCollection)ToInvariant(IList<Point>)ToInvariant(Point)ToInvariant(Size)ToInvariant(double)ToInvariant(int)ToPoint(string)ToPoints(string)ToRadians(double)ToRect(Size)ToSize(string)ToUnit(Point)Union(Rect, Rect)UnitVector(double)UppercaseFirstLetter(string)
Not finding the help you need?
Contact Support