Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
meshes
primitiveShapes
line
line.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
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
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
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
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::line
26
27
Description
28
A line primitive.
29
30
SourceFiles
31
lineI.H
32
33
\*---------------------------------------------------------------------------*/
34
35
#ifndef line_H
36
#define line_H
37
38
#include <
OpenFOAM/vector.H
>
39
#include <
OpenFOAM/PointHit_.H
>
40
#include <
OpenFOAM/point2D.H
>
41
42
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44
namespace
Foam
45
{
46
47
// Forward declaration of classes
48
49
class
Istream;
50
class
Ostream;
51
52
53
// Forward declaration of friend functions and operators
54
55
template
<
class
Po
int
,
class
Po
int
Ref>
class
line;
56
57
template
<
class
Po
int
,
class
Po
int
Ref>
58
inline
Istream&
operator>>
(Istream&, line<Point, PointRef>&);
59
60
template
<
class
Po
int
,
class
Po
int
Ref>
61
inline
Ostream& operator<<(Ostream&, const line<Point, PointRef>&);
62
63
64
/*---------------------------------------------------------------------------*\
65
Class line Declaration
66
\*---------------------------------------------------------------------------*/
67
68
template
<
class
Po
int
,
class
Po
int
Ref>
69
class
line
70
{
71
// Private data
72
73
PointRef a_, b_;
74
75
76
public
:
77
78
// Constructors
79
80
//- Construct from two points
81
inline
line
(
const
Point&
start
,
const
Point&
end
);
82
83
//- Construct from Istream
84
inline
line
(
Istream
&);
85
86
87
// Member functions
88
89
// Access
90
91
//- Return first vertex
92
inline
PointRef
start
()
const
;
93
94
//- Return second vertex
95
inline
PointRef
end
()
const
;
96
97
98
// Properties
99
100
//- Return centre (centroid)
101
inline
Point
centre
()
const
;
102
103
//- Return scalar magnitude
104
inline
scalar
mag
()
const
;
105
106
//- Return start-end vector
107
inline
Point
vec
()
const
;
108
109
//- Return nearest distance to line from a given point
110
// If the nearest point is on the line, return a hit
111
PointHit<Point>
nearestDist
(
const
Point&
p
)
const
;
112
113
//- Return nearest distance from line to line. Returns distance
114
// and sets both points (one on *this, one on the provided
115
// linePointRef.
116
scalar
nearestDist
117
(
118
const
line<Point, const Point&>
&
edge
,
119
Point& thisPoint,
120
Point& edgePoint
121
)
const
;
122
123
124
// Ostream operator
125
126
friend
Istream
&
operator
>> <Point, PointRef>
127
(
128
Istream
&,
129
line
&
130
);
131
132
friend
Ostream
& operator<< <Point, PointRef>
133
(
134
Ostream
&,
135
const
line
&
136
);
137
};
138
139
140
//- 2D specialisation
141
template
<>
142
scalar
line<point2D, const point2D&>::nearestDist
143
(
144
const
line<point2D, const point2D&>
&
edge
,
145
point2D
& thisPoint,
146
point2D
& edgePoint
147
)
const
;
148
149
150
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152
}
// End namespace Foam
153
154
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156
#include <
OpenFOAM/lineI.H
>
157
158
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160
#endif
161
162
// ************************ vim: set sw=4 sts=4 et: ************************ //