当前位置: 首页>>代码示例>>Java>>正文


Java Vector.getMinimum方法代码示例

本文整理汇总了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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:15,代码来源:ExtendingCuboidRegionSelector.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:7,代码来源:TransformExtent.java

示例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);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:49,代码来源:FlattenedClipboardTransform.java


注:本文中的com.sk89q.worldedit.Vector.getMinimum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。