private void xIntersect() { this.xCurrent = this.xPlaneNext; this.yCurrent = this.direction.getY() * this.xPlaneT + this.position.getY(); this.zCurrent = this.direction.getZ() * this.xPlaneT + this.position.getZ(); this.normalCurrent = this.xNormal; // Prepare next intersection this.xPlaneNext += this.xPlaneIncrement; this.xPlaneT = (this.xPlaneNext - this.position.getX()) / this.direction.getX(); }
/** * Create a new instance. * * @param extent The extent * @param x The X-axis position * @param y The Y-axis position * @param z The Z-axis position */ public Location(E extent, double x, double y, double z) { this(extent, new Vector3d(x, y, z)); }
/** * Returns whether the given vector is along this axis. * * @param vector The vector to test * @return True if it is along this axis */ public boolean isVectorAlongAxis(final Vector3d vector) { return vector.abs().normalize().sub(this.direction).lengthSquared() == 0; }
Direction(Vector3d direction, Division division) { if (direction.lengthSquared() == 0) { // Prevent normalization of the zero direction this.offset = direction; } else { this.offset = direction.normalize(); } this.blockOffset = direction.round().toInt(); this.division = division; }
/** * Create a new instance. * * @param extent The extent * @param x The X-axis position * @param y The Y-axis position * @param z The Z-axis position */ public Location(E extent, int x, int y, int z) { this(extent, new Vector3i(x, y, z)); }
/** * Gets the yaw component of this transform rotation. * * @return The yaw */ public double getYaw() { return this.rotation.getY(); }
/** * Gets the pitch component of this transform rotation. * * @return The pitch */ public double getPitch() { return this.rotation.getX(); }
/** * Gets the roll component of this transform rotation. * * @return The roll */ public double getRoll() { return this.rotation.getZ(); }
/** * Create a new InventoryDimension property with the specified dimensions. * * @param width width of the inventory to match * @param height height of the inventory to match */ public InventoryDimension(int width, int height) { super(new Vector2i(width, height)); }
/** * Gets the size of the box. * * @return The size */ public Vector3d getSize() { if (this.size == null) { this.size = this.max.sub(this.min); } return this.size; }
private void zIntersect() { this.xCurrent = this.direction.getX() * this.zPlaneT + this.position.getX(); this.yCurrent = this.direction.getY() * this.zPlaneT + this.position.getY(); this.zCurrent = this.zPlaneNext; this.normalCurrent = this.zNormal; // Prepare next intersection this.zPlaneNext += this.zPlaneIncrement; this.zPlaneT = (this.zPlaneNext - this.position.getZ()) / this.direction.getZ(); }
/** * Returns the position of the intersection. * * @return The intersection coordinates */ public Vector3d getPosition() { if (this.position == null) { this.position = new Vector3d(this.x, this.y, this.z); } return this.position; }
/** * Create a new SlotPos property for matching the specified value with the * specified operator. * * @param x slot x position * @param y slot y position * @param operator the operator to use when comparing with other properties */ public SlotPos(int x, int y, Operator operator) { super(new Vector2i(x, y), operator); }
private void yIntersect() { this.xCurrent = this.direction.getX() * this.yPlaneT + this.position.getX(); this.yCurrent = this.yPlaneNext; this.zCurrent = this.direction.getZ() * this.yPlaneT + this.position.getZ(); this.normalCurrent = this.yNormal; // Prepare next intersection this.yPlaneNext += this.yPlaneIncrement; this.yPlaneT = (this.yPlaneNext - this.position.getY()) / this.direction.getY(); }
/** * Create a new InventoryDimension property with the specified dimensions. * * @param width width of the inventory to match * @param height height of the inventory to match * @param operator logical operator to use when comparing this property with * other properties */ public InventoryDimension(int width, int height, Operator operator) { super(new Vector2i(width, height), operator); }
/** * Create a new SlotPos property for matching the specified value. * * @param x slot x position * @param y slot y position */ public SlotPos(int x, int y) { super(new Vector2i(x, y)); }