1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef GeomAPI_Lin2d_H_
22 #define GeomAPI_Lin2d_H_
24 #include <GeomAPI_Interface.h>
30 /**\class GeomAPI_Lin2d
35 class GeomAPI_Lin2d : public GeomAPI_Interface
38 /// Creation of line defined by cordinates of start and end points
40 GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
41 const double theEndY);
42 /// Creation of line defined by start and end points
44 GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
45 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd);
46 /// Creation of line defined by origin and direction
48 GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theOrigin,
49 const std::shared_ptr<GeomAPI_Dir2d>& theDirection);
51 /// Returns point on the line (first point)
53 std::shared_ptr<GeomAPI_Pnt2d> location();
55 /// Returns a line direction
57 std::shared_ptr<GeomAPI_Dir2d> direction();
59 /// Distance between two points
61 double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
62 /// Intersection of two lines
64 const std::shared_ptr<GeomAPI_Pnt2d> intersect(
65 const std::shared_ptr<GeomAPI_Lin2d>& theLine) const;
66 /// Project point on line
68 const std::shared_ptr<GeomAPI_Pnt2d> project(
69 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
70 /// Computes the cross product of the line direction and a vector
71 /// from the line start point to the point
73 bool isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
75 /// Returns a location point shifted on theShift in perpendicular direction
77 std::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;