0024023: Revamp the OCCT Handle -- ambiguity
[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
19#include <gp_Lin.ixx>
20
21Standard_Real gp_Lin::Distance (const gp_Lin& Other) const
22{
23 if (pos.IsParallel (Other.pos, gp::Resolution())) {
24 return Other.Distance(pos.Location());
25 }
26 else {
27 gp_Dir dir(pos.Direction().Crossed(Other.pos.Direction()));
28 Standard_Real D = gp_Vec (pos.Location(),Other.pos.Location())
29 .Dot(gp_Vec(dir));
30 if (D < 0) D = - D;
31 return D;
32 }
33}
34
35void gp_Lin::Mirror (const gp_Pnt& P)
36{ pos.Mirror(P); }
37
38gp_Lin gp_Lin::Mirrored (const gp_Pnt& P) const
39{
40 gp_Lin L = *this;
41 L.pos.Mirror (P);
42 return L;
43}
44
45void gp_Lin::Mirror (const gp_Ax1& A1)
46{ pos.Mirror(A1); }
47
48gp_Lin gp_Lin::Mirrored (const gp_Ax1& A1) const
49{
50 gp_Lin L = *this;
51 L.pos.Mirror (A1);
52 return L;
53}
54
55void gp_Lin::Mirror (const gp_Ax2& A2)
56{ pos.Mirror(A2); }
57
58gp_Lin gp_Lin::Mirrored (const gp_Ax2& A2) const
59{
60 gp_Lin L = *this;
61 L.pos.Mirror (A2);
62 return L;
63}
64