vgl_conic_segment_2d.hxx
Go to the documentation of this file.
1 // This is core/vgl/vgl_conic_segment_2d.hxx
2 #ifndef vgl_conic_segment_2d_hxx_
3 #define vgl_conic_segment_2d_hxx_
4 
5 #include <iostream>
6 #include "vgl_conic_segment_2d.h"
7 #ifdef _MSC_VER
8 # include <vcl_msvc_warnings.h>
9 #endif
10 
11 // stream operators
12 template <class Type>
13 std::ostream& operator<<(std::ostream& s, vgl_conic_segment_2d<Type> const & p)
14 {
15  return s << "<vgl_conic_segment_2d " << p.point1() << " to " << p.point2() << "with " << p.conic()
16  << (p.is_clockwise() ? ", clockwise" : ", counterclockwise") << " >";
17 }
18 
19 template <class Type>
20 std::istream& operator>>(std::istream& s, vgl_conic_segment_2d<Type>& p)
21 {
22  vgl_point_2d<Type> p1, p2;
23  s >> p1 >> p2;
24  vgl_conic<Type> conic;
25  s >> conic;
26  p.set(p1, p2, conic, true);
27  return s;
28 }
29 
30 #undef VGL_CONIC_SEGMENT_2D_INSTANTIATE
31 #define VGL_CONIC_SEGMENT_2D_INSTANTIATE(Type) \
32 template class vgl_conic_segment_2d<Type >;\
33 template std::istream& operator>>(std::istream&, vgl_conic_segment_2d<Type >&);\
34 template std::ostream& operator<<(std::ostream&, vgl_conic_segment_2d<Type > const&)
35 
36 #endif // vgl_conic_segment_2d_hxx_
vgl_homg_point_2d< Type > point2() const
The second end-point of the conic segment.
vgl_homg_point_2d< Type > point1() const
The first end-point of the conic segment.
vgl_conic< Type > conic() const
The conic underlying the segment.
bool is_clockwise() const
The direction of the segment (clockwise or counterclockwise).
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
Represents a 2D conic segment using two points.
void set(vgl_homg_point_2d< Type > const &p1, vgl_homg_point_2d< Type > const &p2, vgl_conic< Type > co, bool counterclockwise=true)
(Re)initialise the conic segment by passing it its three "constructors".
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
Represents a cartesian 2D point.
Definition: vgl_area.h:7
A curve segment with the geometry of a conic.