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