本文整理汇总了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);
}