Class MyVector3f

java.lang.Object
jme3utilities.math.MyVector3f

public final class MyVector3f extends Object
Utility methods for 3-D vectors.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    index of the first (X) axis
    static final int
    index of the final (Z) axis
    static final Logger
    message logger for this class
    static final int
    number of axes in the coordinate system
    static final int
    index of the X axis
    static final int
    index of the Y axis
    static final int
    index of the Z axis
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    accumulateMaxima(com.jme3.math.Vector3f maxima, com.jme3.math.Vector3f input)
    Accumulate maximum coordinates.
    static void
    accumulateMinima(com.jme3.math.Vector3f minima, com.jme3.math.Vector3f input)
    Accumulate minimum coordinates.
    static void
    accumulateScaled(com.jme3.math.Vector3f total, com.jme3.math.Vector3f input, float scale)
    Accumulate a linear combination of vectors.
    static float
    altitude(com.jme3.math.Vector3f offset)
    Determine the altitude angle of a non-zero offset.
    static boolean
    areCollinear(com.jme3.math.Vector3f point1, com.jme3.math.Vector3f point2, com.jme3.math.Vector3f point3, float tolerance2)
    Test whether 3 locations are collinear.
    static boolean
    areWithinTolerance(com.jme3.math.Vector3f a, com.jme3.math.Vector3f b, float relativeTolerance)
    Test whether 2 vector values are within the specified relative tolerance of one another.
    static com.jme3.math.Vector3f
    axisVector(int axisIndex, float length, com.jme3.math.Vector3f storeResult)
    Generate an axis-aligned vector with the specified length.
    static float
    azimuth(com.jme3.math.Vector3f offset)
    Determine the azimuth angle of an offset.
    static void
    cardinalizeLocal(com.jme3.math.Vector3f input)
    Find the cardinal direction most similar to the specified input.
    static int
    compare(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
    Compare 2 vectors lexicographically, with the X-component having priority, then the Y-component.
    static com.jme3.math.Matrix3f
    covariance(Collection<com.jme3.math.Vector3f> collection, com.jme3.math.Matrix3f storeResult)
    Determine the sample covariance of a collection of vectors.
    static String
    describe(com.jme3.math.Vector3f vector)
    Generate a textual description of a Vector3f value.
    static String
    describeDirection(com.jme3.math.Vector3f v)
    Generate a textual description of a direction vector.
    static double
    distanceSquared(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
    Determine the squared distance between 2 vectors.
    static double
    distanceSquaredToSegment(com.jme3.math.Vector3f location, com.jme3.math.Vector3f segStart, com.jme3.math.Vector3f segEnd, com.jme3.math.Vector3f storeClosest)
    Determine square of the distance between a location and a line segment.
    static boolean
    doCoincide(com.jme3.math.Vector3f point1, com.jme3.math.Vector3f point2, double tolerance2)
    Test whether 2 locations coincide.
    static double
    dot(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
    Determine the dot (scalar) product of 2 vectors.
    static boolean
    eq(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
    Test whether 2 vectors are distinct, without distinguishing 0 from -0.
    static com.jme3.math.Vector3f
    fromAltAz(float altitude, float azimuth)
    Generate a direction from altitude and azimuth angles.
    static void
    generateBasis(com.jme3.math.Vector3f in1, com.jme3.math.Vector3f store2, com.jme3.math.Vector3f store3)
    Generate an orthonormal basis that includes the specified vector.
    static ReadXZ
    horizontalDirection(com.jme3.math.Vector3f offset)
    Determine the horizontal direction of an offset in world space.
    static com.jme3.math.Vector3f
    intersectSegments(com.jme3.math.Vector3f start1, com.jme3.math.Vector3f end1, com.jme3.math.Vector3f start2, com.jme3.math.Vector3f end2, float tolerance2)
    Determine where (if at all) 2 line segments intersect.
    static boolean
    isAllNonNegative(com.jme3.math.Vector3f vector)
    Test whether all components of a vector are all non-negative: in other words, whether it's in the first octant or the boundaries thereof.
    static boolean
    isAllPositive(com.jme3.math.Vector3f vector)
    Test whether all components of a vector are all positive: in other words, whether it's strictly inside the first octant.
    static boolean
    isBetween(com.jme3.math.Vector3f a, com.jme3.math.Vector3f b, com.jme3.math.Vector3f c)
    Test whether b is inside the axis-aligned bounding box formed by a and c.
    static boolean
    isScaleIdentity(com.jme3.math.Vector3f vector)
    Test for a scale identity.
    static boolean
    isScaleUniform(com.jme3.math.Vector3f vector)
    Test for a uniform scaling vector.
    static boolean
    isZero(com.jme3.math.Vector3f vector)
    Test for a zero vector or translation identity.
    static double
    lengthSquared(com.jme3.math.Vector3f vector)
    Determine the squared length of a vector.
    static com.jme3.math.Vector3f
    lerp(float t, com.jme3.math.Vector3f v0, com.jme3.math.Vector3f v1, com.jme3.math.Vector3f storeResult)
    Interpolate linearly between (or extrapolate linearly from) 2 vectors.
    static com.jme3.math.Vector3f
    lineMeetsLine(com.jme3.math.Line line1, com.jme3.math.Line line2)
    Find the point on line1 closest to line2.
    static com.jme3.math.Vector3f
    lineMeetsSphere(com.jme3.math.Line line, com.jme3.math.Vector3f center, float radius, boolean farSide)
    Find the specified intersection between a specified line and a specified sphere.
    static com.jme3.math.Vector3f
    localizeDirection(com.jme3.math.Vector3f worldDirection, com.jme3.scene.Spatial spatial, com.jme3.math.Vector3f storeResult)
    Transform a direction vector from world coordinates to the local coordinates of the specified spatial.
    static com.jme3.math.Vector3f
    maxAbs(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
    Determine the component-wise maximum of absolute values of 2 vectors.
    static com.jme3.math.Vector3f
    mean(Collection<com.jme3.math.Vector3f> collection, com.jme3.math.Vector3f storeResult)
    Determine the arithmetic mean of a non-empty collection of vectors.
    static com.jme3.math.Vector3f
    midpoint(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
    Determine the midpoint between 2 locations.
    static com.jme3.math.Vector3f[]
    mostRemote(List<com.jme3.math.Vector3f> locations)
    Find the most distant pair of locations in a specified list.
    static boolean
    ne(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
    Test whether 2 vectors are distinct, without distinguishing 0 from -0.
    static void
    normalizeLocal(com.jme3.math.Vector3f input)
    Normalize the specified vector in place.
    static com.jme3.math.Vector3f
    parse(String textString)
    Parse a Vector3f from the specified text string.
    static com.jme3.math.Vector3f
    projection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
    Project vector1 onto vector2.
    static com.jme3.math.Vector3f
    rejection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
    Calculate the vector rejection of vector1 on vector2.
    static float
    scalarProjection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
    Project vector1 onto vector2.
    static com.jme3.math.Vector3f
    standardize(com.jme3.math.Vector3f input, com.jme3.math.Vector3f storeResult)
    Standardize a vector in preparation for hashing.
    static com.jme3.math.Vector3f
    velocity(float timeInterval, com.jme3.math.Vector3f startValue, com.jme3.math.Vector3f endValue, com.jme3.math.Vector3f storeResult)
    Determine the rate of change between 2 vectors.
    static com.jme3.math.Vector3f
    yRotate(com.jme3.math.Vector3f input, float angle)
    Rotate a vector CLOCKWISE about the +Y axis.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • firstAxis

      public static final int firstAxis
      index of the first (X) axis
      See Also:
    • numAxes

      public static final int numAxes
      number of axes in the coordinate system
      See Also:
    • xAxis

      public static final int xAxis
      index of the X axis
      See Also:
    • yAxis

      public static final int yAxis
      index of the Y axis
      See Also:
    • zAxis

      public static final int zAxis
      index of the Z axis
      See Also:
    • lastAxis

      public static final int lastAxis
      index of the final (Z) axis
      See Also:
    • logger

      public static final Logger logger
      message logger for this class
  • Method Details

    • accumulateMaxima

      public static void accumulateMaxima(com.jme3.math.Vector3f maxima, com.jme3.math.Vector3f input)
      Accumulate maximum coordinates.
      Parameters:
      maxima - the highest coordinate so far for each axis (not null, modified)
      input - vector to compare (not null, unaffected)
    • accumulateMinima

      public static void accumulateMinima(com.jme3.math.Vector3f minima, com.jme3.math.Vector3f input)
      Accumulate minimum coordinates.
      Parameters:
      minima - the lowest coordinate so far for each axis (not null, modified)
      input - vector to compare (not null, unaffected)
    • accumulateScaled

      public static void accumulateScaled(com.jme3.math.Vector3f total, com.jme3.math.Vector3f input, float scale)
      Accumulate a linear combination of vectors.
      Parameters:
      total - sum of the scaled inputs so far (not null, modified)
      input - the vector to scale and add (not null, unaffected)
      scale - scale factor to apply to the input
    • altitude

      public static float altitude(com.jme3.math.Vector3f offset)
      Determine the altitude angle of a non-zero offset.
      Parameters:
      offset - difference of world coordinates (not null, not zero, unaffected)
      Returns:
      angle above the X-Z plane (in radians, ≤Pi/2, ≥-Pi/2)
    • areCollinear

      public static boolean areCollinear(com.jme3.math.Vector3f point1, com.jme3.math.Vector3f point2, com.jme3.math.Vector3f point3, float tolerance2)
      Test whether 3 locations are collinear.
      Parameters:
      point1 - coordinates of the first location (not null, unaffected)
      point2 - coordinates of the 2nd location (not null, unaffected)
      point3 - coordinates of the 3rd location (not null, unaffected)
      tolerance2 - for coincidence (in squared units, ≥0)
      Returns:
      true if collinear, otherwise false
    • areWithinTolerance

      public static boolean areWithinTolerance(com.jme3.math.Vector3f a, com.jme3.math.Vector3f b, float relativeTolerance)
      Test whether 2 vector values are within the specified relative tolerance of one another.
      Parameters:
      a - the first input value (not null, unaffected)
      b - the 2nd input value (not null, unaffected)
      relativeTolerance - the relative tolerance (≥0, 0.02 → 2 percent)
      Returns:
      true each component differs by less than relativeTolerance times the max of the absolute values, otherwise false
    • axisVector

      public static com.jme3.math.Vector3f axisVector(int axisIndex, float length, com.jme3.math.Vector3f storeResult)
      Generate an axis-aligned vector with the specified length.
      Parameters:
      axisIndex - 0→X, 1→Y, 2→Z
      length - how long (ge;0)
      storeResult - storage for the result (modified if not null)
      Returns:
      an axis-aligned vector (either storeResult or a new instance)
    • azimuth

      public static float azimuth(com.jme3.math.Vector3f offset)
      Determine the azimuth angle of an offset.
      Parameters:
      offset - difference of world coordinates (not null, unaffected)
      Returns:
      horizontal angle in radians (measured CW from the X axis) or 0 if the vector is zero or parallel to the Y axis.
    • cardinalizeLocal

      public static void cardinalizeLocal(com.jme3.math.Vector3f input)
      Find the cardinal direction most similar to the specified input.
      Parameters:
      input - (not null, modified)
    • compare

      public static int compare(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
      Compare 2 vectors lexicographically, with the X-component having priority, then the Y-component. For this purpose, 0 and -0 are distinct.
      Parameters:
      v1 - the first input vector (not null, unaffected)
      v2 - the 2nd input vector (not null, unaffected)
      Returns:
      0 if v1 is equal to v2; negative if v1 comes before v2; positive if v1 comes after v2
    • covariance

      public static com.jme3.math.Matrix3f covariance(Collection<com.jme3.math.Vector3f> collection, com.jme3.math.Matrix3f storeResult)
      Determine the sample covariance of a collection of vectors.
      Parameters:
      collection - the sample vectors (not null, at least 2, unaffected)
      storeResult - storage for the result (modified if not null)
      Returns:
      the unbiased sample covariance (either storeResult or a new matrix, not null)
    • describe

      public static String describe(com.jme3.math.Vector3f vector)
      Generate a textual description of a Vector3f value.
      Parameters:
      vector - the value to describe (may be null, unaffected)
      Returns:
      a description (not null, not empty)
    • describeDirection

      public static String describeDirection(com.jme3.math.Vector3f v)
      Generate a textual description of a direction vector.
      Parameters:
      v - the value to describe (may be null, unaffected)
      Returns:
      a description (not null, not empty)
    • distanceSquared

      public static double distanceSquared(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
      Determine the squared distance between 2 vectors. Unlike Vector3f.distanceSquared(Vector3f), this method returns a double-precision value for precise comparison of distances.
      Parameters:
      vector1 - the first input vector (not null, unaffected)
      vector2 - the 2nd input vector (not null, unaffected)
      Returns:
      the squared distance (≥0)
    • distanceSquaredToSegment

      public static double distanceSquaredToSegment(com.jme3.math.Vector3f location, com.jme3.math.Vector3f segStart, com.jme3.math.Vector3f segEnd, com.jme3.math.Vector3f storeClosest)
      Determine square of the distance between a location and a line segment.
      Parameters:
      location - coordinates of input location (not null, unaffected)
      segStart - coordinates of start of segment (not null, unaffected)
      segEnd - coordinates of end of segment (not null, unaffected)
      storeClosest - storage for the coordinates of the closest location on the segment (modified if not null)
      Returns:
      the squared distance (≥0)
    • doCoincide

      public static boolean doCoincide(com.jme3.math.Vector3f point1, com.jme3.math.Vector3f point2, double tolerance2)
      Test whether 2 locations coincide.
      Parameters:
      point1 - coordinates of the first location (not null, unaffected)
      point2 - coordinates of the 2nd location (not null, unaffected)
      tolerance2 - for coincidence (in squared units, ≥0)
      Returns:
      true if they coincide, otherwise false
    • dot

      public static double dot(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
      Determine the dot (scalar) product of 2 vectors. Unlike Vector3f.dot(Vector3f), this method returns a double-precision value for precise calculation of angles.
      Parameters:
      vector1 - the first input vector (not null, unaffected)
      vector2 - the 2nd input vector (not null, unaffected)
      Returns:
      the dot product
    • eq

      public static boolean eq(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
      Test whether 2 vectors are distinct, without distinguishing 0 from -0.
      Parameters:
      v1 - the first input vector (not null, unaffected)
      v2 - the 2nd input vector (not null, unaffected)
      Returns:
      true if equal, otherwise false
    • fromAltAz

      public static com.jme3.math.Vector3f fromAltAz(float altitude, float azimuth)
      Generate a direction from altitude and azimuth angles.
      Parameters:
      altitude - angle above the X-Z plane (radians toward +Y)
      azimuth - angle in the X-Z plane (radians CCW from +X)
      Returns:
      a new unit vector
    • generateBasis

      public static void generateBasis(com.jme3.math.Vector3f in1, com.jme3.math.Vector3f store2, com.jme3.math.Vector3f store3)
      Generate an orthonormal basis that includes the specified vector.
      Parameters:
      in1 - input direction for the first basis vector (not null, not zero, modified)
      store2 - storage for the 2nd basis vector (not null, modified)
      store3 - storage for the 3rd basis vector (not null, modified)
    • horizontalDirection

      public static ReadXZ horizontalDirection(com.jme3.math.Vector3f offset)
      Determine the horizontal direction of an offset in world space.
      Parameters:
      offset - difference of world coordinates (not null, unaffected)
      Returns:
      a unit vector or a zero vector
    • intersectSegments

      public static com.jme3.math.Vector3f intersectSegments(com.jme3.math.Vector3f start1, com.jme3.math.Vector3f end1, com.jme3.math.Vector3f start2, com.jme3.math.Vector3f end2, float tolerance2)
      Determine where (if at all) 2 line segments intersect.
      Parameters:
      start1 - coordinates of start of the first segment (not null)
      end1 - coordinates of end of the first segment (not null)
      start2 - coordinates of start of the 2nd segment (not null)
      end2 - coordinates of end of the 2nd segment (not null)
      tolerance2 - for coincidence (in squared units, ≥0)
      Returns:
      a new coordinate vector, or null if no intersection found
    • isAllNonNegative

      public static boolean isAllNonNegative(com.jme3.math.Vector3f vector)
      Test whether all components of a vector are all non-negative: in other words, whether it's in the first octant or the boundaries thereof.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      true if all components are non-negative, false otherwise
    • isAllPositive

      public static boolean isAllPositive(com.jme3.math.Vector3f vector)
      Test whether all components of a vector are all positive: in other words, whether it's strictly inside the first octant.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      true if all components are positive, false otherwise
    • isBetween

      public static boolean isBetween(com.jme3.math.Vector3f a, com.jme3.math.Vector3f b, com.jme3.math.Vector3f c)
      Test whether b is inside the axis-aligned bounding box formed by a and c.
      Parameters:
      a - the location of one corner of the box (not null, unaffected)
      b - the location of being tested (not null, unaffected)
      c - the location of the corner opposite a (not null, unaffected)
      Returns:
      true if b is between a and c (inclusive), otherwise false
    • isScaleIdentity

      public static boolean isScaleIdentity(com.jme3.math.Vector3f vector)
      Test for a scale identity.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      true if the vector equals Vector3f.UNIT_XYZ, false otherwise
    • isScaleUniform

      public static boolean isScaleUniform(com.jme3.math.Vector3f vector)
      Test for a uniform scaling vector.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      true if all 3 components are equal, false otherwise
    • isZero

      public static boolean isZero(com.jme3.math.Vector3f vector)
      Test for a zero vector or translation identity.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      true if the vector equals (0,0,0), false otherwise
    • lengthSquared

      public static double lengthSquared(com.jme3.math.Vector3f vector)
      Determine the squared length of a vector. Unlike Vector3f.lengthSquared(), this method uses double-precision arithmetic to reduce the risk of overflow and returns a double-precision value for precise comparison of lengths.
      Parameters:
      vector - input (not null, unaffected)
      Returns:
      the squared length (≥0)
    • lerp

      public static com.jme3.math.Vector3f lerp(float t, com.jme3.math.Vector3f v0, com.jme3.math.Vector3f v1, com.jme3.math.Vector3f storeResult)
      Interpolate linearly between (or extrapolate linearly from) 2 vectors.

      Unlike FastMath.interpolateLinear(float, com.jme3.math.Vector3f, com.jme3.math.Vector3f, com.jme3.math.Vector3f), no rounding error is introduced when v1==v2.

      Parameters:
      t - the weight given to v1
      v0 - the function value at t=0 (not null, unaffected unless it's also storeResult)
      v1 - the function value at t=1 (not null, unaffected unless it's also storeResult)
      storeResult - storage for the result (modified if not null, may be v0 or v1)
      Returns:
      the interpolated value (either storeResult or a new instance)
    • lineMeetsLine

      public static com.jme3.math.Vector3f lineMeetsLine(com.jme3.math.Line line1, com.jme3.math.Line line2)
      Find the point on line1 closest to line2.
      Parameters:
      line1 - line1 (not null, unaffected)
      line2 - line2 (not null, unaffected)
      Returns:
      a new coordinate vector, or null if the lines are parallel
    • lineMeetsSphere

      public static com.jme3.math.Vector3f lineMeetsSphere(com.jme3.math.Line line, com.jme3.math.Vector3f center, float radius, boolean farSide)
      Find the specified intersection between a specified line and a specified sphere. If there's no intersection, find the point on the sphere closest to the line.
      Parameters:
      line - the line (not null, unaffected)
      center - center of the sphere (not null, unaffected)
      radius - size of the sphere (≥0)
      farSide - which intersection to use: true→far side of sphere, false→near side
      Returns:
      a new coordinate vector
    • localizeDirection

      public static com.jme3.math.Vector3f localizeDirection(com.jme3.math.Vector3f worldDirection, com.jme3.scene.Spatial spatial, com.jme3.math.Vector3f storeResult)
      Transform a direction vector from world coordinates to the local coordinates of the specified spatial.
      Parameters:
      worldDirection - input direction to transform (not null, unaffected, length>0)
      spatial - which spatial (not null)
      storeResult - storage for the result (modified if not null)
      Returns:
      a unit vector (either storeResult or a new instance)
    • maxAbs

      public static com.jme3.math.Vector3f maxAbs(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
      Determine the component-wise maximum of absolute values of 2 vectors.
      Parameters:
      vector1 - the first input vector (not null, unaffected unless it's also storeResult)
      vector2 - the 2nd input vector (not null, unaffected unless it's also storeResult)
      storeResult - storage for the result (modified if not null, may be vector1 or vector2)
      Returns:
      the max magnitude for each axis (either storeResult or a new vector)
    • mean

      public static com.jme3.math.Vector3f mean(Collection<com.jme3.math.Vector3f> collection, com.jme3.math.Vector3f storeResult)
      Determine the arithmetic mean of a non-empty collection of vectors.
      Parameters:
      collection - the vectors to average (not null, not empty, unaffected)
      storeResult - storage for the result (modified if not null)
      Returns:
      the mean (either storeResult or a new instance, not null)
    • midpoint

      public static com.jme3.math.Vector3f midpoint(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
      Determine the midpoint between 2 locations.
      Parameters:
      vector1 - coordinates of the first location (not null, unaffected unless it's storeResult)
      vector2 - coordinates of the 2nd location (not null, unaffected unless it's storeResult)
      storeResult - storage for the result (modified if not null, may be vector1 or vector2)
      Returns:
      a coordinate vector (either storeResult or a new instance)
    • mostRemote

      public static com.jme3.math.Vector3f[] mostRemote(List<com.jme3.math.Vector3f> locations)
      Find the most distant pair of locations in a specified list. TODO array/buffer versions
      Parameters:
      locations - list of input coordinates (not null, all elements non-null, unaffected)
      Returns:
      a new array of 2 locations, or null if no pairs found
    • ne

      public static boolean ne(com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
      Test whether 2 vectors are distinct, without distinguishing 0 from -0.
      Parameters:
      v1 - the first input vector (not null, unaffected)
      v2 - the 2nd input vector (not null, unaffected)
      Returns:
      true if distinct, otherwise false
    • normalizeLocal

      public static void normalizeLocal(com.jme3.math.Vector3f input)
      Normalize the specified vector in place.

      This method is less vulnerable to overflow than Vector3f.normalizeLocal().

      Parameters:
      input - (not null, modified)
    • parse

      public static com.jme3.math.Vector3f parse(String textString)
      Parse a Vector3f from the specified text string.
      Parameters:
      textString - input text (not null, not empty)
      Returns:
      a new vector, or null if the text is invalid
    • projection

      public static com.jme3.math.Vector3f projection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
      Project vector1 onto vector2. Don't use Vector3f.project(Vector3f) for this because (as of jME 3.0.10) it contained a logic bug which gave the wrong magnitude when vector2 had length != 1.
      Parameters:
      vector1 - the first input vector (not null, unaffected unless it's storeResult)
      vector2 - the 2nd input vector (length>0, unaffected unless it's storeResult)
      storeResult - storage for the result (modified if not null, may be vector1 or vector2)
      Returns:
      a vector with the same direction as vector2 (either storeResult or a new instance)
    • scalarProjection

      public static float scalarProjection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2)
      Project vector1 onto vector2.
      Parameters:
      vector1 - the first input vector (not null, unaffected)
      vector2 - the 2nd input vector (length>0, unaffected)
      Returns:
      the scalar projection of vector1 onto vector2
    • rejection

      public static com.jme3.math.Vector3f rejection(com.jme3.math.Vector3f vector1, com.jme3.math.Vector3f vector2, com.jme3.math.Vector3f storeResult)
      Calculate the vector rejection of vector1 on vector2.
      Parameters:
      vector1 - the first input vector (not null, unaffected unless it's storeResult)
      vector2 - the 2nd input vector (length>0, unaffected unless it's storeResult)
      storeResult - storage for the result (modified if not null, may be vector1 or vector2)
      Returns:
      a vector perpendicular to vector2 (either storeResult or a new instance)
    • standardize

      public static com.jme3.math.Vector3f standardize(com.jme3.math.Vector3f input, com.jme3.math.Vector3f storeResult)
      Standardize a vector in preparation for hashing.
      Parameters:
      input - (not null, unaffected unless it's also storeResult)
      storeResult - storage for the result (modified if not null, may be input)
      Returns:
      an equivalent vector without any negative zero components (either storeResult or a new instance)
    • velocity

      public static com.jme3.math.Vector3f velocity(float timeInterval, com.jme3.math.Vector3f startValue, com.jme3.math.Vector3f endValue, com.jme3.math.Vector3f storeResult)
      Determine the rate of change between 2 vectors.
      Parameters:
      timeInterval - the time interval (>0)
      startValue - the value at the start time (not null, unaffected)
      endValue - the value at the end time (not null, unaffected)
      storeResult - storage for the result (modified if not null)
      Returns:
      a derivative vector (either storeResult or a new instance)
    • yRotate

      public static com.jme3.math.Vector3f yRotate(com.jme3.math.Vector3f input, float angle)
      Rotate a vector CLOCKWISE about the +Y axis. Note: Used for applying azimuths, which is why its rotation angle convention is non-standard.
      Parameters:
      input - (not null, unaffected)
      angle - the clockwise (LH) angle of rotation in radians
      Returns:
      a new vector