Hide Color.Dim / Geometry.Dim

This commit is contained in:
Hajime Hoshi 2014-12-07 23:20:41 +09:00
parent 05c0cb5531
commit 4c79f1bccd
3 changed files with 6 additions and 6 deletions

View File

@ -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")
}

View File

@ -22,7 +22,7 @@ func ColorI() Color {
}
}
func (matrix *Color) Dim() int {
func (matrix *Color) dim() int {
return ColorDim
}

View File

@ -19,7 +19,7 @@ func GeometryI() Geometry {
}
}
func (matrix *Geometry) Dim() int {
func (matrix *Geometry) dim() int {
return GeometryDim
}