/*******************************************************************************
;*******************************************************************************
;**                                                                           **
;**                  COPYRIGHT 2001-2012 NUANCE COMMUNICATIONS                **
;**                                                                           **
;**               NUANCE COMMUNICATIONS PROPRIETARY INFORMATION               **
;**                                                                           **
;**     This software is supplied under the terms of a license agreement      **
;**     or non-disclosure agreement with Nuance Communications and may not    **
;**     be copied or disclosed except in accordance with the terms of that    **
;**     agreement.                                                            **
;**                                                                           **
;*******************************************************************************
;**                                                                           **
;**     FileName: et9afixeddata.c                                             **
;**                                                                           **
;**  Description: Path data point container for Swype path module.            **
;**                                                                           **
;*******************************************************************************
;******************************************************************************/


#include "et9afixeddata.h"


/*---------------------------------------------------------------------------*/
/*  -IDR-    
 *                                      
 *
 *                                                                   
 *                                                                         
 *                                                                       
 *                                                        
 *                                                                         
 *                                                                         
 *                     
 *
 *             
 */

void ET9FARCALL SWFixedData_init(SWFixedData *dst, SBYTE2 x, SBYTE2 y, BYTE4 dwTimeOffset, SWFixedData *prevPoint, SBYTE2 Index)
{
    dst->m_Point.x = x;
    dst->m_Point.y = y;
    dst->m_TimeOffset = dwTimeOffset;
    dst->m_Index = Index;
    if (prevPoint != NULL)
    {
        /* Adjusted calculation may be needed if Z1_FIXED_INTERVAL is not set to 5 */
        /*D1x = (x - prevPoint->m_Point.x) * 5 / Z1_FIXED_INTERVAL;       // Adjust for variance from original definition of Fixed interval size (if needed) */
        /*D1y = (y - prevPoint->m_Point.y) * 5 / Z1_FIXED_INTERVAL; */
        dst->D1x = (x - prevPoint->m_Point.x);
        dst->D1y = (y - prevPoint->m_Point.y);
        prevPoint->D2x = dst->D1x - prevPoint->D1x;
        prevPoint->D2y = dst->D1y - prevPoint->D1y;
        prevPoint->D2Sum = (prevPoint->D2x * prevPoint->D2x) + (prevPoint->D2y * prevPoint->D2y);
    }
    else
    {
        dst->D1x = 0;
        dst->D1y = 0;
    }
    dst->D2x = 0;
    dst->D2y = 0;
    dst->D2Sum = 0;
}


/*---------------------------------------------------------------------------*/
/*  -IDR-    
 *                                
 *
 *                                               
 *                                                    
 *
 *             
 */

void ET9FARCALL SWFixedData_copy(const SWFixedData *src, SWFixedData *dst)
{
    dst->m_Point = src->m_Point;
    dst->m_TimeOffset = src->m_TimeOffset;
    dst->m_PrecisePathLen = src->m_PrecisePathLen;;
    dst->D1x = src->D1x;
    dst->D1y = src->D1y;
    dst->D2x = src->D2x;
    dst->D2y = src->D2y;
    dst->D2Sum = src->D2Sum;
}

/* ----------------------------------< eof >--------------------------------- */
