Class Geometry
Contains static declarations for functions and constants used for performing calculations on points, lines, and rectangles.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Diagram
Assembly: Syncfusion.Diagram.Base.dll
Syntax
public class Geometry
Constructors
Geometry()
Declaration
public Geometry()
Fields
RadiansQuadrant1
Angle of quadrant 1 for a unit circle in radians.
Declaration
public static double RadiansQuadrant1
Field Value
Type |
---|
System.Double |
RadiansQuadrant2
Angle of quadrant 2 for a unit circle in radians.
Declaration
public static double RadiansQuadrant2
Field Value
Type |
---|
System.Double |
RadiansQuadrant3
Angle of quadrant 3 for a unit circle in radians.
Declaration
public static double RadiansQuadrant3
Field Value
Type |
---|
System.Double |
RadiansQuadrant4
Angle of quadrant 4 for a unit circle in radians.
Declaration
public static double RadiansQuadrant4
Field Value
Type |
---|
System.Double |
Methods
AppendMatrix(PointF, Matrix)
Appends the matrix to point.
Declaration
public static PointF AppendMatrix(PointF ptPoint, Matrix mtxTransform)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptPoint | The point. |
System.Drawing.Drawing2D.Matrix | mtxTransform | The matrix transform. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | The matrix point. |
AppendMatrix(RectangleF, Matrix)
Appends the matrix to rectangle.
Declaration
public static RectangleF AppendMatrix(RectangleF rcRect, Matrix mtxTransform)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcRect | The rectangle. |
System.Drawing.Drawing2D.Matrix | mtxTransform | The matrix transform. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
ArcFromPoints(Point, Point, out Rectangle, out Single, out Single)
Creates an arc given two points.
Declaration
public static void ArcFromPoints(Point pt1, Point pt2, out Rectangle rcBounds, out float startAngle, out float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | pt1 | First point. |
System.Drawing.Point | pt2 | Second point. |
System.Drawing.Rectangle | rcBounds | Output parameter to receive the bounds of the arc created. |
System.Single | startAngle | Output parameter to receive the start angle of the arc created. |
System.Single | sweepAngle | Output parameter to receive the end angle of the arc created. |
Remarks
The two points passed in are used to calculate the bounds of the arc and the start and end angle.
ArcFromPoints(PointF, PointF, out RectangleF, out Single, out Single)
Create arc from given points.
Declaration
public static void ArcFromPoints(PointF pt1, PointF pt2, out RectangleF rcBounds, out float startAngle, out float sweepAngle)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
System.Drawing.RectangleF | rcBounds | The bound rectangle. |
System.Single | startAngle | The start angle. |
System.Single | sweepAngle | The sweep angle. |
CalcEndpointDirections(PointF, PointF, out CompassHeading, out CompassHeading)
Calculate the optimal directions for the two specified points.
Declaration
public static void CalcEndpointDirections(PointF pt1, PointF pt2, out CompassHeading pt1Heading, out CompassHeading pt2Heading)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | First point in the line. |
System.Drawing.PointF | pt2 | Second point in the line. |
CompassHeading | pt1Heading | Heading calculated for the first point. |
CompassHeading | pt2Heading | Heading calculated for the second point. |
Remarks
This method is used for orthogonal lines. Given two points, this method determines the compass headings for the two points. The compass heading for each point determines which direction the line will attach to the point.
CalcHorizontalIntercept(PointF, PointF, Single, out Single)
Calcs the horizontal intercept.
Declaration
public static bool CalcHorizontalIntercept(PointF pt1, PointF pt2, float y, out float x)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The first point. |
System.Drawing.PointF | pt2 | The second point. |
System.Single | y | The y position. |
System.Single | x | The x position. |
Returns
Type | Description |
---|---|
System.Boolean | true, if calculate horizontal intercept |
CalcLineLength(PointF[])
Calcs the length of the line.
Declaration
public static double CalcLineLength(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The point array. |
Returns
Type | Description |
---|---|
System.Double | The line length |
CalcLineSegmentIntersect(LineSegment, LineSegment, out PointF)
Calcs the line segment intersect.
Declaration
public static bool CalcLineSegmentIntersect(LineSegment seg1, LineSegment seg2, out PointF ptIntersect)
Parameters
Type | Name | Description |
---|---|---|
LineSegment | seg1 | The first segment. |
LineSegment | seg2 | The second segment. |
System.Drawing.PointF | ptIntersect | The intersect point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if line segment intersect. |
CalcLineSegmentIntersect(PointF, PointF, PointF, PointF, ref PointF)
Calcs the line segment intersect.
Declaration
public static bool CalcLineSegmentIntersect(PointF ptStart1, PointF ptEnd1, PointF ptStart2, PointF ptEnd2, ref PointF ptIntersect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart1 | The first start point. |
System.Drawing.PointF | ptEnd1 | The first end point. |
System.Drawing.PointF | ptStart2 | The second start point. |
System.Drawing.PointF | ptEnd2 | The second end point. |
System.Drawing.PointF | ptIntersect | The intersect point. |
Returns
Type | Description |
---|---|
System.Boolean | true, line segment intersect. |
CalcLineSegmentIntersect(Single, Single, Single, Single, Single, Single, Single, Single, ref Single, ref Single)
Calcs the line segment intersect.
Declaration
public static bool CalcLineSegmentIntersect(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, ref float xi, ref float yi)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x0 | The first x. |
System.Single | y0 | The first y. |
System.Single | x1 | The second x. |
System.Single | y1 | The second y. |
System.Single | x2 | The third x. |
System.Single | y2 | The third y. |
System.Single | x3 | The four x. |
System.Single | y3 | The four y. |
System.Single | xi | The intersection x. |
System.Single | yi | The intersection y. |
Returns
Type | Description |
---|---|
System.Boolean | true, if line segment intersect. |
CalcOrthogonalPoints(PointF, CompassHeading, PointF, CompassHeading, Single, Single, Single, Single)
Calculate the orthogonal points.
Declaration
public static PointF[] CalcOrthogonalPoints(PointF ptEnd1, CompassHeading endPt1Heading, PointF ptEnd2, CompassHeading endPt2Heading, float padLeft, float padRight, float padTop, float padBottom)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptEnd1 | The tail end point position. |
CompassHeading | endPt1Heading | The tail end heading. |
System.Drawing.PointF | ptEnd2 | The head end point position. |
CompassHeading | endPt2Heading | The head end point heading. |
System.Single | padLeft | The pad left. |
System.Single | padRight | The pad right. |
System.Single | padTop | The pad top. |
System.Single | padBottom | The pad bottom. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The points. |
CalcVerticalIntercept(PointF, PointF, Single, out Single)
Calcs the vertical intercept.
Declaration
public static bool CalcVerticalIntercept(PointF pt1, PointF pt2, float x, out float y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The first point. |
System.Drawing.PointF | pt2 | The second point. |
System.Single | x | The x position. |
System.Single | y | The y position. |
Returns
Type | Description |
---|---|
System.Boolean | true, if calculate vertical intercept. |
CenterPoint(Point, Point)
Calculate centre point between start and end points.
Declaration
public static Point CenterPoint(Point ptStart, Point ptEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | ptStart | The start point. |
System.Drawing.Point | ptEnd | The end point. |
Returns
Type | Description |
---|---|
System.Drawing.Point | Centre point between start and end point. |
CenterPoint(PointF, PointF)
Calculate centre point between start and end points.
Declaration
public static PointF CenterPoint(PointF ptStart, PointF ptEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart | The start point. |
System.Drawing.PointF | ptEnd | The end point. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | Centre point between start and end point. |
CenterPoint(Rectangle)
Calculate center point in rectangle.
Declaration
public static Point CenterPoint(Rectangle rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rect | The rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.Point | The center point |
CenterPoint(RectangleF)
Calculate centre point in rectangle.
Declaration
public static PointF CenterPoint(RectangleF rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect | The rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | The center point. |
CheckOrthogonalLine(Point, Point, Point)
Checks whether point to test lies on line formed with start and end points.
Declaration
public static bool CheckOrthogonalLine(Point ptStart, Point ptEnd, Point ptTest)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | ptStart | Start point. |
System.Drawing.Point | ptEnd | End point. |
System.Drawing.Point | ptTest | Point to test. |
Returns
Type | Description |
---|---|
System.Boolean | The line. |
Remarks
Used with orthogonal lines to reduce the overhead of graphics path and region creation.
CheckOrthogonalLine(PointF, PointF, PointF)
Checks whether point to test lies on line formed with start and end points.
Declaration
public static bool CheckOrthogonalLine(PointF ptStart, PointF ptEnd, PointF ptTest)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart | Start point. |
System.Drawing.PointF | ptEnd | End point. |
System.Drawing.PointF | ptTest | Point to test. |
Returns
Type | Description |
---|---|
System.Boolean | true, if point is on the line. |
Remarks
Used with orthogonal lines to reduce the overhead of graphics path and region creation.
CheckPointOnLine(PointF, PointF, Int32)
Checks the point on line.
Declaration
public static bool CheckPointOnLine(PointF ptStart, PointF ptEnd, int nDigits)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart | The first point. |
System.Drawing.PointF | ptEnd | The second point. |
System.Int32 | nDigits | The point number to be routed. |
Returns
Type | Description |
---|---|
System.Boolean | true, if point is on the line. |
CompassHeadingToVector(CompassHeading)
Compasses the heading to vector.
Declaration
public static Size CompassHeadingToVector(CompassHeading heading)
Parameters
Type | Name | Description |
---|---|---|
CompassHeading | heading | The heading. |
Returns
Type | Description |
---|---|
System.Drawing.Size | The size. |
ConvertPoint(PointF)
Convert the System.Drawing.Point
to System.Drawing.PointF
Declaration
public static Point ConvertPoint(PointF ptPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptPoint | The given point. |
Returns
Type | Description |
---|---|
System.Drawing.Point | The point. |
ConvertPoints(Point[])
Converts the points.
Declaration
public static PointF[] ConvertPoints(Point[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point[] | pts | The point array. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The converted points. |
ConvertPoints(PointF[])
Converts the points.
Declaration
public static Point[] ConvertPoints(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The point array. |
Returns
Type | Description |
---|---|
System.Drawing.Point[] | The converted points. |
ConvertRectangle(RectangleF)
Converts the rectangle.
Declaration
public static Rectangle ConvertRectangle(RectangleF rcRect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcRect | The rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The converted rect. |
ConvertSize(SizeF)
Converts the size.
Declaration
public static Size ConvertSize(SizeF szSize)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.SizeF | szSize | The size. |
Returns
Type | Description |
---|---|
System.Drawing.Size | The converted size. |
ConvertToFullCircle(Single)
Converts from angle range [-180 ; 180 ] , to angle range [0; 360].
Declaration
public static float ConvertToFullCircle(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The angle. |
Returns
Type | Description |
---|---|
System.Single | The angle value. |
ConvertToPartCircle(Single)
Converts from angle range [0 ; 360 ] , to angle range [-180; 180].
Declaration
public static float ConvertToPartCircle(float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The angle. |
Returns
Type | Description |
---|---|
System.Single | The angle value. |
CounterClockwise(PointF, PointF, PointF)
Gets counters the clockwise.
Declaration
public static int CounterClockwise(PointF pt0, PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt0 | The first point. |
System.Drawing.PointF | pt1 | The second point. |
System.Drawing.PointF | pt2 | The third point. |
Returns
Type | Description |
---|---|
System.Int32 | The counter value. |
CreateRect(Point, Point)
Create a rectangle from two points.
Declaration
public static Rectangle CreateRect(Point pt1, Point pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | pt1 | First point. |
System.Drawing.Point | pt2 | Second point. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The Rectangle |
CreateRect(Point[])
Creates the System.Drawing.RectangleF from points array.
Declaration
public static Rectangle CreateRect(Point[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point[] | pts | The point array. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The rect. |
CreateRect(PointF, PointF)
Creates the System.Drawing.Rectangle.
Declaration
public static RectangleF CreateRect(PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The second point. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect |
CreateRect(PointF, SizeF)
Create right rectangle with converting negative size to offset location.
Declaration
public static RectangleF CreateRect(PointF ptCenter, SizeF szRect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptCenter | Rectangle's center point. |
System.Drawing.SizeF | szRect | Size for current rectangle. Can be negative. Later it was converted. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | Right rectangle without negative size. |
CreateRect(PointF[])
Creates the System.Drawing.RectangleF from points array.
Declaration
public static RectangleF CreateRect(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The points. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
CreateRegionFromGraphicsPath(GraphicsPath)
Creates a regions from given a graphics path.
Declaration
public static Region[] CreateRegionFromGraphicsPath(GraphicsPath gfxPath)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | gfxPath | Graphics path to create region from |
Returns
Type | Description |
---|---|
System.Drawing.Region[] | Region the graphics path occupies |
Remarks
This version of CreateRegionFromGraphicsPath does no conversion between logical units and pixels. It assumes that the caller has already performed any necessary conversion.
CreateRegionFromGraphicsPath(GraphicsPath, MeasureUnits)
Creates a region given a graphics path and measurement units.
Declaration
public static Region CreateRegionFromGraphicsPath(GraphicsPath grfxPath, MeasureUnits units)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | grfxPath | Graphics path to create region from. |
MeasureUnits | units | GraphicsPath's PathPoints measure units. |
Returns
Type | Description |
---|---|
System.Drawing.Region | Region the graphics path occupies |
Remarks
This method generates a region given a graphics path. The region created is always in pixel units. If the incoming graphics path is not in pixel units, the points in the graphics path are converted before generating the region.
CreateRhomb(PointF, SizeF)
Creates the rhomb shape.
Declaration
public static PointF[] CreateRhomb(PointF ptCenter, SizeF szBoundingRect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptCenter | The center point. |
System.Drawing.SizeF | szBoundingRect | The bounding rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The points |
EqualPoints(PointF, PointF, Int32)
Equals the two points.
Declaration
public static bool EqualPoints(PointF ptFirst, PointF ptSecond, int nDigits)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptFirst | The first point. |
System.Drawing.PointF | ptSecond | The second point. |
System.Int32 | nDigits | The digits count to be rounded. |
Returns
Type | Description |
---|---|
System.Boolean | true, if points are equal. |
GetAggregateBounds(NodeCollection)
Gets the aggregate bounds.
Declaration
public static RectangleF GetAggregateBounds(NodeCollection nodes)
Parameters
Type | Name | Description |
---|---|---|
NodeCollection | nodes | The node collection. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
GetAnchorPoint(RectangleF, BoxPosition)
Gets the anchor point.
Declaration
public static PointF GetAnchorPoint(RectangleF rect, BoxPosition anchor)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect | The rect. |
BoxPosition | anchor | The anchor. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | The anchor point. |
GetBoundaryIntercept(GraphicsPath, MeasureUnits, PointF, PointF, CompassHeading, out PointF)
Gets the boundary intercept.
Declaration
public static bool GetBoundaryIntercept(GraphicsPath grphPath, MeasureUnits units, PointF first, PointF second, CompassHeading heading, out PointF ptIntsct)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | grphPath | The grphPath to intercept. |
MeasureUnits | units | The units. |
System.Drawing.PointF | first | The first. |
System.Drawing.PointF | second | The second. |
CompassHeading | heading | The heading. |
System.Drawing.PointF | ptIntsct | The given point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if boundary intercept. |
GetBoundaryIntercept(GraphicsPath, MeasureUnits, PointF, PointF, out PointF)
The Region class internally rounds off floating point values to the nearest integer. This causes problems when using GraphicsUnit.Inches. Using Pixel units for calculating the region bounds helps avoid this round off error.
Declaration
public static bool GetBoundaryIntercept(GraphicsPath grfxPath, MeasureUnits units, PointF pt1, PointF pt2, out PointF ptIntercept)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | grfxPath | The node graphics path to intercept.. |
MeasureUnits | units | The units. |
System.Drawing.PointF | pt1 | The first point. |
System.Drawing.PointF | pt2 | The second point. |
System.Drawing.PointF | ptIntercept | The given point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if boundary intercept. |
GetBoundaryIntercept(GraphicsPath, PointF, BoxSide, out PointF)
Gets the boundary intercept.
Declaration
public static bool GetBoundaryIntercept(GraphicsPath grfxPath, PointF ptCentralPoint, BoxSide side, out PointF ptIntercept)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | grfxPath | The node to intercept. |
System.Drawing.PointF | ptCentralPoint | Central point. |
BoxSide | side | The side of box. |
System.Drawing.PointF | ptIntercept | The intercept point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if boundary intercept. |
GetBoundaryIntercept(RectangleF[], PointF, PointF, out PointF)
Gets the boundary intercepting.
Declaration
public static bool GetBoundaryIntercept(RectangleF[] rcScans, PointF ptInside, PointF ptOutside, out PointF ptIntercept)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF[] | rcScans | The region scans. |
System.Drawing.PointF | ptInside | The inside point. |
System.Drawing.PointF | ptOutside | The outside point. |
System.Drawing.PointF | ptIntercept | The intercept point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if boundary intercept. |
GetBoundaryIntercept(Region, PointF, PointF, out PointF)
Gets the boundary intercepting.
Declaration
public static bool GetBoundaryIntercept(Region rgn, PointF pt1, PointF pt2, out PointF ptIntercept)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Region | rgn | The shape region. |
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
System.Drawing.PointF | ptIntercept | The intercept point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if boundary intercept. |
GetBoundaryIntercepts(GraphicsPath, MeasureUnits, PointF, PointF[])
Returns the four points that intersect the given region along the X and Y axis extending from the given point.
Declaration
public static void GetBoundaryIntercepts(GraphicsPath grfxPath, MeasureUnits units, PointF ptTarget, PointF[] ptIntercepts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | grfxPath | The GRFX path. |
MeasureUnits | units | The units. |
System.Drawing.PointF | ptTarget | Point inside the region from which the X and Y axes extend |
System.Drawing.PointF[] | ptIntercepts | Array to receive values |
Remarks
This method is used to determine where to dock orthogonal lines at the boundaries of shapes. The points are returned in the following order: north, east, south, west, northeast, northwest, southeast, southwest.
GetBoundaryIntercepts(RectangleF, PointF, CompassHeading)
Gets the boundary intercepts.
Declaration
public static PointF[] GetBoundaryIntercepts(RectangleF rcBounds, PointF ptLocation, CompassHeading heading)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcBounds | The rectangle for interception check. |
System.Drawing.PointF | ptLocation | The end point what contains in rectangle. |
CompassHeading | heading | endpoint container commpassHeading. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | Array of interception points. Array contains eight points of eight commpasHeadng directions. |
GetBoundaryIntercepts(Region, PointF, PointF[])
Returns the four points that intersect the given region along the X and Y axis extending from the given point.
Declaration
public static void GetBoundaryIntercepts(Region rgn, PointF ptTarget, PointF[] ptIntercepts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Region | rgn | Region to find intercepts for |
System.Drawing.PointF | ptTarget | Point inside the region from which the X and Y axes extend |
System.Drawing.PointF[] | ptIntercepts | Array to receive values |
Remarks
This method is used to determine where to dock orthogonal lines at the boundaries of shapes. The points are returned in the following order: north, south, east, west.
GetBoundaryPoint(RectangleF, PointF, CompassHeading)
Gets the boundary point by compass heading checking only horizontal and vertical direction.
Declaration
public static PointF GetBoundaryPoint(RectangleF rcBounds, PointF ptInnerPoint, CompassHeading heading)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcBounds | The bounds to intersect. |
System.Drawing.PointF | ptInnerPoint | The point inside bounds. |
CompassHeading | heading | The intersect direction. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | Boundary side point. |
GetBoxSide(PointF, PointF)
Gets the box side of endpoint to start point.
Declaration
public static BoxSide GetBoxSide(PointF ptStartPoint, PointF ptEndPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStartPoint | The start point. |
System.Drawing.PointF | ptEndPoint | The end point. |
Returns
Type | Description |
---|---|
BoxSide | The box side. |
GetCompassHeading(EndPoint)
Gets the compass heading.
Declaration
public static CompassHeading GetCompassHeading(EndPoint endPoint)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | endPoint | The end point. |
Returns
Type | Description |
---|---|
CompassHeading | Compass heading. |
GetCompassHeading(RectangleF, PointF)
Gets the compass heading direction. Return only North, West, South, East or None value.
Declaration
public static CompassHeading GetCompassHeading(RectangleF rcBounds, PointF ptPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcBounds | The round area. |
System.Drawing.PointF | ptPoint | The outside point. |
Returns
Type | Description |
---|---|
CompassHeading | Heading direction. |
GetEndPointIndex(EndPoint, Int32, Int32)
Gets the endPoint index in given path points.
Declaration
public static int GetEndPointIndex(EndPoint endPoint, int nPathLength, int nDepthOffset)
Parameters
Type | Name | Description |
---|---|---|
EndPoint | endPoint | The end point. |
System.Int32 | nPathLength | Length of the points path in PathNode. |
System.Int32 | nDepthOffset | The offset to inside points range.. |
Returns
Type | Description |
---|---|
System.Int32 | The end point index. |
GetLineIntersect(PointF, PointF, RectangleF, out PointF[])
Gets the all line intersect points.
Declaration
public static int GetLineIntersect(PointF pt1, PointF pt2, RectangleF rect, out PointF[] ptsIntersect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
System.Drawing.RectangleF | rect | The bounding rectangle. |
System.Drawing.PointF[] | ptsIntersect | The intersect points. |
Returns
Type | Description |
---|---|
System.Int32 | Line intersect count. |
GetOrthogonalIntersect(PointF, PointF, PointF, PointF, out PointF)
Gets the intersecting point of two orthogonal line segments.
Declaration
public static bool GetOrthogonalIntersect(PointF pt1, PointF pt2, PointF pt3, PointF pt4, out PointF ptIntersect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | First point in first line segment |
System.Drawing.PointF | pt2 | Second point in first line segment |
System.Drawing.PointF | pt3 | First point in second line segment |
System.Drawing.PointF | pt4 | Second point in second line segment |
System.Drawing.PointF | ptIntersect | Point at which the orthogonal line segments intersect |
Returns
Type | Description |
---|---|
System.Boolean | true if an intersection exists; otherwise false |
Remarks
This method only returns an intersection point if one of the line segments is horizontal and the other is vertical. It does not calculate the intersection of lines that are not orthogonal to each other and parallel with the X and Y axes.
GetPointByOffset(PointF, PointF, Single)
Gets the point by offset.
Declaration
public static PointF GetPointByOffset(PointF ptStart, PointF ptEnd, float fOffsetFromEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptStart | The start point. |
System.Drawing.PointF | ptEnd | The end point. |
System.Single | fOffsetFromEnd | The offset from end to calculate new point. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | Point that contain line. |
GetProjection(PointF, PointF, PointF)
Get point projection to line.
Declaration
public static PointF GetProjection(PointF ptPoint, PointF ptLineStart, PointF ptLineEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptPoint | Point to projection. |
System.Drawing.PointF | ptLineStart | Line start point. |
System.Drawing.PointF | ptLineEnd | Line end point. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | Projection point that place in line. |
GetRouteBounds(ConnectionPoint)
Gets the route container bounds by connection point.
Declaration
public static RectangleF GetRouteBounds(ConnectionPoint port)
Parameters
Type | Name | Description |
---|---|---|
ConnectionPoint | port | The port. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | Route bounds. |
HitTestLine(PointF, PointF, PointF, Single)
Hit test line with slop.
Declaration
public static bool HitTestLine(PointF pt1, PointF pt2, PointF ptTest, float slop)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
System.Drawing.PointF | ptTest | The point to test. |
System.Single | slop | The slop value. |
Returns
Type | Description |
---|---|
System.Boolean | If line contain test point. |
IntToCompassHeading(Int32)
Convert integer value to compass heading enum.
Declaration
public static CompassHeading IntToCompassHeading(int val)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | val | The val. |
Returns
Type | Description |
---|---|
CompassHeading | Compass heading. |
IsOrthogonalLine(PointF[])
Determines whether points array creates orthogonal line.
Declaration
public static bool IsOrthogonalLine(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The points. |
Returns
Type | Description |
---|---|
System.Boolean |
|
LineAngle(Point, Point)
Gets angle between two points.
Declaration
public static double LineAngle(Point pt1, Point pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | pt1 | The first point. |
System.Drawing.Point | pt2 | The second point. |
Returns
Type | Description |
---|---|
System.Double | The angle. |
LineAngle(Point, Point, Point)
Gets angle between three points.
Declaration
public static double LineAngle(Point ptA, Point ptO, Point ptB)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | ptA | The point A. |
System.Drawing.Point | ptO | The origin point. |
System.Drawing.Point | ptB | The point B. |
Returns
Type | Description |
---|---|
System.Double | The angle. |
LineAngle(PointF, PointF)
Gets angle between two points.
Declaration
public static double LineAngle(PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The first point. |
System.Drawing.PointF | pt2 | The second point. |
Returns
Type | Description |
---|---|
System.Double | The angle. |
LineAngle(PointF, PointF, PointF)
Gets angle between three points.
Declaration
public static double LineAngle(PointF ptA, PointF ptO, PointF ptB)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptA | The point A. |
System.Drawing.PointF | ptO | The origin point. |
System.Drawing.PointF | ptB | The point B. |
Returns
Type | Description |
---|---|
System.Double | The angle. |
LinesIntersect(GraphicsPath, PointF, PointF)
Intersect lines.
Declaration
public static bool LinesIntersect(GraphicsPath gfxNodePath, PointF ptStart, PointF ptEnd)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Drawing2D.GraphicsPath | gfxNodePath | The graphics node path. |
System.Drawing.PointF | ptStart | The start point. |
System.Drawing.PointF | ptEnd | The end point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if lines intersect |
LinesIntersect(PointF, PointF, PointF, PointF)
Check for intersecting between two lines.
Declaration
public static bool LinesIntersect(PointF pt0, PointF pt1, PointF pt2, PointF pt3)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt0 | The first start point. |
System.Drawing.PointF | pt1 | The first end point. |
System.Drawing.PointF | pt2 | The second start point. |
System.Drawing.PointF | pt3 | The second end point. |
Returns
Type | Description |
---|---|
System.Boolean | true, if line intersect. |
LineSlope(Point, Point)
Calculate line slope.
Declaration
public static double LineSlope(Point pt1, Point pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point | pt1 | The start point. |
System.Drawing.Point | pt2 | The end point. |
Returns
Type | Description |
---|---|
System.Double | The line slope. |
LineSlope(PointF, PointF)
Calculate line slope.
Declaration
public static double LineSlope(PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
Returns
Type | Description |
---|---|
System.Double | The line slope. |
MergeDuplicateLineSegments(ArrayList, Int32)
Merge the duplicate line segments.
Declaration
public static void MergeDuplicateLineSegments(ArrayList pts, int mergeThreshold)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ArrayList | pts | The array of Point. |
System.Int32 | mergeThreshold | The merge threshold. |
MergeDuplicateLineSegmentsF(ArrayList, Single)
Merge the duplicate line segments.
Declaration
public static void MergeDuplicateLineSegmentsF(ArrayList pts, float mergeThreshold)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ArrayList | pts | The array of PointF. |
System.Single | mergeThreshold | The merge threshold. |
MergePointsInLine(PointF[])
Merges the points in line.
Declaration
public static PointF[] MergePointsInLine(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The array of PointF. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The points. |
MergePointsInLine(PointF[], Int32, Int32)
Merges the points in line.
Declaration
public static PointF[] MergePointsInLine(PointF[] ptsPath, int nIndex, int nLength)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | ptsPath | The array of PointF. |
System.Int32 | nIndex | Start index of the range. |
System.Int32 | nLength | Range length . |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The points. |
MoveLineSegment(Point[], Int32, Int32)
Moves the line segment.
Declaration
public static Point[] MoveLineSegment(Point[] pts, int segIdx, int distance)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Point[] | pts | The point array. |
System.Int32 | segIdx | The segment idx. |
System.Int32 | distance | The distance. |
Returns
Type | Description |
---|---|
System.Drawing.Point[] | The line segments. |
MoveLineSegment(PointF[], Int32, Single, Single)
Moves the line segment.
Declaration
public static PointF[] MoveLineSegment(PointF[] pts, int segIdx, float distance, float mergeThreshold)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | The points. |
System.Int32 | segIdx | The segment index. |
System.Single | distance | The distance. |
System.Single | mergeThreshold | The merge threshold. |
Returns
Type | Description |
---|---|
System.Drawing.PointF[] | The line segments. |
PointDistance(PointF, PointF)
Calculate distance between two points.
Declaration
public static double PointDistance(PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | The start point. |
System.Drawing.PointF | pt2 | The end point. |
Returns
Type | Description |
---|---|
System.Double | Distance between the points. |
RectIntersectsWithLineSegment(RectangleF, PointF, PointF)
Check if line segment intersects with rectangle.
Declaration
public static bool RectIntersectsWithLineSegment(RectangleF rect, PointF pt1, PointF pt2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect | The rectangle to check. |
System.Drawing.PointF | pt1 | The first point in line segment. |
System.Drawing.PointF | pt2 | The second point in line segment. |
Returns
Type | Description |
---|---|
System.Boolean | true, if intersect with line segment. |
RectIntersectsWithLineSegment(RectangleF, PointF, PointF, out PointF)
Declaration
public static bool RectIntersectsWithLineSegment(RectangleF r, PointF p1, PointF p2, out PointF ptIntersect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | r | |
System.Drawing.PointF | p1 | |
System.Drawing.PointF | p2 | |
System.Drawing.PointF | ptIntersect |
Returns
Type |
---|
System.Boolean |
RotatePointAt(Single, PointF, ref PointF)
Rotate given point around anchor point.
Declaration
public static void RotatePointAt(float angle, PointF ptAnchor, ref PointF ptPoint)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle | The angle to rotate. |
System.Drawing.PointF | ptAnchor | The anchor point. |
System.Drawing.PointF | ptPoint | The point to rotate. |
Remarks
This rotate method used only double numbers to get a tru-running.
RouteEndPointToHeading(ref PointF[], EndPoint, Single)
Route the head end point to current heading.
Declaration
public static bool RouteEndPointToHeading(ref PointF[] ptsPath, EndPoint endPoint, float fRouteDistance)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | ptsPath | The last path points. |
EndPoint | endPoint | The end point. |
System.Single | fRouteDistance | The route distance. |
Returns
Type | Description |
---|---|
System.Boolean | true, if head end point is routed to current heading. |
TestOrthogonalIntersect(PointF, PointF, PointF, PointF)
Test two orthogonal line segments to determine if they intersect.
Declaration
public static bool TestOrthogonalIntersect(PointF pt1, PointF pt2, PointF pt3, PointF pt4)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | First point in first line segment |
System.Drawing.PointF | pt2 | Second point in first line segment |
System.Drawing.PointF | pt3 | First point in second line segment |
System.Drawing.PointF | pt4 | Second point in second line segment |
Returns
Type | Description |
---|---|
System.Boolean | true if an intersection exists; otherwise false |
Remarks
This method only returns true if one of the line segments is horizontal and the other is vertical and the two line segments cross.
TestOrthogonalIntersect(PointF, PointF, RectangleF)
Tests the given orthogonal line segment to see if it intersects the given rectangle.
Declaration
public static bool TestOrthogonalIntersect(PointF pt1, PointF pt2, RectangleF rect)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | pt1 | First point on the line segment |
System.Drawing.PointF | pt2 | Second point on the line segment |
System.Drawing.RectangleF | rect | Rectangle to test |
Returns
Type | Description |
---|---|
System.Boolean | true if they intersect, otherwise false |
Remarks
This method only works if the line segment is either horizontal or vertical. In other words, the line segment must be parallel to either the X or Y axis.
TranslateToGridOrigin(PointF[])
Translates points to grid origin (0,0)
Declaration
public static void TranslateToGridOrigin(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | points to move. |
TranslateToOrigin(PointF[], PointF)
Translates points to given origin.
Declaration
public static void TranslateToOrigin(PointF[] pts, PointF ptOrigin)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | Points to move. |
System.Drawing.PointF | ptOrigin | Origin to move points to. |
Union(Rectangle, Rectangle)
Unions the specified rectangle.
Declaration
public static Rectangle Union(Rectangle rect1, Rectangle rect2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rect1 | The first rectangle. |
System.Drawing.Rectangle | rect2 | The second rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The rect. |
Union(RectangleF, RectangleF)
Unions the specified rectangle.
Declaration
public static RectangleF Union(RectangleF rect1, RectangleF rect2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rect1 | The first rectangle. |
System.Drawing.RectangleF | rect2 | The second rectangle. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
Union(RectangleF[])
Unions the specified rectangles.
Declaration
public static RectangleF Union(RectangleF[] rects)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF[] | rects | The rectangle array. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
UpdatePointsOfPolyLine(PointF[])
Updates the path points of the polyline connector.
Declaration
public static PointF[] UpdatePointsOfPolyLine(PointF[] pts)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF[] | pts | Path points of the polyline connector. |
Returns
Type |
---|
System.Drawing.PointF[] |
UpdateRectWith(Rectangle, Rectangle)
Updates given rect with another.
Declaration
public static Rectangle UpdateRectWith(Rectangle rcUpdating, Rectangle rcToUpdateWith)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Rectangle | rcUpdating | Updating rectangle. |
System.Drawing.Rectangle | rcToUpdateWith | Rectangle to update with. |
Returns
Type | Description |
---|---|
System.Drawing.Rectangle | The rect |
Remarks
If updating rectangle is empty it is replaced with rectangle to update with.
UpdateRectWith(RectangleF, RectangleF)
Updates given rect with another.
Declaration
public static RectangleF UpdateRectWith(RectangleF rcUpdating, RectangleF rcToUpdateWith)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcUpdating | Updating rectangle. |
System.Drawing.RectangleF | rcToUpdateWith | Rectangle to update with. |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The rect. |
Remarks
If updating rectangle is empty it is replaced with rectangle to update with.
WidenPoint(PointF, BoxSide, Single)
Widens the point.
Declaration
public static PointF WidenPoint(PointF ptPoint, BoxSide side, float width)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | ptPoint | The given point. |
BoxSide | side | The box side. |
System.Single | width | The widen width. |
Returns
Type | Description |
---|---|
System.Drawing.PointF | The widen point. |
WidenRect(RectangleF, Single)
Scale rectangle to given width.
Declaration
public static RectangleF WidenRect(RectangleF rcRect, float fWidth)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rcRect | The given rectangle. |
System.Single | fWidth | The widen width . |
Returns
Type | Description |
---|---|
System.Drawing.RectangleF | The widen rect. |