Changed the clipboard so it doesn't store min/max anymore, just origin and offset. Added /editrotate.

This commit is contained in:
sk89q
2010-10-13 10:08:53 -07:00
parent bd9a90f01d
commit 598f4aa6cd
6 changed files with 219 additions and 129 deletions

View File

@ -0,0 +1,28 @@
// $Id$
/*
* WorldEdit
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
*
* 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 com.sk89q.worldedit;
/**
*
* @author Albert
*/
public class EmptyClipboardException extends WorldEditException {
}

View File

@ -356,6 +356,29 @@ public class Vector {
Math.pow(pt.z - z, 2));
}
/**
* 2D transformation.
*
* @param vec
* @param angle in degrees
* @param aboutX
* @param aboutY
* @param translateX
* @param translateY
* @return
*/
public Vector transform2D(double angle,
double aboutX, double aboutZ, double translateX, double translateZ) {
angle = Math.toRadians(angle);
double x = this.x;
double z = this.z;
double x2 = x * Math.cos(angle) - z * Math.sin(angle);
double z2 = x * Math.sin(angle) + z * Math.cos(angle);
return new Vector(x2 + aboutX + translateX,
y,
z2 + aboutZ + translateZ);
}
/**
* Get a block point from a point.
*