// Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. // JCV 30/08/90 Modif passage version C++ 2.0 sur Sun inline gp_Lin::gp_Lin () { } inline gp_Lin::gp_Lin (const gp_Ax1& A1) : pos (A1) { } inline gp_Lin::gp_Lin (const gp_Pnt& P, const gp_Dir& V) : pos (P, V) { } inline void gp_Lin::Reverse() { pos.Reverse(); } inline gp_Lin gp_Lin::Reversed() const { gp_Lin L = *this; L.pos.Reverse(); return L; } inline void gp_Lin::SetDirection (const gp_Dir& V) { pos.SetDirection(V); } inline void gp_Lin::SetLocation (const gp_Pnt& P) { pos.SetLocation(P); } inline void gp_Lin::SetPosition (const gp_Ax1& A1) { pos = A1; } inline const gp_Dir& gp_Lin::Direction() const { return pos.Direction(); } inline const gp_Pnt& gp_Lin::Location() const { return pos.Location(); } inline const gp_Ax1& gp_Lin::Position() const { return pos; } inline Standard_Real gp_Lin::Angle (const gp_Lin& Other) const { return pos.Direction().Angle (Other.pos.Direction()); } inline Standard_Boolean gp_Lin::Contains (const gp_Pnt& P, const Standard_Real LinearTolerance) const { return Distance(P) <= LinearTolerance; } inline Standard_Real gp_Lin::Distance (const gp_Pnt& P) const { gp_XYZ Coord = P.XYZ(); Coord.Subtract ((pos.Location()).XYZ()); Coord.Cross ((pos.Direction()).XYZ()); return Coord.Modulus(); } inline Standard_Real gp_Lin::SquareDistance (const gp_Pnt& P) const { const gp_Pnt& Loc = pos.Location(); gp_Vec V (P.X() - Loc.X(), P.Y() - Loc.Y(), P.Z() - Loc.Z()); V.Cross (pos.Direction()); return V.SquareMagnitude (); } inline Standard_Real gp_Lin::SquareDistance (const gp_Lin& Other) const { Standard_Real D = Distance (Other); return D * D; } inline gp_Lin gp_Lin::Normal (const gp_Pnt& P) const { const gp_Pnt& Loc = pos.Location(); gp_Dir V (P.X() - Loc.X(), P.Y() - Loc.Y(), P.Z() - Loc.Z()); V = pos.Direction().CrossCrossed(V, pos.Direction()); return gp_Lin (P, V); } inline void gp_Lin::Rotate (const gp_Ax1& A1, const Standard_Real Ang) { pos.Rotate(A1, Ang); } inline gp_Lin gp_Lin::Rotated (const gp_Ax1& A1, const Standard_Real Ang) const { gp_Lin L = *this; L.pos.Rotate (A1, Ang); return L; } inline void gp_Lin::Scale (const gp_Pnt& P, const Standard_Real S) { pos.Scale(P, S); } inline gp_Lin gp_Lin::Scaled (const gp_Pnt& P, const Standard_Real S) const { gp_Lin L = *this; L.pos.Scale (P, S); return L; } inline void gp_Lin::Transform (const gp_Trsf& T) { pos.Transform(T); } inline gp_Lin gp_Lin::Transformed (const gp_Trsf& T) const { gp_Lin L = *this; L.pos.Transform (T); return L; } inline void gp_Lin::Translate (const gp_Vec& V) { pos.Translate(V); } inline gp_Lin gp_Lin::Translated (const gp_Vec& V) const { gp_Lin L = *this; L.pos.Translate (V); return L; } inline void gp_Lin::Translate (const gp_Pnt& P1, const gp_Pnt& P2) {pos.Translate (P1, P2);} inline gp_Lin gp_Lin::Translated (const gp_Pnt& P1, const gp_Pnt& P2) const { gp_Lin L = *this; L.pos.Translate (gp_Vec(P1, P2)); return L; }