/** * @param x * @param y * @return the dot product of this vector with the given x, y values. */ @Override public double dot(final double x, final double y) { return getX() * x + getY() * y; }
/** * @return the string representation of this vector. */ @Override public String toString() { return "com.ardor3d.math.Vector2 [X=" + getX() + ", Y=" + getY() + "]"; }
/** * @return the string representation of this vector. */ @Override public String toString() { return "com.ardor3d.math.Vector2 [X=" + getX() + ", Y=" + getY() + "]"; }
/** * @param x * @param y * @return the dot product of this vector with the given x, y values. */ @Override public double dot(final double x, final double y) { return getX() * x + getY() * y; }
/** * @return the angle - in radians [-pi, pi) - represented by this Vector2 as expressed by a conversion from * rectangular coordinates (<code>x</code>, <code>y</code>) to polar coordinates * (r, <i>theta</i>). */ @Override public double getPolarAngle() { return -Math.atan2(getY(), getX()); }
private int findClipIndex(final ReadOnlyVector3 pointInEyeSpace) { final Vector2 gridPoint = _tracers.get(_minLevel).get2DPoint(pointInEyeSpace, null); final int maxDist = Math.max(Math.abs((int) gridPoint.getX()), Math.abs((int) gridPoint.getY())) / (_clipmapLevels.get(_minLevel).getClipSideSize() + 1 >> 1); int index = (int) MathUtils.floor(Math.log(maxDist) / Math.log(2)) + 1; index = MathUtils.clamp(index, _minLevel, _maxLevel); return index; }
private int findClipIndex(final ReadOnlyVector3 pointInEyeSpace) { final Vector2 gridPoint = _tracers.get(_minLevel).get2DPoint(pointInEyeSpace, null); final int maxDist = Math.max(Math.abs((int) gridPoint.getX()), Math.abs((int) gridPoint.getY())) / (_clipmapLevels.get(_minLevel).getClipSideSize() + 1 >> 1); int index = (int) MathUtils.floor(Math.log(maxDist) / Math.log(2)) + 1; index = MathUtils.clamp(index, _minLevel, _maxLevel); return index; }
/** * Increments the values of this vector with the given x and y values. * * @param x * @param y * @return this vector for chaining */ public Vector2 addLocal(final double x, final double y) { return set(getX() + x, getY() + y); }
/** * Internally modifies the values of this vector by dividing them each by the values of the given scale. * * @param x * @param y * @return this vector for chaining */ public Vector2 divideLocal(final double x, final double y) { return set(getX() / x, getY() / y); }
/** * Decrements the values of this vector by the given x and y values. * * @param x * @param y * @return this vector for chaining */ public Vector2 subtractLocal(final double x, final double y) { return set(getX() - x, getY() - y); }
/** * Internally modifies the values of this vector by multiplying them each by the given scalar value. * * @param scalar * @return this vector for chaining */ public Vector2 multiplyLocal(final double scalar) { return set(getX() * scalar, getY() * scalar); }
/** * Internally modifies the values of this vector by multiplying them each by the values of the given scale. * * @param x * @param y * @return this vector for chaining */ public Vector2 multiplyLocal(final double x, final double y) { return set(getX() * x, getY() * y); }
/** * Increments the values of this vector with the given x and y values. * * @param x * @param y * @return this vector for chaining */ public Vector2 addLocal(final double x, final double y) { return set(getX() + x, getY() + y); }
@Override public void write(final OutputCapsule capsule) throws IOException { capsule.write(getX(), "x", 0); capsule.write(getY(), "y", 0); }
/** * Used with serialization. Not to be called manually. * * @param out * ObjectOutput * @throws IOException */ @Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeDouble(getX()); out.writeDouble(getY()); }
/** */ protected void calculateAlignmentOffset() { _alignOffset.set(0, 0); if (_align != null) { _alignOffset.setX(_size.getX() * _align.horizontal); _alignOffset.setY(_size.getY() * _align.vertical); } }
/** * Internally modifies the values of this vector by multiplying them each by the values of the given scale. * * @param scale * @return this vector for chaining */ public Vector2 multiplyLocal(final ReadOnlyVector2 scale) { return set(getX() * scale.getX(), getY() * scale.getY()); }
/** * Internally modifies the values of this vector by dividing them each by the values of the given scale. * * @param scale * @return this vector for chaining */ public Vector2 divideLocal(final ReadOnlyVector2 scale) { return set(getX() / scale.getX(), getY() / scale.getY()); }
/** * set a fixed offset from the alignment center of rotation IN FONT UNITS */ public void setFixedOffset(final Vector2 offset) { final double x = offset.getX() * _font.getSize(); final double y = offset.getY() * _font.getSize(); _fixedOffset.set(x, y); setText(_textString); }
private static void applyAnchor(final UIComponent comp, final AnchorLayoutData layData) { final Vector2 offsetsA = AnchorLayout.getOffsets(comp, layData.getMyPoint(), null); final Vector2 offsetsB = AnchorLayout.getOffsets(layData.getParent(), layData.getParentPoint(), null); comp.addTranslation(offsetsB.getX() - offsetsA.getX() + layData.getXOffset(), offsetsB.getY() - offsetsA.getY() + layData.getYOffset(), 0); if (!comp.hasAncestor(layData.getParent())) { comp.addTranslation(layData.getParent().getTranslation()); } }