We should determine how to add several linear functions that basically act as nxm matrices, linearly mapping one vector space to another, possibly with an additional shift. The function basically represents f(t) = s + A*t, where A is an nxm matrix, s is a support (or 'shift') vector, and t is the input vector variable. It should be able to support n={1,2,3,4} and m={1,2,3,4}, the main vector types. It may be possible to discard the n=4 or m=4 variants, but for completeness sake they should probably be included. Some example implementations would be like the following snippet, to give an indication of what it should do:
public class LinearFunction21 : LinearFunction<Vector2, float>
{
Vector2 coefficients;
float constant;
public LinearFunction21(float constant, Vector2 coefficients)
{
this.constant = constant;
this.coefficients = coefficients;
}
public override float GetValueAt(Vector2 t)
{
return constant + Vector2.Dot(coefficients, t);
}
}
public class LinearFunction12 : LinearFunction<float, Vector2>
{
Vector2 coefficient;
Vector2 constant;
public LinearFunction12(Vector2 constant, Vector2 coefficient)
{
this.constant = constant;
this.coefficient = coefficient;
}
public override Vector2 GetValueAt(float t)
{
return constant + t * coefficient;
}
}
public class LinearFunction31 : LinearFunction<Vector3, float>
{
Vector3 coefficients;
float constant;
public LinearFunction31(float constant, Vector3 coefficients)
{
this.constant = constant;
this.coefficients = coefficients;
}
public override float GetValueAt(Vector3 t)
{
return constant + Vector3.Dot(coefficients, t);
}
}
Since this would implement all 4 input vector types (scalar, Vector2, Vector3, Vector4), there will be 4*4 possible maps, so 16 in total.
We should determine how to add several linear functions that basically act as
n
xm
matrices, linearly mapping one vector space to another, possibly with an additional shift. The function basically representsf(t) = s + A*t
, whereA
is ann
xm
matrix,s
is a support (or 'shift') vector, andt
is the input vector variable. It should be able to support n={1,2,3,4} and m={1,2,3,4}, the main vector types. It may be possible to discard the n=4 or m=4 variants, but for completeness sake they should probably be included. Some example implementations would be like the following snippet, to give an indication of what it should do:Since this would implement all 4 input vector types (scalar, Vector2, Vector3, Vector4), there will be 4*4 possible maps, so 16 in total.