public bool AreTheSameRegion(RegularDtm dtm) { return(this.MinX - this.CellWidth / 2 == dtm.MinX - dtm.CellWidth / 2 && this.MinY - this.CellHeight / 2 == dtm.MinY - dtm.CellHeight / 2 && this.MaX + this.CellWidth / 2 == dtm.MaX + dtm.CellWidth / 2 && this.MaxY + this.CellHeight / 2 == dtm.MaxY + dtm.CellHeight / 2); }
public Matrix DifferenceFromFinerDtm(RegularDtm finerDtm) { if (!AreTheSameRegion(finerDtm)) { throw new NotImplementedException(); } if (this.CellHeight < finerDtm.CellHeight || this.CellWidth < finerDtm.CellWidth) { throw new NotImplementedException(); } Matrix result = new Matrix(finerDtm.NumberOfRows, finerDtm.NumberOfColumns); double widthRatio = finerDtm.CellWidth / this.CellWidth; double heightRatio = finerDtm.CellHeight / this.CellHeight; for (int i = 0; i < finerDtm.NumberOfRows; i++) { for (int j = 0; j < finerDtm.NumberOfColumns; j++) { int tempI = (int)((i * finerDtm.CellHeight + finerDtm.CellHeight / 2) / this.CellHeight); int tempJ = (int)((j * finerDtm.CellWidth + finerDtm.CellWidth / 2) / this.CellWidth); result[i, j] = this.values[tempI, tempJ] - finerDtm.values[i, j]; } } return(result); }
public Matrix Differece(RegularDtm dtm) { if (!this.AreTheSameRegion(dtm)) { throw new NotImplementedException(); } return(this.values - dtm.values); }
public RegularDtm SubtractFromFinerDtm(RegularDtm finerDtm) { Matrix result = DifferenceFromFinerDtm(finerDtm); return(new RegularDtm(result, finerDtm.CellWidth, finerDtm.CellHeight, new Point(finerDtm.MinX, finerDtm.MinY))); }
public RegularDtm Subtract(RegularDtm dtm) { Matrix resultValues = Differece(dtm); return(new RegularDtm(resultValues, this.CellWidth, this.CellHeight, new Point(this.MinX, this.MinY))); }