Package crazypants.vecmath

Examples of crazypants.vecmath.Vector3d


    WIDTH = size;
    HEIGHT = size;
    HWIDTH = WIDTH / 2;
    HHEIGHT = HEIGHT / 2;

    CORE_MIN = new Vector3d(0.5f - HWIDTH, 0.5 - HHEIGHT, 0.5 - HWIDTH);
    CORE_MAX = new Vector3d(CORE_MIN.x + WIDTH, CORE_MIN.y + HEIGHT, CORE_MIN.z + WIDTH);
    CORE_BOUNDS = new BoundingBox(CORE_MIN, CORE_MAX);

    float connectorWidth = 0.25f + (scale * 0.5f);
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      EXTERNAL_CONNECTOR_BOUNDS.put(dir, createExternalConnector(dir, CONNECTOR_DEPTH, connectorWidth));
View Full Code Here


    }
    return result;
  }

  public Vector3d getTranslation(ForgeDirection dir, Offset offset) {
    Vector3d result = new Vector3d(offset.xOffset, offset.yOffset, offset.zOffset);
    result.scale(WIDTH);
    return result;
  }
View Full Code Here

    return result;
  }

  public BoundingBox createBoundsForConnectionController(ForgeDirection dir, Offset offset) {

    Vector3d nonUniformScale = ForgeDirectionOffsets.forDirCopy(dir);
    nonUniformScale.scale(0.5);

    nonUniformScale.x = 0.8 * (1 - Math.abs(nonUniformScale.x));
    nonUniformScale.y = 0.8 * (1 - Math.abs(nonUniformScale.y));
    nonUniformScale.z = 0.8 * (1 - Math.abs(nonUniformScale.z));

    BoundingBox bb = CORE_BOUNDS;
    bb = bb.scale(nonUniformScale.x, nonUniformScale.y, nonUniformScale.z);

    double offsetFromEnd = Math.min(bb.sizeX(), bb.sizeY());
    offsetFromEnd = Math.min(offsetFromEnd, bb.sizeZ());
    offsetFromEnd = Math.max(offsetFromEnd, 0.075);
    double transMag = 0.5 - (offsetFromEnd * 1.2);

    Vector3d trans = ForgeDirectionOffsets.forDirCopy(dir);
    trans.scale(transMag);
    bb = bb.translate(trans);
    bb = bb.translate(getTranslation(dir, offset));
    return bb;
  }
View Full Code Here

  }

  private BoundingBox createConduitBounds(Class<? extends IConduit> type, ForgeDirection dir, boolean isStub, Offset offset) {
    BoundingBox bb = CORE_BOUNDS;

    Vector3d min = bb.getMin();
    Vector3d max = bb.getMax();

    switch (dir) {
    case WEST:
      min.x = isStub ? Math.max(0, bb.minX - STUB_WIDTH) : 0;
      max.x = bb.minX;
      break;
    case EAST:
      min.x = bb.maxX;
      max.x = isStub ? Math.min(1, bb.maxX + STUB_WIDTH) : 1;
      break;
    case DOWN:
      min.y = isStub ? Math.max(0, bb.minY - STUB_HEIGHT) : 0;
      max.y = bb.minY;
      break;
    case UP:
      max.y = isStub ? Math.min(1, bb.maxY + STUB_HEIGHT) : 1;
      min.y = bb.maxY;
      break;
    case NORTH:
      min.z = isStub ? Math.max(0.0F, bb.minZ - STUB_WIDTH) : 0;
      max.z = bb.minZ;
      break;
    case SOUTH:
      max.z = isStub ? Math.min(1F, bb.maxZ + STUB_WIDTH) : 1;
      min.z = bb.maxZ;
      break;
    default:
      break;
    }

    Vector3d trans = getTranslation(dir, offset);
    min.add(trans);
    max.add(trans);
    bb = new BoundingBox(VecmathUtil.clamp(min, 0, 1), VecmathUtil.clamp(max, 0, 1));
    return bb;
  }
View Full Code Here

TOP

Related Classes of crazypants.vecmath.Vector3d

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.