Two lines are collinear if scalar multiplication of two vectors equals absolute value of a multiplication their length (it works in 3D).
Simply write a method that calculate scalar multiplication
private double scalarMultiply(Vector L1, Vector L2)
{
return L1.X()*L2.X() + L1.Y()*L2.Y() + L1.Z()*L2.Z();
}
and length of vectors
vectorMod = System.Math.Sqrt(x * x + y * y + z * z);
then you know what to do))
1
solved Find if two lines in 3D are collinear [closed]