OpenLexocad  28.0
Pnt2d.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/XY.h>
25 
26 namespace Geom
27 {
28 class Ax2d;
29 class Trsf2d;
30 class Vec2d;
31 
33 class LX_GEOM_EXPORT Pnt2d
34 {
35 public:
36  Pnt2d();
38  Pnt2d(const XY& Coord);
39 
41  Pnt2d(const double Xp, const double Yp);
42 
47  const XY& coord() const;
48 
53  double coord(const int Index) const;
55  void coord(double& Xp, double& Yp) const;
57  double distance(const Pnt2d& Other) const;
61  bool isEqual(const Pnt2d& Other, const double LinearTolerance) const;
65  void mirror(const Pnt2d& P);
66 
69  Pnt2d mirrored(const Pnt2d& P) const;
70 
71  void mirror(const Ax2d& A);
72 
75  Pnt2d mirrored(const Ax2d& A) const;
76 
77  void rotate(const Pnt2d& P, const double Ang);
79  Pnt2d rotated(const Pnt2d& P, const double Ang) const;
80 
81  void scale(const Pnt2d& P, const double S);
83  Pnt2d scaled(const Pnt2d& P, const double S) const;
84 
89  void setCoord(const int Index, const double Xi);
91  void setCoord(const double Xp, const double Yp);
93  void setX(const double X);
95  void setXY(const XY& Coord);
96 
98  void setY(const double Y);
100  double squareDistance(const Pnt2d& Other) const;
101 
102  void transform(const Trsf2d& T);
103  //
106  Pnt2d transformed(const Trsf2d& T) const;
107 
108  void translate(const Vec2d& V);
109  //
111  Pnt2d translated(const Vec2d& V) const;
112 
113  void translate(const Pnt2d& P1, const Pnt2d& P2);
114 
115  Pnt2d translated(const Pnt2d& P1, const Pnt2d& P2) const;
116 
118  double x() const;
120  const XY& xy() const;
122  double y() const;
123 
125  bool operator==(const Geom::Pnt2d& other) const;
127  bool operator!=(const Geom::Pnt2d& other) const;
128 
129 protected:
130 private:
131  XY _coord;
132 };
133 
134 } // namespace Geom
Geom::Pnt2d::mirror
void mirror(const Ax2d &A)
Geom::Pnt2d::mirrored
Pnt2d mirrored(const Pnt2d &P) const
Geom::Pnt2d::operator!=
bool operator!=(const Geom::Pnt2d &other) const
Checks whether two points are unequal within linear tolerance (default 1E-07)
Geom::Pnt2d::y
double y() const
For this point, returns its y coordinate.
Geom::Pnt2d::changeCoord
XY & changeCoord()
Geom::Pnt2d::setY
void setY(const double Y)
Assigns the given value to the Y coordinate of this point.
XY.h
X
X
Definition: Globals.h:29
Geom::Pnt2d::translated
Pnt2d translated(const Pnt2d &P1, const Pnt2d &P2) const
Geom::XY
Definition: XY.h:34
Geom::Pnt2d::xy
const XY & xy() const
For this point, returns its two coordinates as a number pair.
Geom::Pnt2d::scale
void scale(const Pnt2d &P, const double S)
Geom::Pnt2d::scaled
Pnt2d scaled(const Pnt2d &P, const double S) const
Transforms a point with the transformation T.
Geom::Pnt2d::setCoord
void setCoord(const int Index, const double Xi)
Geom::Pnt2d::Pnt2d
Pnt2d(const XY &Coord)
Creates a point with a doublet of coordinates.
Geom::Pnt2d::distance
double distance(const Pnt2d &Other) const
Computes the distance between two points.
Geom::Pnt2d::setX
void setX(const double X)
Assigns the given value to the X coordinate of this point.
Geom::Pnt2d::transformed
Pnt2d transformed(const Trsf2d &T) const
Geom::Pnt2d::setCoord
void setCoord(const double Xp, const double Yp)
For this point, assigns the values Xp and Yp to its two coordinates
Geom::Pnt2d::mirror
void mirror(const Pnt2d &P)
Geom::Pnt2d::squareDistance
double squareDistance(const Pnt2d &Other) const
Computes the square distance between two points.
Geom::Vec2d
Defines a non-persistent vector in 2D space.
Definition: Vec2d.h:33
Geom::Pnt2d::Pnt2d
Pnt2d(const double Xp, const double Yp)
Creates a point with its 2 cartesian's coordinates : Xp, Yp.
Geom::Ax2d
Definition: Ax2d.h:51
Geom::Pnt2d::rotate
void rotate(const Pnt2d &P, const double Ang)
Y
Y
Definition: Globals.h:30
Geom::Pnt2d::transform
void transform(const Trsf2d &T)
Geom::Pnt2d::coord
double coord(const int Index) const
Geom::Pnt2d::setXY
void setXY(const XY &Coord)
Assigns the two coordinates of Coord to this point.
Geom::Pnt2d::mirrored
Pnt2d mirrored(const Ax2d &A) const
Geom::Pnt2d::coord
const XY & coord() const
For this point, returns its two coordinates as a number pair.
Geom::Pnt2d
Defines a non-persistent 2D cartesian point.
Definition: Pnt2d.h:34
Geom::Pnt2d::translated
Pnt2d translated(const Vec2d &V) const
Geom::Pnt2d::x
double x() const
For this point, returns its x coordinate.
Geom::Trsf2d
Definition: Trsf2d.h:47
Geom::Pnt2d::isEqual
bool isEqual(const Pnt2d &Other, const double LinearTolerance) const
Geom::Pnt2d::translate
void translate(const Vec2d &V)
Geom::Pnt2d::operator==
bool operator==(const Geom::Pnt2d &other) const
Checks whether two points are equal within linear tolerance (default 1E-07)
Geom::Pnt2d::translate
void translate(const Pnt2d &P1, const Pnt2d &P2)
Geom::Pnt2d::rotated
Pnt2d rotated(const Pnt2d &P, const double Ang) const
Scales a point. S is the scaling value.
Geom::Pnt2d::coord
void coord(double &Xp, double &Yp) const
For this point returns its two coordinates as a number pair.
Geom::Pnt2d::Pnt2d
Pnt2d()
Geom
Definition: PropertyContainer.h:33