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