1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 \*---------------------------------------------------------------------------*/
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of classes
54 // Forward declaration of friend functions and operators
56 template<class Point, class PointRef> class line;
58 template<class Point, class PointRef>
59 inline Istream& operator>>(Istream&, line<Point, PointRef>&);
61 template<class Point, class PointRef>
62 inline Ostream& operator<<(Ostream&, const line<Point, PointRef>&);
65 /*---------------------------------------------------------------------------*\
66 Class line Declaration
67 \*---------------------------------------------------------------------------*/
69 template<class Point, class PointRef>
81 //- Construct from two points
82 inline line(const Point& start, const Point& end);
84 //- Construct from Istream
85 inline line(Istream&);
92 //- Return first vertex
93 inline PointRef start() const;
95 //- Return second vertex
96 inline PointRef end() const;
101 //- Return centre (centroid)
102 inline Point centre() const;
104 //- Return scalar magnitude
105 inline scalar mag() const;
107 //- Return start-end vector
108 inline Point vec() const;
110 //- Return nearest distance to line from a given point
111 // If the nearest point is on the line, return a hit
112 PointHit<Point> nearestDist(const Point& p) const;
114 //- Return nearest distance from line to line. Returns distance
115 // and sets both points (one on *this, one on the provided
119 const line<Point, const Point&>& edge,
127 friend Istream& operator>> <Point, PointRef>
133 friend Ostream& operator<< <Point, PointRef>
141 //- 2D specialisation
143 scalar line<point2D, const point2D&>::nearestDist
145 const line<point2D, const point2D&>& edge,
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 } // End namespace Foam
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 // ************************************************************************* //