outlineDescriptor.DensityKernel.java Source code

Java tutorial

Introduction

Here is the source code for outlineDescriptor.DensityKernel.java

Source

/*******************************************************************************
 * @Author David Helekal
 *      Platelocator
 *
 *  Copyright (C) 2015  David Helekal
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/

package outlineDescriptor;

import org.apache.commons.math3.linear.Array2DRowRealMatrix;

class DensityKernel extends Array2DRowRealMatrix implements ODUtils.votable {

    public DensityKernel(int rowDimension, int columnDimension) {

        super(rowDimension, columnDimension);
    }

    @Override
    public void vote(int xPos, int yPos, double weight, double value) {

        if (yPos >= 0 && xPos >= 0 && yPos < this.getRowDimension() && xPos < this.getColumnDimension()) {

            this.addToEntry(yPos, xPos, weight * value);

        }

    }
}