本文整理匯總了C#中NGenerics.DataStructures.Mathematical.Vector2D類的典型用法代碼示例。如果您正苦於以下問題:C# Vector2D類的具體用法?C# Vector2D怎麽用?C# Vector2D使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Vector2D類屬於NGenerics.DataStructures.Mathematical命名空間,在下文中一共展示了Vector2D類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Simple
public void Simple()
{
var vector = new Vector2D(4, 7);
vector.Increment();
Assert.AreEqual(5, vector.X);
Assert.AreEqual(8, vector.Y);
}
示例2: OperatorDivideDoubleExample
public void OperatorDivideDoubleExample()
{
var vector2D = new Vector2D(4, 12);
var vector = vector2D/2;
Assert.AreEqual(2, vector.X);
Assert.AreEqual(6, vector.Y);
}
示例3: Simple
public void Simple()
{
var vector = new Vector2D { X = 1, Y = 2 };
Assert.AreNotEqual(0, vector.GetHashCode());
Assert.AreEqual(1, vector.X);
Assert.AreEqual(2, vector.Y);
}
示例4: ExceptionLeftNull
public void ExceptionLeftNull()
{
const Vector2D vector1 = null;
var vector2 = new Vector2D(2, 2);
var condition = vector1 <= vector2;
}
示例5: Simple
public void Simple()
{
var vector = new Vector2D { X = 1, Y = 2 };
vector.SetValues(4, 6);
Assert.AreEqual(4, vector.X);
Assert.AreEqual(6, vector.Y);
}
示例6: ExceptionRightNull
public void ExceptionRightNull()
{
var vector1 = new Vector2D(2, 2);
const Vector2D vector2 = null;
var condition = vector1 >= vector2;
}
示例7: Simple
public void Simple()
{
var vector2D = new Vector2D();
Assert.AreEqual(2, vector2D.DimensionCount);
Assert.AreEqual(0, vector2D.X);
Assert.AreEqual(0, vector2D.Y);
}
示例8: OperatorDivideVectorExample
public void OperatorDivideVectorExample()
{
var vector2D1 = new Vector2D(4, 8);
var vector2D2 = new Vector2D(2, 2);
var vector = vector2D1/vector2D2;
Assert.AreEqual(1, vector.X);
Assert.AreEqual(2, vector.Y);
}
示例9: AbsoluteMaximumExample
public void AbsoluteMaximumExample()
{
var vector1 = new Vector2D(1, -4);
Assert.AreEqual(4, vector1.AbsoluteMaximum());
var vector2 = new Vector2D(5, -4);
Assert.AreEqual(5, vector2.AbsoluteMaximum());
}
示例10: Simple
public void Simple()
{
var vector = new Vector2D(23, 21);
vector.Normalize();
Assert.AreEqual(1, vector.Magnitude());
}
示例11: Simple
public void Simple()
{
var vector = new Vector2D(1, -4);
Assert.AreEqual(-4, vector.Minimum());
Assert.AreEqual(1, vector.X);
Assert.AreEqual(-4, vector.Y);
}
示例12: AbsoluteMinimumIndexExample
public void AbsoluteMinimumIndexExample()
{
var vector1 = new Vector2D(1, -4);
Assert.AreEqual(0, vector1.AbsoluteMinimumIndex());
var vector2 = new Vector2D(-4, 1);
Assert.AreEqual(1, vector2.AbsoluteMinimumIndex());
}
示例13: Simple
public void Simple()
{
var vector2D = new Vector2D(4, 7);
vector2D--;
Assert.AreEqual(3, vector2D.X);
Assert.AreEqual(6, vector2D.Y);
}
示例14: AddDoubleExample
public void AddDoubleExample()
{
var vector = new Vector2D(4, 7);
vector.Add(1);
Assert.AreEqual(5, vector.X);
Assert.AreEqual(8, vector.Y);
}
示例15: Simple
public void Simple()
{
var vector = new Vector2D(2, 3);
Assert.AreEqual(5, vector.Sum());
Assert.AreEqual(2, vector.X);
Assert.AreEqual(3, vector.Y);
}