home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / freedraft.tar.gz / freedraft.tar / FREEdraft-050298 / GEOMLIB2D / geomlib2d.h < prev    next >
C/C++ Source or Header  |  1998-04-29  |  6KB  |  150 lines

  1. //geomlib2d.h
  2.  
  3. // Copyright (C) 1997  Cliff Johnson                                       //
  4. //                                                                         //
  5. // This program is free software; you can redistribute it and/or           //
  6. // modify it under the terms of the GNU  General Public                    //
  7. // License as published by the Free Software Foundation; either            //
  8. // version 2 of the License, or (at your option) any later version.        //
  9. //                                                                         //
  10. // This software is distributed in the hope that it will be useful,        //
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of          //
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       //
  13. // General Public License for more details.                                //
  14. //                                                                         //
  15. // You should have received a copy of the GNU General Public License       //
  16. // along with this software (see COPYING); if not, write to the        //
  17. // Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //
  18.  
  19. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  20. //
  21. //
  22. //    FreeEngineer 2D Drafting Library Functions - libFE2D
  23. //
  24. //
  25. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26.  
  27. #ifndef GEOMLIB2D_H
  28. #define GEOMLIB2D_H
  29.  
  30. class Pick;
  31. class Point;
  32. class Line;
  33. class Circle;
  34. class Segment;
  35. class Arc;
  36. class GeomException;
  37.  
  38.  
  39. // These here functions all take the generic "Pick" as parameters... 
  40. // This doesn't mean that all these functions take any thing at all that
  41. // may be in the Pick. Functions will throw GeomExceptions on unhandled input. 
  42.  
  43. // all purpose function for getting midpoint, endpoint, and center of entities.
  44. // see enum's for permissible integer parameters
  45.     Point GL2D_PointByModifier(const Pick& pk1,int) 
  46.         throw(GeomException); 
  47.     
  48. // intersection of point/line/circles/arc/segment combinations
  49.     Point GL2D_PointByConstraints(const Pick& pk1, const Pick& pk2) 
  50.         throw (GeomException);
  51.  
  52. //Line LineParallel(const Line& l, double d);
  53.     Line GL2D_LineParallel(const Line& l, const Pick& pk) 
  54.         throw (GeomException);
  55.     
  56. // Line constrained by two selections
  57.     Line GL2D_LineByConstraints(const Pick& pk1, const Pick& pk2)  
  58.         throw (GeomException);
  59.  
  60. //Line Orthoginal(const Pick& pk1 , const Pick& pk2 ); // Constraint, Subject
  61. //
  62. // circle with a given center and tangent/passing 1 selection
  63.     Circle GL2D_CircleCenter(const Pick& pk1, const Pick& pk2) 
  64.         throw (GeomException);
  65.  
  66.     Circle GL2D_CircleRadiusAndConstraints(double r, const Pick& pk1, const Pick& pk2) 
  67.         throw (GeomException);
  68.         
  69. //Circle CircleParallel(const Pick& c, double d);
  70. //Circle CircleParallel(const Pick& c, const Pick& t); // parallel to c,  tangent to t
  71. //Circle CircleConstraint(const Pick&, const Pick&, const Pick&);
  72.  
  73.  
  74. // these functions are for solving specific problems
  75. // they may throw GeomExceptions when input is invalid, or when solutions are not found or infinite.
  76. // The above pick based functions use these to solve specific situations. 
  77. // In general, user programs should use the above pick based functions. 
  78.  
  79. // get a Point at the intersection of 2 lines
  80.     Point GL2D_SolveLineLineIntersection(const Line& l1, const Line& l2) 
  81.         throw (GeomException);
  82.  
  83. // get a line passing through a point and tangent to a circle
  84.     Line GL2D_SolveLineTangentPointCircle(const Point& p, const Circle& c, const Point& pkpt) 
  85.         throw (GeomException);
  86.  
  87. // get the bisector of two lines, or the midline of parallel lines
  88.     Line GL2D_SolveLineConstrainedLineLine(const Line&,const Line& l2, const Point&, const Point&) 
  89.         throw (GeomException);
  90.  
  91. // get the line tangent to two circles
  92.     Line GL2D_SolveLineTangentCircleCircle(const Circle&, const Circle&, const Point&, const Point&) 
  93.         throw (GeomException);
  94.  
  95. // get a line tangent to a circle and parallel to a line
  96.     Line GL2D_SolveLineTangentCircleParallelLine(const Circle&, const Line&, const Point&) 
  97.         throw (GeomException);
  98.  
  99. // arc passing through 3 points
  100.     Arc GL2D_SolveArc3Points(const Point& , const Point& , const Point& ) 
  101.         throw (GeomException);
  102.  
  103. // circle passing through 3 points
  104.     Circle GL2D_SolveCircle3Points(const Point& , const Point& , const Point& ) 
  105.         throw (GeomException);
  106.  
  107. // circle passing a point, tangent to a circle, radius r, solution closest to a point
  108.     Circle GL2D_SolveCircleTanPointCircleRadius(const Point&, const Circle&, const double&, const Point& ) 
  109.         throw (GeomException);
  110.         
  111. // circle tangent to 2 lines, radius, solution chosen by point location
  112.     Circle GL2D_SolveCircleTanLineLineRadius(const Line&, const Line&, const double&, const Point&)
  113.         throw (GeomException);
  114.         
  115. // circle passing a point, tangent to a line, radius r, solution closest to a point
  116.     Circle GL2D_SolveCircleTanPointLineRadius(const Point&, const Line&, const double&, const Point&)
  117.         throw (GeomException);
  118.         
  119. // circle passing 2 points, radius r, right handed circle between points
  120.     Circle GL2D_SolveCircleTanPointPointRadius(const Point&, const Point&, const double&)
  121.         throw (GeomException);
  122.         
  123. // circle tanget to 2 circles, radius r, solution chosen by proximity to 2 selection points
  124.     Circle GL2D_SolveCircleTanCircleCircleRadius(const Circle&, const Circle&, const double&, const Point&, const Point&)
  125.         throw (GeomException);
  126.         
  127. // circle tangent to a line, tangent to a circle, radius r, solution chosen by 2 selection points
  128.     Circle GL2D_SolveCircleTanLineCircleRadius(const Line&, const Circle&, const double&, const Point&, const Point&)
  129.         throw (GeomException);
  130.     
  131. // intersect a line and a circle and return the solution closest to a point 
  132.     Point GL2D_SolveLineCircleIntersection(const Line& , const Circle& , const Point&) 
  133.         throw (GeomException);
  134.  
  135. // intersect two circles returning the solution closest to a point
  136.     Point GL2D_SolveCircleCircleIntersection(const Circle&,const Circle&, const Point&) 
  137.         throw (GeomException);
  138.  
  139. // plane rotation of a vector - theta in radians
  140.     Point GL2D_Rotate(const Point& v, double theta) 
  141.         throw (GeomException); 
  142.  
  143. // formulate a normalized explicit form of a Line
  144.     int GL2D_NormalizedExplicitForm(double& a, double& b, double& c, const Line& l) 
  145.         throw (GeomException);
  146. // returns LINE_IS_VERTICAL in that special case
  147.  
  148.  
  149. #endif
  150.