Project

General

Profile

« Previous | Next » 

Revision 12ecac18

Added by Leszek Koltunski almost 5 years ago

Add the 'convexity' param to Dynamics and the Dynamic app.

View differences:

src/main/java/org/distorted/library/type/Dynamic.java
150 150

  
151 151
  protected Vector<VectorCache> vc;
152 152
  protected VectorCache tmp1, tmp2;
153
  protected float mConvexity;
153 154

  
154 155
  private float[] buf;
155 156
  private float[] old;
......
181 182
    mDimension = dimension;
182 183
    mSegment   = -1;
183 184
    mLastPos   = -1;
184
    mAccessType = ACCESS_TYPE_RANDOM;
185
    mAccessType= ACCESS_TYPE_RANDOM;
186
    mConvexity = 1.0f;
185 187

  
186
    mTimeOffset = 0;
187
    mSetOffset  = true;
188
    mTimeOffset= 0;
189
    mSetOffset = true;
188 190

  
189 191
    baseV      = new float[mDimension][mDimension];
190 192
    buf        = new float[mDimension];
......
588 590
    return mDuration;
589 591
    }
590 592

  
593

  
594
///////////////////////////////////////////////////////////////////////////////////////////////////
595
/**
596
 * @param convexity If set to the default (1.0f) then interpolation between 4 points
597
 *                  (1,0) (0,1) (-1,0) (0,-1) will be the natural circle centered at (0,0) with radius 1.
598
 *                  The less it is, the less convex the circle becomes, ultimately when convexity=0.0f
599
 *                  then the interpolation shape will be straight lines connecting the four points.
600
 *                  Further setting this to negative values will make the shape concave.
601
 *                  Valid values: all floats. (although probably only something around (0,2) actually
602
 *                  makes sense)
603
 */
604
  public void setConvexity(float convexity)
605
    {
606
    if( mConvexity!=convexity )
607
      {
608
      mConvexity = convexity;
609
      cacheDirty = true;
610
      }
611
    }
612

  
613
///////////////////////////////////////////////////////////////////////////////////////////////////
614
/**
615
 * @return See {@link Dynamic#setConvexity(float)}
616
 */
617
  public float getConvexity()
618
    {
619
    return mConvexity;
620
    }
621

  
591 622
///////////////////////////////////////////////////////////////////////////////////////////////////
592 623
/**
593 624
 * Sets the access type this Dynamic will be working in.

Also available in: Unified diff