pub type Move=Matrix<f64,f64,One,Zero,Zero,One>;
impl Move{
pub fn new(dx:f64,dy:f64)->Move{
Move{
m01:dx , m02:dy,
m11:One{}, m12:Zero{},
m21:Zero{}, m22:One{}
}
}
}
impl Mul<Move> for M2D{
type Output = M2D;
fn mul(self, tm:Move) ->M2D{
M2D{
m01:self.m01 + tm.m01,m02:self.m02+ tm.m02,
m11:self.m11 ,m12:self.m12,
m21:self.m21 ,m22:self.m22
}
}
}
impl Mul<M2D> for Move{
type Output = M2D;
fn mul(self, tm:M2D) ->M2D{
M2D{
m01:self.m01 * tm.m11 + self.m02 * tm.m21 + tm.m01,m02:self.m01 * tm.m12 + self.m02 * tm.m22 + tm.m02,
m11:tm.m11 ,m12:tm.m12,
m21:tm.m21 ,m22:tm.m22
}
}
}
impl Mul<Move> for Move{
type Output = Move;
fn mul(self, tm:Move) ->Move{
Move{
m01:self.m01 + tm.m01,m02:self.m02+ tm.m02,
m11:One{} ,m12:Zero{},
m21:Zero{} ,m22:One{}
}
}
}
impl Div<Move> for Move{
type Output = Move;
fn div(self, tm:Move) ->Move{
Move{
m01:self.m01 - tm.m01,m02:self.m02- tm.m02,
m11:One{} ,m12:Zero{},
m21:Zero{} ,m22:One{}
}
}
}