Salome HOME
updated copyright message
[modules/gui.git] / src / GLViewer / GLViewer_Geom.cxx
index cd0ef5cae9e4f4469450941fe400e8d1ca78b269..e9b1b7eb95c71442e312f7a91fe7f6c31a6f41ba 100644 (file)
@@ -1,41 +1,36 @@
-//  Copyright (C) 2005 OPEN CASCADE
+// Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  Author : OPEN CASCADE
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-/***************************************************************************
-**  Class:   GLViewer_Geom
-**  Descr:   
-**  Module:  GLViewer
-**  Created: UI team, 16.11.04
-****************************************************************************/
-
+//  Author : OPEN CASCADE
 //#include <GLViewerAfx.h>
-#include <GLViewer_Geom.h>
+//
+#include "GLViewer_Geom.h"
 
 #define FAR_POINT 1e10  // Value used as a "very distant" co-ordinate
 #define TOLERANCE 1e-3
 
-//================================================================
-// Function : GLViewer_Segment
-// Purpose  : constructs a real segment bounded by two points
-//================================================================
+/*!
+  constructs a real segment bounded by two points
+*/
 GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt1, 
                                     const GLViewer_Pnt& thePnt2 )
 : myPnt1( thePnt1 ), 
@@ -46,11 +41,9 @@ GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt1,
   myC = myPnt1.x() * myPnt2.y() - myPnt2.x() * myPnt1.y();
 }
 
-//================================================================
-// Function : GLViewer_Segment
-// Purpose  : constructs a ray starting at <thePnt> and directed
-//            along positive X axis direction (or Y axis if vertical )
-//================================================================
+/*!
+  constructs a ray starting at <thePnt> and directed along positive X axis direction (or Y axis if vertical )
+*/
 GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt, 
                                     const GLfloat theA, 
                                     const GLfloat theB,
@@ -66,18 +59,16 @@ GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt,
     myPnt2 = GLViewer_Pnt( FAR_POINT, - myA / myB * FAR_POINT - myC / myB );
 }
 
-//================================================================
-// Function : GLViewer_Segment
-// Purpose  : destructor, does nothing
-//================================================================
+/*!
+  destructor, does nothing
+*/
 GLViewer_Segment::~GLViewer_Segment()
 {
 }
 
-//================================================================
-// Function : HasIntersection
-// Purpose  : detects intersection with segment <theOther>
-//================================================================
+/*!
+  detects intersection with segment <theOther>
+*/
 bool GLViewer_Segment::HasIntersection( const GLViewer_Segment& theOther ) const
 {
   bool aRes = false;
@@ -113,27 +104,24 @@ bool GLViewer_Segment::HasIntersection( const GLViewer_Segment& theOther ) const
   return aRes;
 }
 
-//================================================================
-// Function : GLViewer_Poly
-// Purpose  : constructs a closed polygon from the given ordered list of points
-//================================================================
+/*!
+  constructs a closed polygon from the given ordered list of points
+*/
 GLViewer_Poly::GLViewer_Poly( const GLViewer_PntList* thePoints )
 : myPoints( (GLViewer_PntList*)thePoints )
 {
 }
 
-//================================================================
-// Function : ~GLViewer_Poly
-// Purpose  : destructor, <myPoints> mustn't be deleted here!
-//================================================================
+/*!
+  destructor, <myPoints> mustn't be deleted here!
+*/
 GLViewer_Poly::~GLViewer_Poly()
 {
 }
 
-//================================================================
-// Function : IsIn
-// Purpose  : returns true if <thePnt> lies within this polygon
-//================================================================
+/*!
+  \return true if <thePnt> lies within this polygon
+*/
 bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt ) const
 {
   if ( !myPoints )
@@ -159,11 +147,10 @@ bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt ) const
 
   return ( aNbInter % 2 == 1 );
 }
+/*!
+  \return true if <thePnt> lies within this polygon
+*/
 /*
-//================================================================
-// Function : IsIn
-// Purpose  : returns true if <thePnt> lies within this polygon
-//================================================================
 bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt, const float tolerance ) const
 {
   if ( !myPoints )
@@ -184,10 +171,9 @@ bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt, const float tolerance ) co
   return res;
 }
 */
-//================================================================
-// Function : IsCovers
-// Purpose  : returns true if <thePoly> covers this polygon
-//================================================================
+/*!
+  \return true if <thePoly> covers this polygon
+*/
 bool GLViewer_Poly::IsCovers( const GLViewer_Poly& thePoly ) const
 {
     if ( !myPoints || !thePoly.Count() )
@@ -204,10 +190,9 @@ bool GLViewer_Poly::IsCovers( const GLViewer_Poly& thePoly ) const
     return true;
 }
 
-//================================================================
-// Function : IsCovers
-// Purpose  : returns true if <theRect> covers this polygon
-//================================================================
+/*!
+  \return true if <theRect> covers this polygon
+*/
 bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const
 {
     if ( !myPoints ) //needs check for <theRect>
@@ -224,10 +209,10 @@ bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const
     return IsCovers( GLViewer_Poly( &aList ) );
 }
 
-//================================================================
-// Function : HasIntersection
-// Purpose  : looks for any 
-//================================================================
+/*!
+  \return true if polygon has intersection with segment or ray
+  \param theSegment - segment to check intersection
+*/
 bool GLViewer_Poly::HasIntersection( const GLViewer_Segment& theSegment ) const
 {
   if ( !myPoints )