Flutter Impeller
separated_vector.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "separated_vector.h"
6 
7 namespace impeller {
8 
10 
12  : direction(direction), magnitude(magnitude){};
13 
15  : direction(vector.Normalize()), magnitude(vector.GetLength()){};
16 
18  return direction * magnitude;
19 }
20 
22  return direction.Dot(other.direction);
23 }
24 
26  return direction.AngleTo(other.direction);
27 }
28 
29 } // namespace impeller
float Scalar
Definition: scalar.h:18
A Vector2, broken down as a separate magnitude and direction. Assumes that the direction given is nor...
Radians AngleTo(const SeparatedVector2 &other) const
Returns the scalar angle between the two rays.
Scalar GetAlignment(const SeparatedVector2 &other) const
Vector2 direction
The normalized direction of the vector.
Vector2 GetVector() const
Returns the vector representation of the vector.
Scalar magnitude
The magnitude of the vector.
constexpr Type Dot(const TPoint &p) const
Definition: point.h:220
constexpr Radians AngleTo(const TPoint &p) const
Definition: point.h:232