OpenLexocad  27.1
Lin2d.h
Go to the documentation of this file.
1 //
3 // Copyright(C) 2013-2016 OpenCascade [www.opencascade.org]
4 //
5 // This library is free software; you can redistribute it and / or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street,
18 // Fifth Floor, Boston, MA 02110 - 1301 USA
19 //
21 
22 #pragma once
23 
24 #include <Geom/Ax2d.h>
25 
26 namespace Geom
27 {
28 class Dir2d;
29 class Pnt2d;
30 class Trsf2d;
31 class Vec2d;
32 
51 class LX_GEOM_EXPORT Lin2d
52 {
53 public:
55  Lin2d();
57  Lin2d(const Ax2d& A);
58 
61  Lin2d(const Pnt2d& P, const Dir2d& V);
62 
65  Lin2d(const double A, const double B, const double C);
66 
68  double angle(const Lin2d& Other) const;
71  void coefficients(double& A, double& B, double& C) const;
75  bool contains(const Pnt2d& P, const double LinearTolerance) const;
76 
78  double distance(const Pnt2d& P) const;
80  double distance(const Lin2d& Other) const;
81 
83  double signedDistance(const Pnt2d& P) const;
84 
86  const Dir2d& direction() const;
88  const Pnt2d& location() const;
89 
90  void mirror(const Pnt2d& P);
91 
92  void mirror(const Ax2d& A);
93 
97  Lin2d mirrored(const Ax2d& A) const;
98 
102  Lin2d mirrored(const Pnt2d& P) const;
103 
106  Lin2d normal(const Pnt2d& P) const;
107 
110  const Ax2d& position() const;
111  void reverse();
112 
117  Lin2d reversed() const;
118  void rotate(const Pnt2d& P, const double Ang);
119 
122  Lin2d rotated(const Pnt2d& P, const double Ang) const;
123 
124  void scale(const Pnt2d& P, const double S);
125 
128  Lin2d scaled(const Pnt2d& P, const double S) const;
129 
131  void setDirection(const Dir2d& V);
133  void setLocation(const Pnt2d& P);
134 
138  void setPosition(const Ax2d& A);
139 
142  double squareDistance(const Pnt2d& P) const;
144  double squareDistance(const Lin2d& Other) const;
145 
146  void transform(const Trsf2d& T);
147 
149  Lin2d transformed(const Trsf2d& T) const;
150 
151  void translate(const Vec2d& V);
152 
153  void translate(const Pnt2d& P1, const Pnt2d& P2);
154 
157  Lin2d translated(const Vec2d& V) const;
158 
160  Lin2d translated(const Pnt2d& P1, const Pnt2d& P2) const;
161  const Ax2d& _CSFDB_GetLin2dpos() const { return _pos; }
162 
163 
164 protected:
165 private:
166  Ax2d _pos;
167 };
168 
169 } // namespace Geom
Definition: Variant.h:60
Definition: Lin2d.h:51
Definition: Ax2d.h:48
Definition: Dir2d.h:38
void transform(Container container, OutputIt out, BinaryFunction function)
Definition: Algorithms.h:29
const Ax2d & _CSFDB_GetLin2dpos() const
Definition: Lin2d.h:161
Defines a non-persistent vector in 2D space.
Definition: Vec2d.h:34
Definition: Trsf2d.h:46
double distance(const Geom::Vec &v1, const Geom::Vec &v2)
Returns the distance between two points.
Definition: Vec.h:345
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:33