本文整理汇总了Java中com.sk89q.worldedit.Vector.getMinimum方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.getMinimum方法的具体用法?Java Vector.getMinimum怎么用?Java Vector.getMinimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.Vector
的用法示例。
在下文中一共展示了Vector.getMinimum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ExtendingCuboidRegionSelector
import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
/**
* 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);
}
示例2: getMinimumPoint
import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public Vector getMinimumPoint() {
Vector pos1 = new MutableBlockVector(getPos(super.getMinimumPoint()));
Vector pos2 = new MutableBlockVector(getPos(super.getMaximumPoint()));
return Vector.getMinimum(pos1, pos2);
}
示例3: getTransformedRegion
import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
/**
* 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);
}