DirectionVector.get constructor

DirectionVector.get(
  1. Offset firstVector,
  2. Offset secondVector
)

Implementation

factory DirectionVector.get(Offset firstVector, Offset secondVector) {
  Offset directionVector = Offset(secondVector.dx - firstVector.dx, secondVector.dy - firstVector.dy);

  double directionVectorLength = sqrt(directionVector.dx * directionVector.dx + directionVector.dy * directionVector.dy);

  return DirectionVector._(vector: directionVector, length: directionVectorLength, firstVector: firstVector, secondVector: secondVector);
}