/* 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 clHintergrundLinie {
private double[] von = new double[2];
private double[] bis = new double[2];
clHintergrundLinie(double vonX, double vonZ, double bisX, double bisZ) {
von[0] = vonX;
von[1] = vonZ;
bis[0] = bisX;
bis[1] = bisZ;
}
public boolean skaliere(double faktorx, double faktorz) {
assert (Math.abs(faktorx) >= 1E-9);
assert (Math.abs(faktorz) >= 1E-9);
von[0] = faktorx * von[0];
von[1] = faktorz * von[1];
bis[0] = faktorx * bis[0];
bis[1] = faktorz * bis[1];
return true;
}
public void verschiebe(double dx, double dz) {
von[0] += dx;
von[1] += dz;
bis[0] += dx;
bis[1] += dz;
}
/** Rotiert im Uhrzeigersinn.
* @param rot Rotation im Uhrzeigersinn, in Radianten */
public void rotiere(double rot) {
double X = von[0];
double Z = von[1];
von[0] = X * Math.cos(rot) - Z * Math.sin(rot);
von[1] = X * Math.sin(rot) + Z * Math.cos(rot);
X = bis[0];
Z = bis[1];
bis[0] = X * Math.cos(rot) - Z * Math.sin(rot);
bis[1] = X * Math.sin(rot) + Z * Math.cos(rot);
}
/** Gibt den Startpunkt der Hintergrundlinie zurück.
*/
public double[] getVon() {
return von;
}
/** Gibt den Endpunkt der Hintergrundlinie zurück.
*/
public double[] getBis() {
return bis;
}
}
Ads help maintain this website.