svgtopt/gfx2d/src/GfxGeom/GfxPoint2D.cpp
changeset 0 d46562c3d99d
equal deleted inserted replaced
-1:000000000000 0:d46562c3d99d
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Graphics Extension Library source file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "GfxPoint2D.h"
       
    20 
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // Constructor
       
    24 // ---------------------------------------------------------------------------
       
    25 // --------------------------------------------------------------------------
       
    26 //  TGfxPoint2D::TGfxPoint2D()
       
    27 // ---------------------------------------------------------------------------
       
    28  TGfxPoint2D::TGfxPoint2D()
       
    29     {
       
    30     }
       
    31 
       
    32 // --------------------------------------------------------------------------
       
    33 //  TGfxPoint2D::TGfxPoint2D( TFloatFixPt aX, TFloatFixPt aY ) : iX( aX ), iY( aY )
       
    34 // ---------------------------------------------------------------------------
       
    35  TGfxPoint2D::TGfxPoint2D( TFloatFixPt aX, TFloatFixPt aY ) : iX( aX ), iY( aY )
       
    36     {
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 //  TFloatFixPt TGfxPoint2D::Distance( const TGfxPoint2D& aPoint )
       
    41 // ---------------------------------------------------------------------------
       
    42  TFloatFixPt TGfxPoint2D::Distance( const TGfxPoint2D& aPoint )
       
    43     {
       
    44     return TFloatFixPt::Sqrt( DistanceSq( aPoint ) );
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 //  TFloatFixPt TGfxPoint2D::DistanceSq( const TGfxPoint2D& aPoint )
       
    49 // ---------------------------------------------------------------------------
       
    50  TFloatFixPt TGfxPoint2D::DistanceSq( const TGfxPoint2D& aPoint )
       
    51     {
       
    52     TFloatFixPt dx = iX - aPoint.iX;
       
    53     TFloatFixPt dy = iY - aPoint.iY;
       
    54     return dx * dx + dy * dy;
       
    55     }
       
    56     
       
    57 // ==========================================================================
       
    58 // Equals operator
       
    59 // ==========================================================================
       
    60  TInt TGfxPoint2D::operator==( const TGfxPoint2D& aVal ) const
       
    61     {
       
    62     return (iX == aVal.iX && iY == aVal.iY);
       
    63     }
       
    64 
       
    65 // ==========================================================================
       
    66 // Equals operator
       
    67 // ==========================================================================
       
    68  TInt TGfxPoint2D::operator!=( const TGfxPoint2D& aVal ) const
       
    69     {
       
    70     return (!(iX == aVal.iX && iY == aVal.iY));
       
    71     }