Java Code Examples for com.flowpowered.math.vector.Vector3d#getZ()
The following examples show how to use
com.flowpowered.math.vector.Vector3d#getZ() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MathUtils.java From BlueMap with MIT License | 5 votes |
/** * Calculates the surface-normal of a plane spanned between three vectors. * @param p1 The first vector * @param p2 The second vector * @param p3 The third vector * @return The calculated normal */ public static Vector3d getSurfaceNormal(Vector3d p1, Vector3d p2, Vector3d p3){ Vector3d u = p2.sub(p1); Vector3d v = p3.sub(p1); double nX = u.getY() * v.getZ() - u.getZ() * v.getY(); double nY = u.getZ() * v.getX() - u.getX() * v.getZ(); double nZ = u.getX() * v.getY() - u.getY() * v.getX(); return new Vector3d(nX, nY, nZ); }
Example 2
Source File: BlockRayHit.java From GriefDefender with MIT License | 5 votes |
/** * Constructs a new block ray hit from the extent that contains it, the * coordinates and the face that was entered. * * @param extent The extent of the block * @param x The x coordinate of the block * @param y The y coordinate of the block * @param z The x coordinate of the block * @param direction A normal vector of the ray direction * @param normal The normal of the entered face, edge or corner */ public BlockRayHit(World extent, double x, double y, double z, Vector3d direction, Vector3d normal) { this.extent = extent; this.x = x; this.y = y; this.z = z; this.direction = direction; this.normal = normal; // Take into account the face through which we entered // so we know which block is the correct one if (x % 1 == 0 && normal.getX() > 0) { this.xBlock = (int) x - 1; } else { this.xBlock = GenericMath.floor(x); } if (y % 1 == 0 && normal.getY() > 0) { this.yBlock = (int) y - 1; } else { //noinspection SuspiciousNameCombination this.yBlock = GenericMath.floor(y); } if (z % 1 == 0 && normal.getZ() > 0) { this.zBlock = (int) z - 1; } else { this.zBlock = GenericMath.floor(z); } }
Example 3
Source File: Vector3dView.java From Web-API with MIT License | 5 votes |
public Vector3dView(Vector3d value) { super(value); this.x = value.getX(); this.y = value.getY(); this.z = value.getZ(); }
Example 4
Source File: Vector3dParamConverter.java From Web-API with MIT License | 4 votes |
@Override public String toString(Vector3d value) { return value.getX() + "|" + value.getY() + "|" + value.getZ(); }
Example 5
Source File: SpongePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public WorldVector getPosition() { Vector3d pos = this.player.getLocation().getPosition(); return new WorldVector(LocalWorldAdapter.adapt(SpongeWorldEdit.inst().getAdapter().getWorld(this.player.getWorld())), pos.getX(), pos.getY(), pos.getZ()); }
Example 6
Source File: SpongePlayer.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public WorldVector getPosition() { Vector3d pos = this.player.getLocation().getPosition(); return new WorldVector(LocalWorldAdapter.adapt(SpongeWorldEdit.inst().getAdapter().getWorld(this.player.getWorld())), pos.getX(), pos.getY(), pos.getZ()); }