b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | // JCV 08/01/91 Modifs introduction des classes XY, Mat2d dans le package gp |
16 | |
17 | #define No_Standard_OutOfRange |
18 | |
42cf5bc1 |
19 | |
20 | #include <gp_Ax2d.hxx> |
21 | #include <gp_Pnt2d.hxx> |
22 | #include <gp_Trsf2d.hxx> |
23 | #include <gp_Vec2d.hxx> |
24 | #include <gp_XY.hxx> |
bc73b006 |
25 | #include <Standard_Dump.hxx> |
42cf5bc1 |
26 | #include <Standard_OutOfRange.hxx> |
7fd59977 |
27 | |
28 | void gp_Pnt2d::Transform (const gp_Trsf2d& T) |
29 | { |
30 | if (T.Form () == gp_Identity) { } |
31 | else if (T.Form () == gp_Translation) |
32 | { coord.Add (T.TranslationPart ()); } |
33 | else if (T.Form () == gp_Scale) { |
34 | coord.Multiply (T.ScaleFactor ()); |
35 | coord.Add (T.TranslationPart ()); |
36 | } |
37 | else if (T.Form () == gp_PntMirror) { |
38 | coord.Reverse (); |
39 | coord.Add (T.TranslationPart ()); |
40 | } |
41 | else { T.Transforms(coord); } |
42 | } |
43 | |
44 | void gp_Pnt2d::Mirror (const gp_Pnt2d& P) |
45 | { |
46 | coord.Reverse (); |
47 | gp_XY XY = P.coord; |
48 | XY.Multiply (2.0); |
49 | coord.Add (XY); |
50 | } |
51 | |
52 | gp_Pnt2d gp_Pnt2d::Mirrored (const gp_Pnt2d& P) const |
53 | { |
54 | gp_Pnt2d Pres = *this; |
55 | Pres.Mirror (P); |
56 | return Pres; |
57 | } |
58 | |
59 | void gp_Pnt2d::Mirror (const gp_Ax2d& A) |
60 | { |
61 | gp_Trsf2d T; |
62 | T.SetMirror (A); |
63 | T.Transforms (coord); |
64 | } |
65 | |
66 | gp_Pnt2d gp_Pnt2d::Mirrored (const gp_Ax2d& A) const |
67 | { |
68 | gp_Pnt2d P = *this; |
69 | P.Mirror (A); |
70 | return P; |
71 | } |
72 | |
bc73b006 |
73 | void gp_Pnt2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const |
74 | { |
75 | OCCT_DUMP_VECTOR_CLASS (theOStream, "gp_Pnt2d", 2, coord.X(), coord.Y()) |
76 | } |