proj home

Files   Classes   Functions   Hierarchy  

arc.h

Go to the documentation of this file.
00001 #ifndef ARC_H
00002 #define ARC_H
00003 
00004 #include <cassert>
00005 #include <iostream>
00006 #include <string>
00007 #include <vector>
00008 using namespace std;
00009 
00010 #include <point.h>
00011 
00012 #include <arcsdef.h>
00013 
00024 class arc
00025 {
00027   void angleAdjusted(double & angle) const;
00028 
00030   boolc isAntiClockwise2() const;
00031 public:
00032 
00034   pt2 p0;
00036   pt2 p1;
00037 
00040   double radius;
00041 
00042   //
00043   //  Calculated variables from p0, p1 and radius.
00044   //
00046   double phi0;
00048   double phi1;
00050   pt2 center;
00051 
00053   arc();
00055   arc
00056   (
00057     doublec radius_,
00058     pt2c & p0_,
00059     pt2c & p1_
00060   );
00061 
00063   void constructRadiusTwoPoints
00064   (
00065     doublec radius_,
00066     pt2c & p0_,
00067     pt2c & p1_
00068   );
00069   
00071   void constructPhi0TwoPoints
00072   (
00073     doublec phi0_,
00074     pt2c & p0_,
00075     pt2c & p1_
00076   );
00077 
00079   boolc isAntiClockwise() const
00080     { return radius > 0.0; }
00081 
00083   boolc isStraightLine() const
00084     { return radius == 0.0; }
00085   
00089   boolc valid() const;
00090   /* Read in an arc from a stream. */
00091 //  istream & serializeInverse(istream & istr)
00092 //    { return istr >> p0 >> p1 >> radius; }
00093 
00095   operator string() const;
00096 
00098   void print() const;
00099 
00101   doublec length() const;
00102 
00129   static void arcreader
00130   (
00131     vector<arc> & v, 
00132     string const & filename
00133   );
00134 
00136   void distance( double & val, pt2c & p) const;
00138   void distanceSquared( double & val, pt2c & p) const;
00139 
00141   static double zero;
00142 
00143 private:
00147   void calculateCenter();
00148 };
00149 
00150 ostream & operator << (ostream & os, arc const & a);
00151 
00152 
00153 
00154 #endif
00155 
00156 

Generated on Fri Mar 4 00:49:25 2011 for Chelton Evans Source by  doxygen 1.5.8