Class LayoutUtils
Utilities for layout operations.
Inheritance
Inherited Members
Namespace: GraphShape.Algorithms.Layout
Assembly: GraphShape.dll
Syntax
public static class LayoutUtils
Methods
| Improve this Doc View SourceFillWithRandomPositions<TVertex>(Double, Double, Double, Double, IEnumerable<TVertex>, IDictionary<TVertex, Point>, Random)
Initializes the positions of the vertices. Assigns a random position inside the 'bounding box' to the vertices without positions.
It does NOT modify the position of the other vertices.
Bounding box:
x coordinates: double.Epsilon - width
y coordinates: double.Epsilon - height
Declaration
public static void FillWithRandomPositions<TVertex>(double width, double height, double translateX, double translateY, IEnumerable<TVertex> vertices, IDictionary<TVertex, Point> verticesPositions, Random random)
Parameters
Type | Name | Description |
---|---|---|
System.Double | width | Width of the bounding box. |
System.Double | height | Height of the bounding box. |
System.Double | translateX | Translates the generated x coordinate. |
System.Double | translateY | Translates the generated y coordinate. |
System.Collections.Generic.IEnumerable<TVertex> | vertices | Vertices to fill positions. |
System.Collections.Generic.IDictionary<TVertex, Point> | verticesPositions | Initial vertices positions. |
System.Random | random | Random number generator to use. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
GetClippingPoint(Size, Point, Point)
Computes the clipping point based on clipping rectangle
size
and two points (center
and p
)).
Declaration
public static Point GetClippingPoint(Size size, Point center, Point p)
Parameters
Type | Name | Description |
---|---|---|
Size | size | Clipping zone size. |
Point | center | Center of the clipping zone. |
Point | p | Point to clip. |
Returns
Type | Description |
---|---|
Point | Clipping point. |
IsSameDirection(Vector, Vector)
Checks if both Vectors have the same direction.
Declaration
public static bool IsSameDirection(Vector a, Vector b)
Parameters
Type | Name | Description |
---|---|---|
Vector | a | First vector. |
Vector | b | Second vector. |
Returns
Type | Description |
---|---|
System.Boolean | True if both vectors have the same direction, false otherwise. |
NormalizePositions<TVertex>(IDictionary<TVertex, Point>)
Normalizes the given verticesPositions
.
Declaration
public static void NormalizePositions<TVertex>(IDictionary<TVertex, Point> verticesPositions)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TVertex, Point> | verticesPositions | Vertices positions to normalize. |
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |