Hermes
Loading...
Searching...
No Matches
segment.h
1
#ifndef HERMES_GEOMETRY_SEGMENT_H
2
#define HERMES_GEOMETRY_SEGMENT_H
3
4
#include <
hermes/geometry/point.h
>
5
6
namespace
hermes {
7
8
/* Line segment **ab**
9
*/
10
template
<
typename
T>
class
Segment
{
11
public
:
12
Segment
() {}
13
Segment
(
T
_a
,
T
_b
) : a(
_a
), b(
_b
) {}
14
virtual
~Segment
() {}
15
16
float
length()
const
{
return
(b - a).length(); }
17
18
float
length2()
const
{
return
(b - a).length2(); }
19
T
&operator[](
size_t
i) {
return
(i == 0) ? a : b; }
20
T
a, b;
21
};
22
23
typedef
Segment<point2>
Segment2
;
24
typedef
Segment<point3>
Segment3
;
25
26
}
// hermes namespace
27
28
#endif
// HERMES_GEOMETRY_SEGMENT_H
hermes::Segment
Definition
segment.h:10
point.h
Geometric point classes.
hermes::Index2
Holds 2-dimensional integer index coordinates.
Definition
index.h:50
hermes
geometry
segment.h
Generated by
1.9.8