Vector, Vector3D, Point and Point3D for netstandard1.3
There are several types (structs) of points available:
Point - point with coordinates of type double
using VectorAndPoint.ValTypes;
//...........................
var point = new Point(0.5, 10.3);PointInt - point with coordinates of type int
using VectorAndPoint.ValTypes;
//...........................
var point = new PointInt(1, 2);Point3D - point with coordinates of type double in three-dimensional space
using VectorAndPoint.ValTypes;
//...........................
var point = new Point3D(1, 2, 3);There are two types (structs) of vectors available:
Vector - vector with coordinates of type double
using VectorAndPoint.ValTypes;
//...........................
var vector = new Vector(0.5, 10.3);Vector3D - vector with coordinates of type double in three-dimensional space
using VectorAndPoint.ValTypes;
//...........................
var vector = new Vector3D(1, 2, 3);All types overrides method ToString() for representating value as (X, Y) for two-dimensional and (X, Y, Z) for three-dimensional structure.
Comparison via Equals() or operators == and != has compare each coordinate or component of both structure.
var point = new Point(0.5, 3.14);
var vector = new Vector(1, 2);
var resultVector1 = point + vector; //result is point with coordinates (1.5, 5.14)
var resultVector2 = vector + point; //result is point with coordinates (1.5, 5.14)Point has static method GetRangeBetween() for calculation of range between two points.
You can multiply a vector by a number to change the length of a vector. You can also add two vectors together.
var vector1 = new Vector(1, 2);
var factor = 3; //int, double or float
var vector2 = vector1 * factor; //(3, 6)
var vector1PlusVector2 = vector1 + vector2 //(4, 8)Scalar product of two vectors:
var vector1 = new Vector(1, 0);
var vector2 = new Vector(2, 2);
double result = vector1.GetScalarProductWith(vector2); // 2
//or static
double result = Vector.GetScalarProduct(vector1, vector2); // 2Checking vectors collinearity:
var vector1 = new Vector(1, 0);
var vector2 = new Vector(2, 2);
bool result = vector1.IsCollinearWith(vector2); // false
//or static
bool result = Vector.IsCollinear(vector1, vector2); // false