points.h File Reference

#include <iostream>
#include <cmath>
#include <cassert>

Go to the source code of this file.

Data Structures

class  Point2D< coord_type >

Functions

template<class point_type1, class point_type2>
double euc_distance (Point2D< point_type1 > pt1, Point2D< point_type2 > pt2)
template<class point_type, class mul_type>
Point2D< point_type > operator* (const Point2D< point_type > pt, mul_type val)
template<class mul_type, class point_type>
Point2D< point_type > operator* (mul_type val, const Point2D< point_type > pt)
template<class point1_type, class point2_type>
Point2D< double > operator+ (const Point2D< point1_type > &pt1, const Point2D< point2_type > &pt2)
template<class point1_type, class point2_type>
Point2D< point1_type > operator- (Point2D< point1_type > pt1, Point2D< point2_type > pt2)
template<class point_type, class div_type>
Point2D< point_type > operator/ (const Point2D< point_type > pt, div_type val)


Function Documentation

template<class point_type1, class point_type2>
double euc_distance ( Point2D< point_type1 >  pt1,
Point2D< point_type2 >  pt2 
) [inline]

Definition at line 245 of file points.h.

References Point2D< coord_type >::getX(), and Point2D< coord_type >::getY().

Referenced by BiArc::compute_biarc_params(), EulerSpiral::compute_error(), and EulerSpiral::compute_es_params().

00246   {
00247     double x_dist, y_dist,dist=0;
00248 
00249     x_dist = (pt1.getX()-pt2.getX())*(pt1.getX()-pt2.getX());
00250     y_dist = (pt1.getY()-pt2.getY())*(pt1.getY()-pt2.getY());
00251 
00252     dist = sqrt(x_dist+y_dist);
00253     return dist;
00254    }

template<class point_type, class mul_type>
Point2D<point_type> operator* ( const Point2D< point_type >  pt,
mul_type  val 
) [inline]

Definition at line 187 of file points.h.

00188   {
00189     return val*pt;
00190    }

template<class mul_type, class point_type>
Point2D<point_type> operator* ( mul_type  val,
const Point2D< point_type >  pt 
) [inline]

Definition at line 180 of file points.h.

References Point2D< coord_type >::getX(), and Point2D< coord_type >::getY().

00181   {
00182     return Point2D<point_type>(val*pt.getX(), val*pt.getY());
00183    }

template<class point1_type, class point2_type>
Point2D<double> operator+ ( const Point2D< point1_type > &  pt1,
const Point2D< point2_type > &  pt2 
) [inline]

Definition at line 215 of file points.h.

References Point2D< coord_type >::getX(), and Point2D< coord_type >::getY().

00216   {
00217     return Point2D<double>(pt1.getX()+pt2.getX(), pt1.getY()+pt2.getY());
00218    }

template<class point1_type, class point2_type>
Point2D<point1_type> operator- ( Point2D< point1_type >  pt1,
Point2D< point2_type >  pt2 
) [inline]

Definition at line 228 of file points.h.

References Point2D< coord_type >::getX(), and Point2D< coord_type >::getY().

00229   {
00230     return Point2D<point1_type>(pt1.getX()-pt2.getX(), pt1.getY()-pt2.getY());
00231    }

template<class point_type, class div_type>
Point2D<point_type> operator/ ( const Point2D< point_type >  pt,
div_type  val 
) [inline]

Definition at line 198 of file points.h.

References Point2D< coord_type >::getX(), and Point2D< coord_type >::getY().

00199   {
00200     if (val ==0)
00201         std::cout<<" Error: <Point2D operator/> Division by 0"<<std::endl;
00202     return Point2D<point_type>(pt.getX()/val, pt.getY()/val);
00203    }


Generated on Wed May 5 00:06:39 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6