Example #1
0
void float3::Orthonormalize(float3 &a, float3 &b)
{
	assume(!a.IsZero());
	assume(!b.IsZero());
	a.Normalize();
	b -= b.ProjectToNorm(a);
	b.Normalize();
}
Example #2
0
void float3::Orthogonalize(const float3 &a, float3 &b, float3 &c)
{
	if (!a.IsZero())
	{
		b -= b.ProjectTo(a);
		c -= c.ProjectTo(a);
	}
	if (!b.IsZero())
		c -= c.ProjectTo(b);
}
Example #3
0
float3 float3::ProjectTo(const float3 &direction) const
{
	assume(!direction.IsZero());
	return direction * this->Dot(direction) / direction.LengthSq();
}
Example #4
0
void float3::Orthogonalize(const float3 &a, float3 &b)
{
	if (!a.IsZero())
		b -= b.ProjectTo(a);
}
Example #5
0
float4 float4::ProjectTo3(const float3 &target) const
{
    assume(!target.IsZero());
    assume(this->IsWZeroOrOne());
    return float4(target * Dot(xyz(), target) / target.LengthSq(), w);
}