1 // Copyright (c) 1995-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
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
19 #define No_Standard_OutOfRange
22 #include <gp_Ax2d.hxx>
23 #include <gp_Dir2d.hxx>
24 #include <gp_Pnt2d.hxx>
25 #include <gp_Trsf2d.hxx>
26 #include <gp_Vec2d.hxx>
28 #include <Standard_Dump.hxx>
30 Standard_Boolean gp_Ax2d::IsCoaxial (const gp_Ax2d& Other,
31 const Standard_Real AngularTolerance,
32 const Standard_Real LinearTolerance) const
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);
46 void gp_Ax2d::Scale (const gp_Pnt2d& P,
47 const Standard_Real S)
50 if (S < 0.0) vdir.Reverse();
53 void gp_Ax2d::Mirror (const gp_Pnt2d& P)
59 gp_Ax2d gp_Ax2d::Mirrored (const gp_Pnt2d& P) const
66 void gp_Ax2d::Mirror (const gp_Ax2d& A)
72 gp_Ax2d gp_Ax2d::Mirrored (const gp_Ax2d& A) const
79 void gp_Ax2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
81 OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2d)
83 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc)
84 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir)