/** * Gets the roll component of this transform rotation. * * @return The roll */ public double getRoll() { return this.rotation.getZ(); }
/** * Gets the Z component of this instance's position. * * @return The z component */ public double getZ() { return getPosition().getZ(); }
/** * converts the provided {@link Vector3d} into a {@link Color} object. * * @param vector3d The vector of three doubles representing color * @return The color object */ public static Color of(Vector3d vector3d) { return new Color((int) Math.round(vector3d.getX()), (int) Math.round(vector3d.getY()), (int) Math.round(vector3d.getZ())); }
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(); }
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(); }
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(); }
/** * Checks if the bounding box contains a point. * * @param x The x coordinate of the point * @param y The y coordinate of the point * @param z The z coordinate of the point * @return Whether or not the box contains the point */ public boolean contains(double x, double y, double z) { return this.min.getX() <= x && this.max.getX() >= x && this.min.getY() <= y && this.max.getY() >= y && this.min.getZ() <= z && this.max.getZ() >= z; }
/** * Offsets this bounding box by a given amount and returns a new box. * * @param offset The offset to apply * @return The new offset box */ public AABB offset(Vector3d offset) { checkNotNull(offset, "offset"); return offset(offset.getX(), offset.getY(), offset.getZ()); }
/** * Checks if the bounding box contains a point. * * @param point The point to check * @return Whether or not the box contains the point */ public boolean contains(Vector3d point) { checkNotNull(point, "point"); return contains(point.getX(), point.getY(), point.getZ()); }
/** * Expands this bounding box by a given amount in both directions and * returns a new box. The expansion is applied half and half to the * minimum and maximum corners. * * @param amount The amount of expansion to apply * @return The new expanded box */ public AABB expand(Vector3d amount) { checkNotNull(amount, "amount"); return expand(amount.getX(), amount.getY(), amount.getZ()); }
private void xyIntersect() { this.xCurrent = this.xPlaneNext; this.yCurrent = this.yPlaneNext; this.zCurrent = this.direction.getZ() * this.xPlaneT + this.position.getZ(); this.normalCurrent = getXyNormal(); // Prepare next intersection this.xPlaneNext += this.xPlaneIncrement; this.yPlaneNext += this.yPlaneIncrement; this.xPlaneT = (this.xPlaneNext - this.position.getX()) / this.direction.getX(); this.yPlaneT = (this.yPlaneNext - this.position.getY()) / this.direction.getY(); }
private void yzIntersect() { this.xCurrent = this.direction.getX() * this.yPlaneT + this.position.getX(); this.yCurrent = this.yPlaneNext; this.zCurrent = this.zPlaneNext; this.normalCurrent = getYzNormal(); // Prepare next intersection this.yPlaneNext += this.yPlaneIncrement; this.zPlaneNext += this.zPlaneIncrement; this.yPlaneT = (this.yPlaneNext - this.position.getY()) / this.direction.getY(); this.zPlaneT = (this.zPlaneNext - this.position.getZ()) / this.direction.getZ(); }
private void xzIntersect() { this.xCurrent = this.xPlaneNext; this.yCurrent = this.direction.getY() * this.xPlaneT + this.position.getY(); this.zCurrent = this.zPlaneNext; this.normalCurrent = getXzNormal(); // Prepare next intersection this.xPlaneNext += this.xPlaneIncrement; this.zPlaneNext += this.zPlaneIncrement; this.xPlaneT = (this.xPlaneNext - this.position.getX()) / this.direction.getX(); this.zPlaneT = (this.zPlaneNext - this.position.getZ()) / this.direction.getZ(); }
private void xyzIntersect() { this.xCurrent = this.xPlaneNext; this.yCurrent = this.yPlaneNext; this.zCurrent = this.zPlaneNext; this.normalCurrent = getXyzNormal(); // Prepare next intersection this.xPlaneNext += this.xPlaneIncrement; this.yPlaneNext += this.yPlaneIncrement; this.zPlaneNext += this.zPlaneIncrement; this.xPlaneT = (this.xPlaneNext - this.position.getX()) / this.direction.getX(); this.yPlaneT = (this.yPlaneNext - this.position.getY()) / this.direction.getY(); this.zPlaneT = (this.zPlaneNext - this.position.getZ()) / this.direction.getZ(); }
/** * Add another Vector3d to the position on this instance, returning a new * Location instance. * * @param v The vector to add * @return A new instance */ public Location<E> add(Vector3d v) { return add(v.getX(), v.getY(), v.getZ()); }
/** * Subtract another Vector3d to the position on this instance, returning * a new Location instance. * * @param v The vector to subtract * @return A new instance */ public Location<E> sub(Vector3d v) { return sub(v.getX(), v.getY(), v.getZ()); }
/** * Checks if the bounding box intersects another. * * @param other The other bounding box to check * @return Whether this bounding box intersects with the other */ public boolean intersects(AABB other) { checkNotNull(other, "other"); return this.max.getX() >= other.getMin().getX() && other.getMax().getX() >= this.min.getX() && this.max.getY() >= other.getMin().getY() && other.getMax().getY() >= this.min.getY() && this.max.getZ() >= other.getMin().getZ() && other.getMax().getZ() >= this.min.getZ(); }
private static Vector3d toAxesAngles(Quaterniond quaternion) { final Vector3d axesAngles = quaternion.getAxesAnglesDeg(); return new Vector3d(axesAngles.getX(), -axesAngles.getY(), axesAngles.getZ()); }
@Override public DataContainer toContainer() { return DataContainer.createNew() .set(Queries.CONTENT_VERSION, getContentVersion()) .set(Queries.POSITION_X, getPosition().getX()) .set(Queries.POSITION_Y, getPosition().getY()) .set(Queries.POSITION_Z, getPosition().getZ()) .set(Queries.FORCED_SPAWN, isForced()) .set(Queries.WORLD_ID, getWorldUniqueId().toString()); }