Public Member Functions | Private Attributes | List of all members
vgl_oriented_box_2d< T > Class Template Reference

#include <vgl_area.h>

Public Member Functions

 vgl_oriented_box_2d ()
 default constructor. More...
 
 vgl_oriented_box_2d (T width, T height, vgl_point_2d< T > const &center, T angle_in_rad)
 construct from center, width (major axis), height and orientedation with respect to x-axis. More...
 
 vgl_oriented_box_2d (vgl_point_2d< T > const &maj_p1, vgl_point_2d< T > const &maj_p2, T height)
 construct from major axis and height. More...
 
 vgl_oriented_box_2d (vgl_line_segment_2d< T > const &maj, T height)
 
 vgl_oriented_box_2d (vgl_point_2d< T > const &maj_p1, vgl_point_2d< T > const &maj_p2, vgl_point_2d< T > const &min_p1, vgl_point_2d< T > const &min_p2)
 the minor axis line need not be orthogonal to the major axis, and. More...
 
 vgl_oriented_box_2d (vgl_line_segment_2d< T > const &maj, vgl_line_segment_2d< T > const &min)
 
 vgl_oriented_box_2d (const vgl_box_2d< T > &box)
 construct from an axis aligned box. More...
 
 vgl_oriented_box_2d (const vgl_box_2d< T > &box, T angle_in_rad)
 construct from an axis aligned box with orientedation. More...
 
 vgl_oriented_box_2d (vgl_point_2d< T > const &p0, vgl_point_2d< T > const &p1, vgl_point_2d< T > const &p2)
 constructor from three corner points. More...
 
vgl_line_segment_2d< T > major_axis () const
 major axis. More...
 
vgl_point_2d< T > centroid () const
 center (midpoint of major axis). More...
 
std::pair< T, T > width_height () const
 return width (first) and height (second). More...
 
width () const
 width - length of major axis. More...
 
height () const
 height - length of minor axis. More...
 
aspect_ratio () const
 aspsect ratio width/height. More...
 
angle_in_rad () const
 : orientedation of major axis on the range +- pi (as returned by atan2). More...
 
bool operator== (vgl_oriented_box_2d< T > const &ob) const
 
bool near_equal (vgl_oriented_box_2d< T > const &ob, T tol=vgl_tolerance< T >::position) const
 
bool contains (T const &x, T const &y) const
 Return true if (x,y) is inside this box. More...
 
bool contains (vgl_point_2d< T > const &p) const
 Return true if point is inside this box. More...
 
void set (vgl_line_segment_2d< T > const &major, T half_height)
 
vgl_box_2d< T > enclosing_box () const
 axis-aligned bounding box for *this. More...
 
std::vector< vgl_point_2d< T > > corners () const
 corners of the orienteded rectangle. More...
 
vgl_polygon< T > obox_boundary () const
 polygon corresponding to obox boundary. More...
 
vgl_point_2d< T > transform_to_obox (vgl_point_2d< T > const &p) const
 map a point to the (u, v) coordinate system of the orienteded box. More...
 
vgl_oriented_box_2d< T > rotate (vgl_point_2d< T > const &rot_center, T angle_rad) const
 rotate by angle in radians. More...
 
vgl_oriented_box_2d< T > translate (T tx, T ty) const
 translate by displacement (tx, ty). More...
 

Private Attributes

vgl_line_segment_2d< T > major_axis_
 
half_height_
 

Detailed Description

template<class T>
class vgl_oriented_box_2d< T >

Definition at line 9 of file vgl_area.h.

Constructor & Destructor Documentation

◆ vgl_oriented_box_2d() [1/9]

template<class T>
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( )
inline

default constructor.

Definition at line 23 of file vgl_oriented_box_2d.h.

◆ vgl_oriented_box_2d() [2/9]

template<class T >
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( width,
height,
vgl_point_2d< T > const &  center,
angle_in_rad 
)

construct from center, width (major axis), height and orientedation with respect to x-axis.

rotation is around the center point. width must be greater than height!!

Definition at line 12 of file vgl_oriented_box_2d.hxx.

◆ vgl_oriented_box_2d() [3/9]

template<class T>
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( vgl_point_2d< T > const &  maj_p1,
vgl_point_2d< T > const &  maj_p2,
height 
)
inline

construct from major axis and height.

the center is the midpoint of the major axis

Definition at line 31 of file vgl_oriented_box_2d.h.

◆ vgl_oriented_box_2d() [4/9]

template<class T>
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( vgl_line_segment_2d< T > const &  maj,
height 
)
inline

Definition at line 34 of file vgl_oriented_box_2d.h.

◆ vgl_oriented_box_2d() [5/9]

template<class T >
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( vgl_point_2d< T > const &  maj_p1,
vgl_point_2d< T > const &  maj_p2,
vgl_point_2d< T > const &  min_p1,
vgl_point_2d< T > const &  min_p2 
)

the minor axis line need not be orthogonal to the major axis, and.

the major axis passes through the midpoint of the minor line segment box height is defined by the projection of the minor line segment onto the perpendicular to the major axis

Definition at line 72 of file vgl_oriented_box_2d.hxx.

◆ vgl_oriented_box_2d() [6/9]

template<class T>
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( vgl_line_segment_2d< T > const &  maj,
vgl_line_segment_2d< T > const &  min 
)
inline

Definition at line 42 of file vgl_oriented_box_2d.h.

◆ vgl_oriented_box_2d() [7/9]

template<class T >
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( const vgl_box_2d< T > &  box)

construct from an axis aligned box.

Definition at line 35 of file vgl_oriented_box_2d.hxx.

