VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Gr::LineDrawImp< T > Class Template Reference

A low-level line-drawing class used in the implementation of Gr::LineDraw. More...

#include <grlinedraw.h>

Public Member Functions

 LineDrawImp (T x1, T y1, T x2, T y2)
 Constructor.
 
n () const
 Returns the iteration count.
 
bool nextPoint ()
 Steps to the next point for point-wise iteration. More...
 
x () const
 Returns the current x coordinate for point-wise iteration.
 
y () const
 Returns the current y coordinate for point-wise iteration.
 
bool flat () const
 Returns true if the x dimension of the line is greater the the y dimension. More...
 

Detailed Description

template<typename T>
class Gr::LineDrawImp< T >

A low-level line-drawing class used in the implementation of Gr::LineDraw.

The client code iterates over the points in the longest of the two dimensions, without having to know which dimension is the longest or which direction they are going.

Usage:

Gr::LineDrawImp<int> line( x1 , y1 , x2 , y2 ) ;
plot( line.x() , line.y() ) ;
for( int i = 0 ; i < line.n() ; i++ )
{
line.nextPoint() ;
plot( line.x() , line.y() ) ;
}

Definition at line 29 of file grlinedraw.h.

Member Function Documentation

template<typename T >
bool Gr::LineDrawImp< T >::flat ( ) const

Returns true if the x dimension of the line is greater the the y dimension.

Definition at line 192 of file grlinedraw.h.

template<typename T >
bool Gr::LineDrawImp< T >::nextPoint ( )

Steps to the next point for point-wise iteration.

Returns false if (x(),y()) is now off the end.

Definition at line 176 of file grlinedraw.h.


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