OpenLexocad  28.0
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
Geom::Lin2d::position
const Ax2d & position() const
Geom::Lin2d::contains
bool contains(const Pnt2d &P, const double LinearTolerance) const
Geom::Lin2d::setPosition
void setPosition(const Ax2d &A)
Geom::Lin2d::distance
double distance(const Lin2d &Other) const
Computes the distance between two lines.
Geom::Lin2d::setDirection
void setDirection(const Dir2d &V)
Changes the direction of the line.
Geom::Lin2d::translate
void translate(const Vec2d &V)
Ax2d.h
Geom::Lin2d::location
const Pnt2d & location() const
Returns the location point (origin) of the line.
Geom::Lin2d::mirror
void mirror(const Pnt2d &P)
Geom::Lin2d::mirrored
Lin2d mirrored(const Ax2d &A) const
Geom::Lin2d::mirror
void mirror(const Ax2d &A)
Geom::Lin2d::distance
double distance(const Pnt2d &P) const
Computes the distance between <me> and the point.
Geom::Lin2d::signedDistance
double signedDistance(const Pnt2d &P) const
Computes the signed distance between <me> and the point.
Geom::Dir2d
Definition: Dir2d.h:42
Geom::Lin2d::direction
const Dir2d & direction() const
Returns the direction of the line.
Geom::Lin2d::mirrored
Lin2d mirrored(const Pnt2d &P) const
Geom::Lin2d::reversed
Lin2d reversed() const
Geom::Lin2d::Lin2d
Lin2d(const Ax2d &A)
Creates a line located with A.
Geom::Lin2d::squareDistance
double squareDistance(const Pnt2d &P) const
Geom::Lin2d::Lin2d
Lin2d()
Creates an indefinite Line.
Geom::Vec2d
Defines a non-persistent vector in 2D space.
Definition: Vec2d.h:33
Geom::Lin2d::reverse
void reverse()
Geom::Ax2d
Definition: Ax2d.h:51
Geom::Lin2d::Lin2d
Lin2d(const Pnt2d &P, const Dir2d &V)
Geom::Lin2d::scaled
Lin2d scaled(const Pnt2d &P, const double S) const
Geom::Lin2d::translate
void translate(const Pnt2d &P1, const Pnt2d &P2)
Geom::Lin2d::_CSFDB_GetLin2dpos
const Ax2d & _CSFDB_GetLin2dpos() const
Definition: Lin2d.h:161
Geom::Lin2d::angle
double angle(const Lin2d &Other) const
Computes the angle between two lines in radians.
Geom::Lin2d::normal
Lin2d normal(const Pnt2d &P) const
Geom::Lin2d::transformed
Lin2d transformed(const Trsf2d &T) const
Transforms a line with the transformation T from class Trsf2d.
Geom::Lin2d::transform
void transform(const Trsf2d &T)
Geom::Lin2d::rotated
Lin2d rotated(const Pnt2d &P, const double Ang) const
Geom::Pnt2d
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
Geom::Trsf2d
Definition: Trsf2d.h:47
Geom::Lin2d::scale
void scale(const Pnt2d &P, const double S)
Geom::Lin2d::translated
Lin2d translated(const Pnt2d &P1, const Pnt2d &P2) const
Translates a line from the point P1 to the point P2.
Geom::Lin2d::coefficients
void coefficients(double &A, double &B, double &C) const
Geom::Lin2d
Definition: Lin2d.h:52
Geom::Lin2d::Lin2d
Lin2d(const double A, const double B, const double C)
Geom::Lin2d::rotate
void rotate(const Pnt2d &P, const double Ang)
Geom::Lin2d::translated
Lin2d translated(const Vec2d &V) const
Geom::Lin2d::setLocation
void setLocation(const Pnt2d &P)
Changes the origin of the line.
Geom::Lin2d::squareDistance
double squareDistance(const Lin2d &Other) const
Computes the square distance between two lines.
Geom
Definition: PropertyContainer.h:33