0032137: Coding Rules - merge redundant .lxx files into header files within Package gp
[occt.git] / src / gp / gp_Lin.cxx
CommitLineData
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 30/08/90 Modif passage version C++ 2.0 sur Sun
16// JCV 1/10/90 Changement de nom du package vgeom -> gp
17// JCV 12/12/90 modifs suite a la premiere revue de projet
18
d5477f8c 19#include <gp_Lin.hxx>
20
42cf5bc1 21#include <gp_Ax1.hxx>
22#include <gp_Ax2.hxx>
23#include <gp_Dir.hxx>
42cf5bc1 24#include <gp_Pnt.hxx>
25#include <gp_Trsf.hxx>
26#include <gp_Vec.hxx>
27#include <Standard_ConstructionError.hxx>
7fd59977 28
29Standard_Real gp_Lin::Distance (const gp_Lin& Other) const
30{
31 if (pos.IsParallel (Other.pos, gp::Resolution())) {
32 return Other.Distance(pos.Location());
33 }
34 else {
35 gp_Dir dir(pos.Direction().Crossed(Other.pos.Direction()));
36 Standard_Real D = gp_Vec (pos.Location(),Other.pos.Location())
37 .Dot(gp_Vec(dir));
38 if (D < 0) D = - D;
39 return D;
40 }
41}
42
43void gp_Lin::Mirror (const gp_Pnt& P)
44{ pos.Mirror(P); }
45
46gp_Lin gp_Lin::Mirrored (const gp_Pnt& P) const
47{
48 gp_Lin L = *this;
49 L.pos.Mirror (P);
50 return L;
51}
52
53void gp_Lin::Mirror (const gp_Ax1& A1)
54{ pos.Mirror(A1); }
55
56gp_Lin gp_Lin::Mirrored (const gp_Ax1& A1) const
57{
58 gp_Lin L = *this;
59 L.pos.Mirror (A1);
60 return L;
61}
62
63void gp_Lin::Mirror (const gp_Ax2& A2)
64{ pos.Mirror(A2); }
65
66gp_Lin gp_Lin::Mirrored (const gp_Ax2& A2) const
67{
68 gp_Lin L = *this;
69 L.pos.Mirror (A2);
70 return L;
71}
72