void float2::Decompose(const float2 &direction, float2 &outParallel, float2 &outPerpendicular) const { assume(direction.IsNormalized()); outParallel = this->Dot(direction) * direction; outPerpendicular = *this - outParallel; }
float float2::AngleBetweenNorm(const float2 &other) const { assume(this->IsNormalized()); assume(other.IsNormalized()); return acos(Dot(other)); }
float2 float2::Reflect(const float2 &normal) const { assume2(normal.IsNormalized(), normal.SerializeToCodeString(), normal.Length()); return 2.f * this->ProjectToNorm(normal) - *this; }
float2 float2::ProjectToNorm(const float2 &direction) const { assume(direction.IsNormalized()); return direction * this->Dot(direction); }
float2 float2::Reflect(const float2 &normal) const { assume(normal.IsNormalized()); return 2.f * this->ProjectToNorm(normal) - *this; }