Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:22:03

0001 // Created on: 1991-04-03
0002 // Created by: Remi GILET
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GccAna_Lin2dBisec_HeaderFile
0018 #define _GccAna_Lin2dBisec_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <gp_Lin2d.hxx>
0025 #include <NCollection_Array1.hxx>
0026 #include <gp_Pnt2d.hxx>
0027 class gp_Lin2d;
0028 class gp_Pnt2d;
0029 
0030 //! Describes functions for building bisecting lines between two 2D lines.
0031 //! A bisecting line between two lines is such that each of its
0032 //! points is at the same distance from the two lines.
0033 //! If the two lines are secant, there are two orthogonal
0034 //! bisecting lines which share the angles made by the two
0035 //! straight lines in two equal parts. If D1 and D2 are the
0036 //! unit vectors of the two straight lines, those of the two
0037 //! bisecting lines are collinear with the following vectors:
0038 //! -   D1 + D2 for the "internal" bisecting line,
0039 //! -   D1 - D2 for the "external" bisecting line.
0040 //! If the two lines are parallel, the (unique) bisecting line is
0041 //! the straight line equidistant from the two straight lines. If
0042 //! the two straight lines are coincident, the algorithm
0043 //! returns the first straight line as the solution.
0044 //! A Lin2dTanObl object provides a framework for:
0045 //! -   defining the construction of the bisecting lines,
0046 //! -   implementing the construction algorithm, and
0047 //! -   consulting the result.
0048 class GccAna_Lin2dBisec
0049 {
0050 public:
0051   DEFINE_STANDARD_ALLOC
0052 
0053   //! Constructs bisecting lines between the two lines Lin1 and Lin2.
0054   Standard_EXPORT GccAna_Lin2dBisec(const gp_Lin2d& Lin1, const gp_Lin2d& Lin2);
0055 
0056   //! Returns True when the algorithm succeeded.
0057   Standard_EXPORT bool IsDone() const;
0058 
0059   //! Returns the number of solutions and raise NotDone if
0060   //! the constructor wasn't called before.
0061   Standard_EXPORT int NbSolutions() const;
0062 
0063   //! Returns the solution number Index .
0064   //! The first solution is the inside one and the second is the
0065   //! outside one.
0066   //! For the first solution the direction is D1+D2 (D1 is
0067   //! the direction of the first argument and D2 the
0068   //! direction of the second argument).
0069   //! For the second solution the direction is D1-D2.
0070   //! Raises NotDone if the construction algorithm
0071   //! didn't succeed.
0072   //! It raises OutOfRange if Index is greater than the
0073   //! number of solutions.
0074   Standard_EXPORT gp_Lin2d ThisSolution(const int Index) const;
0075 
0076   //! Returns information about the intersection point between
0077   //! the result number Index and the first argument.
0078   //! Raises NotDone if the construction algorithm didn't succeed.
0079   //! It raises OutOfRange if Index is greater than the
0080   //! number of solutions.
0081   Standard_EXPORT void Intersection1(const int Index,
0082                                      double&   ParSol,
0083                                      double&   ParArg,
0084                                      gp_Pnt2d& PntSol) const;
0085 
0086   //! Returns information about the intersection point between
0087   //! the result number Index and the second argument.
0088   //! Raises NotDone if the construction algorithm
0089   //! didn't succeed.
0090   //! It raises OutOfRange if Index is greater than the
0091   //! number of solutions.
0092   Standard_EXPORT void Intersection2(const int Index,
0093                                      double&   ParSol,
0094                                      double&   ParArg,
0095                                      gp_Pnt2d& PntSol) const;
0096 
0097 private:
0098   bool                         WellDone;
0099   int                          NbrSol;
0100   NCollection_Array1<gp_Lin2d> linsol;
0101   NCollection_Array1<gp_Pnt2d> pntint1sol;
0102   NCollection_Array1<gp_Pnt2d> pntint2sol;
0103   NCollection_Array1<double>   par1sol;
0104   NCollection_Array1<double>   par2sol;
0105   NCollection_Array1<double>   pararg1;
0106   NCollection_Array1<double>   pararg2;
0107 };
0108 
0109 #endif // _GccAna_Lin2dBisec_HeaderFile