| 1 | -- File: Lin2dBisec.cdl |
| 2 | -- Created: Wed Apr 3 11:29:37 1991 |
| 3 | -- Author: Remi GILET |
| 4 | -- <reg@topsn2> |
| 5 | ---Copyright: Matra Datavision 1991 |
| 6 | |
| 7 | |
| 8 | class Lin2dBisec |
| 9 | |
| 10 | from GccAna |
| 11 | |
| 12 | ---Purpose: Describes functions for building bisecting lines between two 2D lines. |
| 13 | -- A bisecting line between two lines is such that each of its |
| 14 | -- points is at the same distance from the two lines. |
| 15 | -- If the two lines are secant, there are two orthogonal |
| 16 | -- bisecting lines which share the angles made by the two |
| 17 | -- straight lines in two equal parts. If D1 and D2 are the |
| 18 | -- unit vectors of the two straight lines, those of the two |
| 19 | -- bisecting lines are collinear with the following vectors: |
| 20 | -- - D1 + D2 for the "internal" bisecting line, |
| 21 | -- - D1 - D2 for the "external" bisecting line. |
| 22 | -- If the two lines are parallel, the (unique) bisecting line is |
| 23 | -- the straight line equidistant from the two straight lines. If |
| 24 | -- the two straight lines are coincident, the algorithm |
| 25 | -- returns the first straight line as the solution. |
| 26 | -- A Lin2dTanObl object provides a framework for: |
| 27 | -- - defining the construction of the bisecting lines, |
| 28 | -- - implementing the construction algorithm, and |
| 29 | -- - consulting the result. |
| 30 | |
| 31 | uses Lin2d from gp, |
| 32 | Pnt2d from gp, |
| 33 | Array1OfReal from TColStd, |
| 34 | Array1OfLin2d from TColgp, |
| 35 | Array1OfPnt2d from TColgp |
| 36 | |
| 37 | raises OutOfRange from Standard, |
| 38 | NotDone from StdFail |
| 39 | |
| 40 | is |
| 41 | |
| 42 | Create(Lin1 : Lin2d from gp ; |
| 43 | Lin2 : Lin2d from gp ) returns Lin2dBisec; |
| 44 | |
| 45 | ---Purpose: Constructs bisecting lines between the two lines Lin1 and Lin2. |
| 46 | |
| 47 | IsDone(me) returns Boolean from Standard |
| 48 | is static; |
| 49 | ---Purpose: Returns True when the algorithm succeded. |
| 50 | |
| 51 | NbSolutions(me) returns Integer from Standard |
| 52 | raises NotDone |
| 53 | is static; |
| 54 | ---Purpose: Returns the number of solutions and raise NotDone if |
| 55 | -- the constructor wasn't called before. |
| 56 | |
| 57 | ThisSolution(me ; |
| 58 | Index : Integer from Standard) returns Lin2d |
| 59 | ---Purpose :Returns the solution number Index . |
| 60 | -- The first solution is the inside one and the second is the |
| 61 | -- outside one. |
| 62 | -- For the first solution the direction is D1+D2 (D1 is |
| 63 | -- the direction of the first argument and D2 the |
| 64 | -- direction of the second argument). |
| 65 | -- For the second solution the direction is D1-D2. |
| 66 | -- Raises NotDone if the construction algorithm |
| 67 | -- didn't succeed. |
| 68 | -- It raises OutOfRange if Index is greater than the |
| 69 | -- number of solutions. |
| 70 | raises OutOfRange, NotDone |
| 71 | is static; |
| 72 | |
| 73 | Intersection1 (me ; |
| 74 | Index : Integer from Standard; |
| 75 | ParSol,ParArg : out Real from Standard; |
| 76 | PntSol : out Pnt2d from gp ) |
| 77 | ---Purpose: Returns informations about the intersection point between |
| 78 | -- the result number Index and the first argument. |
| 79 | -- Raises NotDone if the construction algorithm didn't succeed. |
| 80 | -- It raises OutOfRange if Index is greater than the |
| 81 | -- number of solutions. |
| 82 | raises OutOfRange, NotDone |
| 83 | is static; |
| 84 | |
| 85 | |
| 86 | Intersection2 (me ; |
| 87 | Index : Integer from Standard; |
| 88 | ParSol,ParArg : out Real from Standard; |
| 89 | PntSol : out Pnt2d from gp ) |
| 90 | ---Purpose: Returns informations about the intersection point between |
| 91 | -- the result number Index and the second argument. |
| 92 | -- Raises NotDone if the construction algorithm |
| 93 | -- didn't succeed. |
| 94 | -- It raises OutOfRange if Index is greater than the |
| 95 | -- number of solutions. |
| 96 | raises OutOfRange, NotDone |
| 97 | is static; |
| 98 | |
| 99 | |
| 100 | fields |
| 101 | |
| 102 | WellDone : Boolean from Standard; |
| 103 | ---Purpose: True if the algorithm succeeded. |
| 104 | |
| 105 | NbrSol : Integer from Standard; |
| 106 | ---Purpose: The number of possible solutions. We have to decide about the |
| 107 | -- status of the multiple solutions... |
| 108 | |
| 109 | linsol : Array1OfLin2d from TColgp; |
| 110 | ---Purpose : The solutions. |
| 111 | |
| 112 | pntint1sol : Array1OfPnt2d from TColgp; |
| 113 | ---Purpose: The tangency point between the solution and the |
| 114 | -- first argument on the solution. |
| 115 | |
| 116 | pntint2sol : Array1OfPnt2d from TColgp; |
| 117 | ---Purpose: The tangency point between the solution and the |
| 118 | -- second argument on the solution. |
| 119 | |
| 120 | par1sol : Array1OfReal from TColStd; |
| 121 | ---Purpose: The parameter of the tangency point between the solution |
| 122 | -- and the first argument on the solution. |
| 123 | |
| 124 | par2sol : Array1OfReal from TColStd; |
| 125 | ---Purpose: The parameter of the tangency point between the solution |
| 126 | -- and the second argument on the solution. |
| 127 | |
| 128 | pararg1 : Array1OfReal from TColStd; |
| 129 | ---Purpose: The parameter of the tangency point between the solution |
| 130 | -- and the first argument on the first argument. |
| 131 | |
| 132 | pararg2 : Array1OfReal from TColStd; |
| 133 | ---Purpose: The parameter of the tangency point between the solution |
| 134 | -- and the second argument on the second argument. |
| 135 | |
| 136 | end Lin2dBisec; |