Java Code Examples for com.sk89q.worldedit.Vector#getMinimum()
The following examples show how to use
com.sk89q.worldedit.Vector#getMinimum() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtendingCuboidRegionSelector.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
/** * Create a new selector. * * @param world the world * @param position1 the first position * @param position2 the second position */ public ExtendingCuboidRegionSelector(@Nullable World world, Vector position1, Vector position2) { this(world); position1 = Vector.getMinimum(position1, position2); position2 = Vector.getMaximum(position1, position2); region.setPos1(position1); region.setPos2(position2); }
Example 2
Source File: TransformExtent.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public Vector getMinimumPoint() { Vector pos1 = new MutableBlockVector(getPos(super.getMinimumPoint())); Vector pos2 = new MutableBlockVector(getPos(super.getMaximumPoint())); return Vector.getMinimum(pos1, pos2); }
Example 3
Source File: FlattenedClipboardTransform.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
/** * Get the transformed region. * * @return the transformed region */ public Region getTransformedRegion() { Region region = original.getRegion(); Vector minimum = region.getMinimumPoint(); Vector maximum = region.getMaximumPoint(); Transform transformAround = new CombinedTransform( new AffineTransform().translate(original.getOrigin().multiply(-1)), transform, new AffineTransform().translate(original.getOrigin())); // new Vector(minimum.getX(), minimum.getY(), minimum.getZ()) // new Vector(maximum.getX(), maximum.getY(), maximum.getZ()) Vector[] corners = new Vector[]{ minimum, maximum, new Vector(maximum.getX(), minimum.getY(), minimum.getZ()), new Vector(minimum.getX(), maximum.getY(), minimum.getZ()), new Vector(minimum.getX(), minimum.getY(), maximum.getZ()), new Vector(minimum.getX(), maximum.getY(), maximum.getZ()), new Vector(maximum.getX(), minimum.getY(), maximum.getZ()), new Vector(maximum.getX(), maximum.getY(), minimum.getZ())}; for (int i = 0; i < corners.length; i++) { corners[i] = transformAround.apply(new Vector(corners[i])); } Vector newMinimum = corners[0]; Vector newMaximum = corners[0]; for (int i = 1; i < corners.length; i++) { newMinimum = Vector.getMinimum(newMinimum, corners[i]); newMaximum = Vector.getMaximum(newMaximum, corners[i]); } // After transformation, the points may not really sit on a block, // so we should expand the region for edge cases newMinimum.mutX(Math.ceil(Math.floor(newMinimum.getX()))); newMinimum.mutY(Math.ceil(Math.floor(newMinimum.getY()))); newMinimum.mutZ(Math.ceil(Math.floor(newMinimum.getZ()))); return new CuboidRegion(newMinimum, newMaximum); }