X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGLViewer%2FGLViewer_Geom.cxx;h=88149cfe5960f02f9dfc28a2d0806b8b8c1788f9;hb=797f7c8b3ebf8d8a1eabc9082f8bd79f6f7ea413;hp=cd0ef5cae9e4f4469450941fe400e8d1ca78b269;hpb=28124bc2dd22481a5a915b2b96b835ef5323a6f6;p=modules%2Fgui.git diff --git a/src/GLViewer/GLViewer_Geom.cxx b/src/GLViewer/GLViewer_Geom.cxx index cd0ef5cae..88149cfe5 100644 --- a/src/GLViewer/GLViewer_Geom.cxx +++ b/src/GLViewer/GLViewer_Geom.cxx @@ -1,41 +1,36 @@ -// 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 -#include +// +#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 and directed -// along positive X axis direction (or Y axis if vertical ) -//================================================================ +/*! + constructs a ray starting at 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 -//================================================================ +/*! + detects intersection with segment +*/ 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, mustn't be deleted here! -//================================================================ +/*! + destructor, mustn't be deleted here! +*/ GLViewer_Poly::~GLViewer_Poly() { } -//================================================================ -// Function : IsIn -// Purpose : returns true if lies within this polygon -//================================================================ +/*! + \return true if 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 lies within this polygon +*/ /* -//================================================================ -// Function : IsIn -// Purpose : returns true if 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 covers this polygon -//================================================================ +/*! + \return true if 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 covers this polygon -//================================================================ +/*! + \return true if covers this polygon +*/ bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const { if ( !myPoints ) //needs check for @@ -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 )