1 // Created on: 1992-09-02
2 // Created by: Remi GILET
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <gce_MakeDir2d.hxx>
20 #include <gp_Dir2d.hxx>
21 #include <gp_Pnt2d.hxx>
22 #include <gp_Vec2d.hxx>
24 #include <StdFail_NotDone.hxx>
26 //=========================================================================
27 // Creation d une direction 2d (Dir2d) de gp a partir de 2 Pnt2d de gp. +
28 //=========================================================================
29 gce_MakeDir2d::gce_MakeDir2d(const gp_Pnt2d& P1,
32 if (P1.Distance(P2) <= gp::Resolution()) { TheError = gce_ConfusedPoints; }
34 TheDir2d = gp_Dir2d(P2.XY()-P1.XY());
39 gce_MakeDir2d::gce_MakeDir2d(const gp_XY& Coord)
41 if (Coord.Modulus() <= gp::Resolution()) { TheError = gce_NullVector; }
43 TheDir2d = gp_Dir2d(Coord);
48 gce_MakeDir2d::gce_MakeDir2d(const gp_Vec2d& V)
50 if (V.Magnitude() <= gp::Resolution()) { TheError = gce_NullVector; }
52 TheDir2d = gp_Dir2d(V);
57 gce_MakeDir2d::gce_MakeDir2d(const Standard_Real Xv,
58 const Standard_Real Yv)
60 if (Xv*Xv+Yv*Yv <= gp::Resolution()) { TheError = gce_NullVector; }
62 TheDir2d = gp_Dir2d(Xv,Yv);
67 const gp_Dir2d& gce_MakeDir2d::Value() const
69 StdFail_NotDone_Raise_if(TheError != gce_Done,"");
73 const gp_Dir2d& gce_MakeDir2d::Operator() const
78 gce_MakeDir2d::operator gp_Dir2d() const