Click or drag to resize
Vector Class

A classic algebraic vector class. This class contains methods that are integral to complex movement algorithms within the Terrarium.

Inheritance Hierarchy
SystemObject
  Terrarium.Sdk.Classes.HelpersVector

Namespace: Terrarium.Sdk.Classes.Helpers
Assembly: Terrarium.Sdk (in Terrarium.Sdk.dll) Version: 1.1.0.0 (1.1.0.0)
Syntax
public class Vector

The Vector type exposes the following members.

Constructors
  NameDescription
Public methodVector(Point)

Constructs a new Vector using System.Drawing.Point

Public methodVector(Double, Double)

Constructs a new Vector using an x and y coordinate pair.

Top
Methods
  NameDescription
Public methodStatic memberAdd

Helper function that adds the components values of a point to an existing vector and returns the result as a new Point.

Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUnitVector

Used to get the unit vector for the current vector. The unit vector should have no component greater than 1.

Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRotate

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.

Public methodScale

Scales a vector by a constant value and returns a new vector.

Public methodStatic memberSubtract

Helper function that subtracts two points and computes the resulting vector.

Public methodStatic memberToDegrees

Helper function used to convert radians to degrees.

Public methodStatic memberToRadians

Helper function used to convert degrees to radians.

Public methodToString

Converts the given vector into a textual representation useful for debugging purposes.

(Overrides ObjectToString.)
Top
Properties
  NameDescription
Public propertyDirection

Returns the direction of the vector in Radians with 0 facing East up to 2pi.

Public propertyMagnitude

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%.

Public propertyPoint

Returns the x,y coordinate pair in the form of a System.Drawing.Point

Public propertyTrueMagnitude

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.

Public propertyX

Used to retrieve the X component of the vector.

Public propertyY

Used to retrieve the Y component of the vector.

Top
See Also