uifw/ganes/inc/HgVgSpring.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HGVGSPRING_H_
       
    19 #define HGVSPRING_H_
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>
       
    24 
       
    25 
       
    26     NONSHARABLE_CLASS(THgVgSpring)
       
    27     {
       
    28         public:
       
    29                                 
       
    30             THgVgSpring(TReal aSpringK, TReal aSpringDamping, 
       
    31                 TReal aSpringMaxVelocity, TReal aPositionSnap,
       
    32                 TReal aVelocitySnap);
       
    33 
       
    34             void SetConstants(TReal aSpringK, TReal aSpringDamping, 
       
    35                 TReal aSpringMaxVelocity, TReal aPositionSnap,
       
    36                 TReal aVelocitySnap);
       
    37 
       
    38             void Reset();
       
    39             void Reset(TReal aX, TReal aY);
       
    40             void SetXY(TReal aX, TReal aY);
       
    41             void SetEnd(TReal aX, TReal aY);
       
    42             void SetVelocity(TReal aVx, TReal aVy);
       
    43             TBool IntegratePhysics(TReal aDeltaTime, TBool aEndCondition);            
       
    44             TReal GetX() const;
       
    45             TReal GetY() const;
       
    46             TReal GetInterpolatedX() const;
       
    47             TReal GetInterpolatedY() const;
       
    48             TReal VelX() const;
       
    49             TReal VelY() const;
       
    50             TReal EndX() const;
       
    51             TReal EndY() const;            
       
    52             TReal StartX() const;
       
    53             TReal StartY() const;
       
    54             
       
    55         private:
       
    56                         
       
    57             TReal iPrevX, iPrevY;
       
    58             TReal iX, iY;
       
    59             TReal iEndX, iEndY;
       
    60             TReal iVelX, iVelY;
       
    61             TReal iAccumulator;
       
    62             TReal iSpringK;
       
    63             TReal iSpringDamping;
       
    64             TReal iMaxSpringVelocity;
       
    65             TReal iPositionSnap;
       
    66             TReal iVelocitySnap;
       
    67             TReal iStartX, iStartY;
       
    68         };
       
    69 
       
    70 
       
    71 #endif /* HGVGSPRING_H */