00001
00002
00003
00004
00005
00006 #include "geomrep/ArcRep.h"
00007 #include <algorithm>
00008
00009
00010 ArcRep::ArcRep( const Point& center, double radius,
00011 const Vector& xhat, const Vector& yhat, double phi0)
00012
00013 :m_center(center), m_radius(radius),
00014 m_xhat(xhat), m_yhat(yhat), m_phi0(phi0)
00015 {}
00016
00017
00018 void ArcRep::update()
00019
00020 {
00021 static const int ns=48;
00022 static const double dphi= 2.0*M_PI/(ns-1);
00023 double phi=-m_phi0;
00024 move_to(m_center+m_radius*cos(phi)*m_xhat + m_radius*sin(phi)*m_yhat);
00025 for(int i=0; i<ns; i++) {
00026 phi = std::min(m_phi0, phi+dphi) ;
00027 line_to( m_center + m_radius*cos(phi)*m_xhat + m_radius*sin(phi)*m_yhat );
00028 if( phi>=m_phi0 ) break;
00029 }
00030 flush();
00031 }