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 modif introduction des classes XY et Mat dans le package |
16 | // LPA, JCV 07/92 passage sur C1. |
17 | // JCV 07/92 Introduction de la method Dump |
18 | |
19 | #define No_Standard_OutOfRange |
20 | |
42cf5bc1 |
21 | #include <gp_Ax2d.hxx> |
d5477f8c |
22 | |
42cf5bc1 |
23 | #include <gp_Dir2d.hxx> |
24 | #include <gp_Pnt2d.hxx> |
25 | #include <gp_Trsf2d.hxx> |
26 | #include <gp_Vec2d.hxx> |
7fd59977 |
27 | #include <gp_XY.hxx> |
bc73b006 |
28 | #include <Standard_Dump.hxx> |
7fd59977 |
29 | |
30 | Standard_Boolean gp_Ax2d::IsCoaxial (const gp_Ax2d& Other, |
31 | const Standard_Real AngularTolerance, |
32 | const Standard_Real LinearTolerance) const |
33 | { |
34 | gp_XY XY1 = loc.XY(); |
35 | XY1.Subtract (Other.loc.XY()); |
36 | Standard_Real D1 = XY1.Crossed (Other.vdir.XY()); |
37 | if (D1 < 0) D1 = - D1; |
38 | gp_XY XY2 = Other.loc.XY(); |
39 | XY2.Subtract (loc.XY()); |
40 | Standard_Real D2 = XY2.Crossed (vdir.XY()); |
41 | if (D2 < 0) D2 = - D2; |
42 | return (vdir.IsParallel (Other.vdir, AngularTolerance) && |
43 | D1 <= LinearTolerance && D2 <= LinearTolerance); |
44 | } |
45 | |
46 | void gp_Ax2d::Scale (const gp_Pnt2d& P, |
47 | const Standard_Real S) |
48 | { |
49 | loc.Scale(P, S); |
50 | if (S < 0.0) vdir.Reverse(); |
51 | } |
52 | |
53 | void gp_Ax2d::Mirror (const gp_Pnt2d& P) |
54 | { |
55 | loc.Mirror(P); |
56 | vdir.Reverse(); |
57 | } |
58 | |
59 | gp_Ax2d gp_Ax2d::Mirrored (const gp_Pnt2d& P) const |
60 | { |
61 | gp_Ax2d A = *this; |
62 | A.Mirror (P); |
63 | return A; |
64 | } |
65 | |
66 | void gp_Ax2d::Mirror (const gp_Ax2d& A) |
67 | { |
68 | loc.Mirror (A); |
69 | vdir.Mirror (A.vdir); |
70 | } |
71 | |
72 | gp_Ax2d gp_Ax2d::Mirrored (const gp_Ax2d& A) const |
73 | { |
74 | gp_Ax2d AA = *this; |
75 | AA.Mirror (A); |
76 | return AA; |
77 | } |
78 | |
bc73b006 |
79 | void gp_Ax2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const |
80 | { |
81 | OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2d) |
82 | |
83 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc) |
84 | OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir) |
85 | } |