mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-09-20 05:12:18 +02:00
affine: Bug fix: (*GeoM).det() was wrong (#547)
This commit is contained in:
parent
e81c83dfe6
commit
61d7f1e9b5
@ -201,6 +201,11 @@ func TestGeoMIsInvert(t *testing.T) {
|
|||||||
cpx.Scale(1.5, 2.5)
|
cpx.Scale(1.5, 2.5)
|
||||||
cpx.Translate(-2, -3)
|
cpx.Translate(-2, -3)
|
||||||
|
|
||||||
|
cpx2 := GeoM{}
|
||||||
|
cpx2.Scale(2, 3)
|
||||||
|
cpx2.Rotate(0.234)
|
||||||
|
cpx2.Translate(100, 100)
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
GeoM GeoM
|
GeoM GeoM
|
||||||
Invertible bool
|
Invertible bool
|
||||||
@ -225,6 +230,10 @@ func TestGeoMIsInvert(t *testing.T) {
|
|||||||
GeoM: cpx,
|
GeoM: cpx,
|
||||||
Invertible: true,
|
Invertible: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
GeoM: cpx2,
|
||||||
|
Invertible: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
pts := []struct {
|
pts := []struct {
|
||||||
|
@ -188,7 +188,7 @@ func (g *GeoM) det() float64 {
|
|||||||
if g == nil {
|
if g == nil {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
return (g.a_1+1)*(g.d_1+1) - g.b - g.c
|
return (g.a_1+1)*(g.d_1+1) - g.b*g.c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GeoM) IsInvertible() bool {
|
func (g *GeoM) IsInvertible() bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user