From 4c79f1bccd360a19379186c4a7e2f24aa9a9e457 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 7 Dec 2014 23:20:41 +0900 Subject: [PATCH] Hide Color.Dim / Geometry.Dim --- graphics/matrix/affine.go | 8 ++++---- graphics/matrix/color.go | 2 +- graphics/matrix/geometry.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/graphics/matrix/affine.go b/graphics/matrix/affine.go index 12f24bf21..e58a511fd 100644 --- a/graphics/matrix/affine.go +++ b/graphics/matrix/affine.go @@ -1,13 +1,13 @@ package matrix type affine interface { - Dim() int + dim() int element(i, j int) float64 setElement(i, j int, element float64) } func isIdentity(matrix affine) bool { - dim := matrix.Dim() + dim := matrix.dim() for i := 0; i < dim-1; i++ { for j := 0; j < dim; j++ { element := matrix.element(i, j) @@ -22,8 +22,8 @@ func isIdentity(matrix affine) bool { } func mul(lhs, rhs, result affine) { - dim := lhs.Dim() - if dim != rhs.Dim() { + dim := lhs.dim() + if dim != rhs.dim() { panic("diffrent-sized matrices can't be multiplied") } diff --git a/graphics/matrix/color.go b/graphics/matrix/color.go index 896df9970..a59f2342d 100644 --- a/graphics/matrix/color.go +++ b/graphics/matrix/color.go @@ -22,7 +22,7 @@ func ColorI() Color { } } -func (matrix *Color) Dim() int { +func (matrix *Color) dim() int { return ColorDim } diff --git a/graphics/matrix/geometry.go b/graphics/matrix/geometry.go index 2274168b9..631463a4b 100644 --- a/graphics/matrix/geometry.go +++ b/graphics/matrix/geometry.go @@ -19,7 +19,7 @@ func GeometryI() Geometry { } } -func (matrix *Geometry) Dim() int { +func (matrix *Geometry) dim() int { return GeometryDim }