Loading...
Searching...
No Matches
casacore::PixelCurve1D Class Reference
lattices package (libcasa_lattices) » Lattices_module

More...

`#include <PixelCurve1D.h>`

## Public Member Functions

| PixelCurve1D (double x1=0, double y1=0, double x2=1, double y2=1, uInt npoints=0)
| Define a straight line from (x1,y1) to (x2,y2).
| PixelCurve1D (const Function1D< float, float > &, float x1, float x2, uInt npoints=0)
| Define a curve with an arbitrary function from x1 to x2.
| PixelCurve1D (const Vector< Int > &x, const Vector< Int > &y, uInt npoints=0)
| Define a curve from a polyline with the given points.
| PixelCurve1D (const Vector< float > &x, const Vector< float > &y, uInt npoints=0)
| PixelCurve1D (const Vector< double > &x, const Vector< double > &y, uInt npoints=0)
| PixelCurve1D (const PixelCurve1D &that)
| ~PixelCurve1D ()
PixelCurve1D & | operator= (const PixelCurve1D &that)
uInt | npoints () const
void | getPixelCoord (Vector< float > &x, Vector< float > &y, uInt start, uInt end, uInt incr=1) const
| Get the pixel coordinates in the original lattice for point start till end with given step.

## Private Member Functions

void | init (const Vector< double > &x, const Vector< double > &y, uInt npoints)
| Initialize the object.

## Private Attributes

uInt | itsNpoints
Vector< double > | itsX
Vector< double > | itsY

## Detailed Description

Arbitrary 1-dim curve in a lattice plane.

### Intended use:

Public interface

### Review Status

Test programs:
  tPixelCurve1D

### Prerequisite

- Function1D
- CurvedLattice2D

### Synopsis

PixelCurve1D represents a 1-dim curve in a lattice plane to be used by CurvedLattice2D. The curve can be any function supported in the Functionals module.
A special constructor exists to define a straight line.
Another special constructor exists for a polyline.

The domain for which the curve is valid is given by the interval [x1,x2]. The granularity of the domain is given by the number of points. The number of points also define the length of the new axis in the CurvedLattice2D object.

### Example

// Use function y=cos(2*pi*x) on the interval [0,2] with 5 points.
Sinusoid1D<float> fn;
PixelCurve1D pcurve2(fn, 0., 2., 5);
AlwaysAssertExit (pcurve2.npoints() == 5);
pcurve2.getPixelCoord (x, y, 0, 4);
cout << x << y << endl;
AlwaysAssertExit
#define AlwaysAssertExit(expr)
Definition Assert.h:136
casacore::PixelCurve1D::PixelCurve1D
PixelCurve1D(double x1=0, double y1=0, double x2=1, double y2=1, uInt npoints=0)
Define a straight line from (x1,y1) to (x2,y2).
casacore::Sinusoid1D
Definition Sinusoid1D.h:113

The result of x is [0, 0.5, 1, 1.5, 2]. The result of y is [1, -1, 1, -1, 1]

### Motivation

The viewer must be able to show a crosscut through an image using an arbitrary curve.

### To Do

- Maybe it is better to make itsNpoints part of CurvedLattice
- If itsNpoint is still part of this class, it is possible to precompute all possible Y values in the constructors. This may speed things up for the polyline case.

Definition at line 94 of file PixelCurve1D.h.

## Constructor & Destructor Documentation

## PixelCurve1D() [1/6]

casacore::PixelCurve1D::PixelCurve1D | ( | double | x1 = 0,
|  | double | y1 = 0,
|  | double | x2 = 1,
|  | double | y2 = 1,
|  | uInt | npoints = 0 )

explicit

Define a straight line from (x1,y1) to (x2,y2).

The default number of points is the length of the line.

References npoints().

Referenced by operator=(), and PixelCurve1D().

## PixelCurve1D() [2/6]

casacore::PixelCurve1D::PixelCurve1D | ( | const Function1D< float, float > & | ,
|  | float | x1,
|  | float | x2,
|  | uInt | npoints = 0 )

Define a curve with an arbitrary function from x1 to x2.

The default number of points is the length of the curve. The length of the curve is determined numerically by integration of sqrt(1+sqr(df/dx)).

References npoints().

## PixelCurve1D() [3/6]

casacore::PixelCurve1D::PixelCurve1D | ( | const Vector< Int > & | x,
|  | const Vector< Int > & | y,
|  | uInt | npoints = 0 )

Define a curve from a polyline with the given points.

Both vectors have to be equally long and at least 2 long. The argument npoints defines the number of points (with regular steps) in which the curve is divided. The default is the length of the polyline.

References npoints().

## PixelCurve1D() [4/6]

casacore::PixelCurve1D::PixelCurve1D | ( | const Vector< float > & | x,
|  | const Vector< float > & | y,
|  | uInt | npoints = 0 )

References npoints().

## PixelCurve1D() [5/6]

casacore::PixelCurve1D::PixelCurve1D | ( | const Vector< double > & | x,
|  | const Vector< double > & | y,
|  | uInt | npoints = 0 )

References npoints().

## PixelCurve1D() [6/6]

casacore::PixelCurve1D::PixelCurve1D | ( | const PixelCurve1D & | that | ) |

References PixelCurve1D().

## ~PixelCurve1D()

casacore::PixelCurve1D::~PixelCurve1D | ( |  | ) |

## Member Function Documentation

## getPixelCoord()

void casacore::PixelCurve1D::getPixelCoord | ( | Vector< float > & | x,
|  | Vector< float > & | y,
|  | uInt | start,
|  | uInt | end,
|  | uInt | incr = 1 ) const

Get the pixel coordinates in the original lattice for point start till end with given step.

References casacore::end().

## init()

void casacore::PixelCurve1D::init | ( | const Vector< double > & | x,
|  | const Vector< double > & | y,
|  | uInt | npoints )

private

Initialize the object.

References npoints().

## npoints()

uInt casacore::PixelCurve1D::npoints | ( |  | ) | const

inline

Definition at line 127 of file PixelCurve1D.h.

References itsNpoints.

Referenced by init(), PixelCurve1D(), PixelCurve1D(), PixelCurve1D(), PixelCurve1D(), and PixelCurve1D().

## operator=()

PixelCurve1D & casacore::PixelCurve1D::operator= | ( | const PixelCurve1D & | that | ) |

References PixelCurve1D().

## Member Data Documentation

## itsNpoints

uInt casacore::PixelCurve1D::itsNpoints

private

Definition at line 139 of file PixelCurve1D.h.

Referenced by npoints().

## itsX

Vector<double> casacore::PixelCurve1D::itsX

private

Definition at line 140 of file PixelCurve1D.h.

## itsY

Vector<double> casacore::PixelCurve1D::itsY

private

Definition at line 141 of file PixelCurve1D.h.

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

- lattices/Lattices/PixelCurve1D.h