Skip to content
Snippets Groups Projects
scannerprovider.h 4.14 KiB
Newer Older
even's avatar
even committed
#ifndef SCANNER_PROVIDER_H
#define SCANNER_PROVIDER_H

#include <cstdlib>
#include "directionalscanner.h"

using namespace std;



/** 
 * @class ScannerProvider scannerprovider.h
 * \brief Directional scanner provider.
 * Provides ad-hoc directional scanners in the relevant octant
 *   and according to static or dynamical needs.
 * \author {P. Even}
 */
class ScannerProvider
{

public:

  /**
   * @fn ScannerProvider()
   * \brief Builds a directional scanner provider.
   */
  ScannerProvider () : isOrtho (false) { }
  
  /**
   * @fn getScanner(Pt2i p1, Pt2i p2,
   *                int xmin, int xmax, int ymin, int ymax)
   * \brief Returns an incremental directional scanner.
   * Returns a directional scanner from two control points.
   * The scan strip is composed of parallel scan lines, the first one being
   *   defined by control points p1 and p2.
   * @param p1 Start control point.
   * @param p2 End control point.
   * @param xmin Left border of the scan area.
   * @param xmax Right border of the scan area.
   * @param ymin Low border of the scan area.
   * @param ymax Up border of the scan area.
   */
  DirectionalScanner *getScanner (Pt2i p1, Pt2i p2,
                                  int xmin, int xmax, int ymin, int ymax);
  
  /**
   * @fn getScanner(Pt2i p1, Pt2i p2, Pt2i v1, Pt2i v2,
   *                int xmin, int ymin, nt xmax, int ymax)
   * \brief Returns an incremental directional scanner.
   * Returns a directional scanner from two points and direction v1 -> v2.
   * The scan strip is composed of parallel scan lines, centered on the middle
   *   of (p1,p2) and aligned on (v1,v2).
   * @param p1 start control point
   * @param p2 end control point
   * @param v1 direction start point
   * @param v2 direction end point
   * @param xmin left border of the scan area
   * @param xmax right border of the scan area
   * @param ymin low border of the scan area
   * @param ymax up border of the scan area
   */
  DirectionalScanner *getScanner (Pt2i p1, Pt2i p2,
                                  Pt2i v1, Pt2i v2,
                                  int xmin, int ymin, int xmax, int ymax);

  /**
   * @fn getScanner(Pt2i centre, Vr2i normal, int length,
   *                int xmin, int ymin, nt xmax, int ymax)
   * \brief Returns an incremental directional scanner.
   * Returns a directional scanner from two points and direction v1 -> v2.
   * The scan strip is composed of parallel scan lines, centered on the middle
   *   of (p1,p2) and aligned on (v1,v2).
   * @param centre central point
   * @param normal scan strip normal vector
   * @param length length of a scan line
   * @param xmin left border of the scan area
   * @param xmax right border of the scan area
   * @param ymin low border of the scan area
   * @param ymax up border of the scan area
   */
  DirectionalScanner *getScanner (Pt2i centre, Vr2i normal, int length,
                                  int xmin, int ymin, int xmax, int ymax);

  /**
   * @fn getScanner(Pt2i centre, Vr2i normal, int length, bool controlable,
   *                int xmin, int ymin, nt xmax, int ymax)
   * \brief Returns an incremental directional scanner.
   * Returns a directional scanner from two points and direction v1 -> v2.
   * The scan strip is composed of parallel scan lines, centered on the middle
   *   of (p1,p2) and aligned on (v1,v2).
   * @param centre central point
   * @param normal scan strip normal vector
even's avatar
even committed
   * @param length length of a scan line
even's avatar
even committed
   * @param controlable controlability request (true for a dynamical scanner)
   * @param xmin left border of the scan area
   * @param xmax right border of the scan area
   * @param ymin low border of the scan area
   * @param ymax up border of the scan area
   */
  DirectionalScanner *getScanner (Pt2i centre, Vr2i normal,
                                  int length, bool controlable,
                                  int xmin, int ymin, int xmax, int ymax);

  /**
   * @fn setOrtho(bool status)
   * \brief Sets the orthogonal scanner modality.
   * @param status new status for the orthogonal scanner modality.
   */
  inline void setOrtho (bool status) { isOrtho = status; }


private:

  /** Orthogonal scanner modality. */
  bool isOrtho;
};

#endif