當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector.getMaximum方法代碼示例

本文整理匯總了Java中com.sk89q.worldedit.Vector.getMaximum方法的典型用法代碼示例。如果您正苦於以下問題:Java Vector.getMaximum方法的具體用法?Java Vector.getMaximum怎麽用?Java Vector.getMaximum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sk89q.worldedit.Vector的用法示例。


在下文中一共展示了Vector.getMaximum方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: selectSecondary

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public boolean selectSecondary(Vector position, SelectorLimits limits) {
    if (!started) {
        return false;
    }

    final Vector diff = position.subtract(region.getCenter());
    final Vector minRadius = Vector.getMaximum(diff, diff.multiply(-1.0));
    region.extendRadius(minRadius);
    return true;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:12,代碼來源:EllipsoidRegionSelector.java

示例3: getMaximumPoint

import com.sk89q.worldedit.Vector; //導入方法依賴的package包/類
@Override
public Vector getMaximumPoint() {
    Vector pos1 = new MutableBlockVector(getPos(super.getMinimumPoint()));
    Vector pos2 = new MutableBlockVector(getPos(super.getMaximumPoint()));
    return Vector.getMaximum(pos1, pos2);
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:7,代碼來源:TransformExtent.java

示例4: 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.getMaximum方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。