Class MjPolynomial1f


  • public class MjPolynomial1f
    extends java.lang.Object
    Limited implementation of a floating-point polynomial of 1 variable.
    • Constructor Summary

      Constructors 
      Constructor Description
      MjPolynomial1f()
      Creates a new MjPolynomial1f object.
      MjPolynomial1f​(int iDegree)
      Creates a new MjPolynomial1f object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Float bisection​(float fXMin, float fXMax, int iDigitsAccuracy)
      Returns Float which is null if no root is found; otherwise contains the value of the root.
      float eval​(float fT)
      evaluate this polynomial for the specified value.
      float getCoeff​(int i)
      DOCUMENT ME!
      int getDegree()
      DOCUMENT ME!
      MjPolynomial1f getDerivative()
      return new instance which is the derivative of this instance.
      float getRootBisection()
      Called by computeRadius, finds the root of the <= 8 degree polynomial through bisection method:
      int getRootsOnInterval​(float fXMin, float fXMax, float[] afRoot, int iDigitsAccuracy)
      afRoot should have length 2; returns number roots found, which are returned in the afRoot array.
      void mul​(MjPolynomial1f kPoly1, MjPolynomial1f kPoly2)
      set this polynomial to the product of two polynomials.
      int rootsDegree3​(float[] afRoot)
      afRoot should have length 3 which is used to return the real roots found; returns 0 if no root can be found, otherwise returns the number of real roots found (1 or 3);
      void scale​(float fScalar)
      sets this instance to the scalar product with itself.
      void set​(MjPolynomial1f kPoly)
      set this polynomial to have the same coefficients as those in the specified polynomial.
      void setCoeff​(int i, float fValue)
      DOCUMENT ME!
      void sub​(MjPolynomial1f kPoly1, MjPolynomial1f kPoly2)
      sets this instance to the difference of two polynomial instances.
      • Methods inherited from class java.lang.Object

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

      • ms_fInvLog2

        private static final float ms_fInvLog2
        DOCUMENT ME!
      • ms_fLog10

        private static final float ms_fLog10
        DOCUMENT ME!
      • ms_fSqrt3

        private static final float ms_fSqrt3
        DOCUMENT ME!
      • ms_fTwentySeventh

        private static final float ms_fTwentySeventh
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • m_afCoeff

        protected float[] m_afCoeff
        DOCUMENT ME!
      • m_iDegree

        protected int m_iDegree
        DOCUMENT ME!
    • Constructor Detail

      • MjPolynomial1f

        public MjPolynomial1f()
        Creates a new MjPolynomial1f object.
      • MjPolynomial1f

        public MjPolynomial1f​(int iDegree)
        Creates a new MjPolynomial1f object.
        Parameters:
        iDegree - DOCUMENT ME!
    • Method Detail

      • bisection

        public java.lang.Float bisection​(float fXMin,
                                         float fXMax,
                                         int iDigitsAccuracy)
        Returns Float which is null if no root is found; otherwise contains the value of the root.
        Parameters:
        fXMin - DOCUMENT ME!
        fXMax - DOCUMENT ME!
        iDigitsAccuracy - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • eval

        public float eval​(float fT)
        evaluate this polynomial for the specified value.
        Parameters:
        fT - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getCoeff

        public float getCoeff​(int i)
        DOCUMENT ME!
        Parameters:
        i - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getDegree

        public int getDegree()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • getDerivative

        public MjPolynomial1f getDerivative()
        return new instance which is the derivative of this instance.
        Returns:
        DOCUMENT ME!
      • getRootBisection

        public float getRootBisection()
        Called by computeRadius, finds the root of the <= 8 degree polynomial through bisection method:
        Returns:
        DOCUMENT ME!
      • getRootsOnInterval

        public int getRootsOnInterval​(float fXMin,
                                      float fXMax,
                                      float[] afRoot,
                                      int iDigitsAccuracy)
        afRoot should have length 2; returns number roots found, which are returned in the afRoot array.
        Parameters:
        fXMin - DOCUMENT ME!
        fXMax - DOCUMENT ME!
        afRoot - DOCUMENT ME!
        iDigitsAccuracy - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • mul

        public void mul​(MjPolynomial1f kPoly1,
                        MjPolynomial1f kPoly2)
        set this polynomial to the product of two polynomials.
        Parameters:
        kPoly1 - DOCUMENT ME!
        kPoly2 - DOCUMENT ME!
      • rootsDegree3

        public int rootsDegree3​(float[] afRoot)
        afRoot should have length 3 which is used to return the real roots found; returns 0 if no root can be found, otherwise returns the number of real roots found (1 or 3);
        Parameters:
        afRoot - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • scale

        public void scale​(float fScalar)
        sets this instance to the scalar product with itself.
        Parameters:
        fScalar - DOCUMENT ME!
      • set

        public void set​(MjPolynomial1f kPoly)
        set this polynomial to have the same coefficients as those in the specified polynomial.
        Parameters:
        kPoly - DOCUMENT ME!
      • setCoeff

        public void setCoeff​(int i,
                             float fValue)
        DOCUMENT ME!
        Parameters:
        i - DOCUMENT ME!
        fValue - DOCUMENT ME!
      • sub

        public void sub​(MjPolynomial1f kPoly1,
                        MjPolynomial1f kPoly2)
        sets this instance to the difference of two polynomial instances.
        Parameters:
        kPoly1 - DOCUMENT ME!
        kPoly2 - DOCUMENT ME!