/* Copyright (C) 2004 - 2014 A.Vontobel  
 * Classes in drawj2d.bgd are derived from fachwerk.sourceforge.net, 2014
 *
 * 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 2
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The license is in LICENCE-GPL.txt.
 * If not, see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
 */

package net.sf.drawj2d.bgd;

public class clHintergrundPunkt {
    private double[] pkt = new double[2];
    
    clHintergrundPunkt(double X, double Z) {
        pkt[0] = X;
        pkt[1] = Z;
    }
    
    public boolean skaliere(double faktorx, double faktorz) {
        assert (Math.abs(faktorx) >= 1E-9);
        assert (Math.abs(faktorz) >= 1E-9);
        pkt[0] = faktorx * pkt[0];
        pkt[1] = faktorz * pkt[1];
        return true;
    }
    
    public void verschiebe(double dx, double dz) {
        pkt[0] += dx;
        pkt[1] += dz;   
    }

    /** Rotiert im Uhrzeigersinn.
    * @param rot Rotation im Uhrzeigersinn, in Radianten */
    public void rotiere(double rot) {
        double X = pkt[0];
        double Z = pkt[1];
        pkt[0] = X * Math.cos(rot) - Z * Math.sin(rot);
        pkt[1] = X * Math.sin(rot) + Z * Math.cos(rot);
    }
    
    /** Gibt die Koordinate des Hintergrundpunktes zurück.
     */
    public double[] getPkt() {
        return pkt;
    }
}
 

Ads help maintain this website.