Vector Class |
A classic algebraic vector class. This class contains methods that are integral to complex movement algorithms within the Terrarium.
Namespace: Terrarium.Sdk.Classes.Helpers
The Vector type exposes the following members.
Name | Description | |
---|---|---|
![]() | Vector(Point) | Constructs a new Vector using System.Drawing.Point |
![]() | Vector(Double, Double) | Constructs a new Vector using an x and y coordinate pair. |
Name | Description | |
---|---|---|
![]() ![]() | Add | Helper function that adds the components values of a point to an existing vector and returns the result as a new Point. |
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetUnitVector | Used to get the unit vector for the current vector. The unit vector should have no component greater than 1. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | Rotate | Rotates a vector about the origin by an angle given in Radians radians. A point (x,y) can be rotated around the origin (0,0) by running it through the following equations to get the new point (x',y'): x' = cos(theta)*x - sin(theta)*y y' = sin(theta)*x + cos(theta)*y where theta is the angle by which to rotate the point. |
![]() | Scale | Scales a vector by a constant value and returns a new vector. |
![]() ![]() | Subtract | Helper function that subtracts two points and computes the resulting vector. |
![]() ![]() | ToDegrees | Helper function used to convert radians to degrees. |
![]() ![]() | ToRadians | Helper function used to convert degrees to radians. |
![]() | ToString | Converts the given vector into a textual representation useful for debugging purposes. |
Name | Description | |
---|---|---|
![]() | Direction | Returns the direction of the vector in Radians with 0 facing East up to 2pi. |
![]() | Magnitude | Used to compute the magnitude of the vector with respect to the origin. Returns a very fast approximate magnitude using a Taylor function accurate to within 10%. |
![]() | Point | Returns the x,y coordinate pair in the form of a System.Drawing.Point |
![]() | TrueMagnitude | Used to compute the real magnitude of the vector with respect to the origin. Returns a very accurate magnitude result. However, this function tends to run much slower than an approximation. For this reason the Terrarium uses the Magnitude property internally. |
![]() | X | Used to retrieve the X component of the vector. |
![]() | Y | Used to retrieve the Y component of the vector. |