◆ vgl_oriented_box_2d() [8/9]

template<class T >
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( const vgl_box_2d< T > &  box,
angle_in_rad 
)

construct from an axis aligned box with orientedation.

the major axis of the box is rotated by angle_in_rad around the centroid

Definition at line 40 of file vgl_oriented_box_2d.hxx.

◆ vgl_oriented_box_2d() [9/9]

template<class T >
vgl_oriented_box_2d< T >::vgl_oriented_box_2d ( vgl_point_2d< T > const &  p0,
vgl_point_2d< T > const &  p1,
vgl_point_2d< T > const &  p2 
)

constructor from three corner points.

The two directions from p0 to the two other points must be mutually orthogonal, i.e., a local box coordinate frame centered on p0

Definition at line 53 of file vgl_oriented_box_2d.hxx.

Member Function Documentation

◆ angle_in_rad()

template<class T >
T vgl_oriented_box_2d< T >::angle_in_rad ( ) const

: orientedation of major axis on the range +- pi (as returned by atan2).

Definition at line 197 of file vgl_oriented_box_2d.hxx.

◆ aspect_ratio()

template<class T>
T vgl_oriented_box_2d< T >::aspect_ratio ( ) const
inline

aspsect ratio width/height.

Definition at line 74 of file vgl_oriented_box_2d.h.

◆ centroid()

template<class T >
vgl_point_2d< T > vgl_oriented_box_2d< T >::centroid ( ) const

center (midpoint of major axis).

Definition at line 128 of file vgl_oriented_box_2d.hxx.

◆ contains() [1/2]

template<class T>
bool vgl_oriented_box_2d< T >::contains ( T const &  x,
T const &  y 
) const
inline

Return true if (x,y) is inside this box.

Definition at line 85 of file vgl_oriented_box_2d.h.

◆ contains() [2/2]

template<class T >
bool vgl_oriented_box_2d< T >::contains ( vgl_point_2d< T > const &  p) const

Return true if point is inside this box.

Definition at line 163 of file vgl_oriented_box_2d.hxx.

◆ corners()

template<class T >
std::vector< vgl_point_2d< T > > vgl_oriented_box_2d< T >::corners ( ) const

corners of the orienteded rectangle.

Definition at line 109 of file vgl_oriented_box_2d.hxx.

◆ enclosing_box()

template<class T >
vgl_box_2d< T > vgl_oriented_box_2d< T >::enclosing_box ( ) const

axis-aligned bounding box for *this.

Definition at line 92 of file vgl_oriented_box_2d.hxx.

◆ height()

template<class T>
T vgl_oriented_box_2d< T >::height ( ) const
inline

height - length of minor axis.

Definition at line 71 of file vgl_oriented_box_2d.h.

◆ major_axis()

template<class T>
vgl_line_segment_2d<T> vgl_oriented_box_2d< T >::major_axis ( ) const
inline

major axis.

Definition at line 59 of file vgl_oriented_box_2d.h.

◆ near_equal()

template<class T >
bool vgl_oriented_box_2d< T >::near_equal ( vgl_oriented_box_2d< T > const &  ob,
tol = vgl_tolerance<T>::position 
) const

Definition at line 175 of file vgl_oriented_box_2d.hxx.

◆ obox_boundary()

template<class T>
vgl_polygon<T> vgl_oriented_box_2d< T >::obox_boundary ( ) const
inline

polygon corresponding to obox boundary.

Definition at line 103 of file vgl_oriented_box_2d.h.

◆ operator==()

template<class T>
bool vgl_oriented_box_2d< T >::operator== ( vgl_oriented_box_2d< T > const &  ob) const
inline

Definition at line 79 of file vgl_oriented_box_2d.h.

◆ rotate()

template<class T >
vgl_oriented_box_2d< T > vgl_oriented_box_2d< T >::rotate ( vgl_point_2d< T > const &  rot_center,
angle_rad 
) const

rotate by angle in radians.

Definition at line 215 of file vgl_oriented_box_2d.hxx.

◆ set()

template<class T>
void vgl_oriented_box_2d< T >::set ( vgl_line_segment_2d< T > const &  major,
half_height 
)
inline

Definition at line 91 of file vgl_oriented_box_2d.h.

◆ transform_to_obox()

template<class T >
vgl_point_2d< T > vgl_oriented_box_2d< T >::transform_to_obox ( vgl_point_2d< T > const &  p) const

map a point to the (u, v) coordinate system of the orienteded box.

Definition at line 151 of file vgl_oriented_box_2d.hxx.

◆ translate()

template<class T >
vgl_oriented_box_2d< T > vgl_oriented_box_2d< T >::translate ( tx,
ty 
) const

translate by displacement (tx, ty).

Definition at line 223 of file vgl_oriented_box_2d.hxx.

◆ width()

template<class T>
T vgl_oriented_box_2d< T >::width ( ) const
inline

width - length of major axis.

Definition at line 68 of file vgl_oriented_box_2d.h.

◆ width_height()

template<class T >
std::pair< T, T > vgl_oriented_box_2d< T >::width_height ( ) const

return width (first) and height (second).

Definition at line 101 of file vgl_oriented_box_2d.hxx.

Member Data Documentation

◆ half_height_

template<class T>
T vgl_oriented_box_2d< T >::half_height_
private

Definition at line 117 of file vgl_oriented_box_2d.h.

◆ major_axis_

template<class T>
vgl_line_segment_2d<T> vgl_oriented_box_2d< T >::major_axis_
private

Definition at line 116 of file vgl_oriented_box_2d.h.


The documentation for this class was generated from the following files: