1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAPI_Lin2d.h
4 // Created: 29 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef GeomAPI_Lin2d_H_
8 #define GeomAPI_Lin2d_H_
10 #include <GeomAPI_Interface.h>
16 /**\class GeomAPI_Lin2d
21 class GeomAPI_Lin2d : public GeomAPI_Interface
24 /// Creation of line defined by cordinates of start and end points
26 GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
27 const double theEndY);
28 /// Creation of line defined by start and end points
30 GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
31 const std::shared_ptr<GeomAPI_Pnt2d>& theEnd);
32 /// Creation of line defined by origin and direction
34 GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theOrigin,
35 const std::shared_ptr<GeomAPI_Dir2d>& theDirection);
37 /// Returns point on the line (first point)
39 std::shared_ptr<GeomAPI_Pnt2d> location();
41 /// Returns a line direction
43 std::shared_ptr<GeomAPI_Dir2d> direction();
45 /// Distance between two points
47 double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
48 /// Intersection of two lines
50 const std::shared_ptr<GeomAPI_Pnt2d> intersect(
51 const std::shared_ptr<GeomAPI_Lin2d>& theLine) const;
52 /// Project point on line
54 const std::shared_ptr<GeomAPI_Pnt2d> project(
55 const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
56 /// Computes the cross product of the line direction and a vector from the line start point to the point
58 bool isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
60 /// Returns a location point shifted on theShift in perpendicular direction
62 std::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;