-// Copyright (C) 2005 OPEN CASCADE
+// Copyright (C) 2007-2016 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 ),
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,
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;
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 )
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 )
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() )
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>
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 )