Class Extensions
Static class containing common Ladybug static helper and extension methods
Inheritance
System.Object
Extensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Ladybug
Assembly: ladybug.dll
Syntax
public static class Extensions
Methods
| Improve this Doc View SourceAngleTo(Vector2, Vector2)
Gets the angle between two Vector2s
Declaration
public static float AngleTo(this Vector2 p1, Vector2 p2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | p1 | |
Microsoft.Xna.Framework.Vector2 | p2 |
Returns
Type | Description |
---|---|
System.Single |
Bezier(Vector2, Vector2, Vector2, Vector2, Single)
Interpolate a Bezier curve
Declaration
public static Vector2 Bezier(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float t)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | p0 | The curve's source node |
Microsoft.Xna.Framework.Vector2 | p1 | The "handle" of the curve's source node |
Microsoft.Xna.Framework.Vector2 | p2 | The "handle" of the curve's destination node |
Microsoft.Xna.Framework.Vector2 | p3 | The curve's destination node |
System.Single | t | The position along the curve, from 0.0f to 1.0f |
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |
DistanceTo(Vector2, Vector2)
Gets the distance between two Vector2s
Declaration
public static float DistanceTo(this Vector2 p1, Vector2 p2)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | p1 | |
Microsoft.Xna.Framework.Vector2 | p2 |
Returns
Type | Description |
---|---|
System.Single |
GetFeed<T>(List<T>, Int32, Int32)
Creates a new Feed<T> from a List
Declaration
public static Feed<T> GetFeed<T>(this List<T> list, int MaxLines, int startOffset = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<T> | list | Source List for Feed<T> |
System.Int32 | MaxLines | Maximum number of lines in Feed<T> |
System.Int32 | startOffset | Start line offset for Feed<T> |
Returns
Type | Description |
---|---|
Feed<T> |
Type Parameters
Name | Description |
---|---|
T |
GetReader(XmlDocument)
Returns an XmlReader for the given XmlDocument
Declaration
public static XmlReader GetReader(this XmlDocument document)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlDocument | document |
Returns
Type | Description |
---|---|
System.Xml.XmlReader |
Lerp(Single, Single, Single)
Linear Interpolation
Declaration
public static float Lerp(float p1, float p2, float by)
Parameters
Type | Name | Description |
---|---|---|
System.Single | p1 | |
System.Single | p2 | |
System.Single | by |
Returns
Type | Description |
---|---|
System.Single |
ToAngle(Vector2)
Gets an angle representation of a Vector2
Declaration
public static float ToAngle(this Vector2 vector)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | vector |
Returns
Type | Description |
---|---|
System.Single |
ToPoint(Vector2)
Gets a Point representation of a Vector2
Declaration
public static Point ToPoint(this Vector2 vector)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Xna.Framework.Vector2 | vector |
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Point |
ToVector2(Single)
Gets a Vector2 representation of an angle
Declaration
public static Vector2 ToVector2(this float angle)
Parameters
Type | Name | Description |
---|---|---|
System.Single | angle |
Returns
Type | Description |
---|---|
Microsoft.Xna.Framework.Vector2 |