Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

TxFunction Class Reference

#include <TxFunction.h>

List of all members.

Public Member Functions

 TxFunction (float x1, float y1, float x2, float y2)
void addControlPoint (GLfloat x, GLfloat y, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
void removeControlPoint (TxPoint *p)
void moveControlPoint (TxPoint *point, GLfloat x, GLfloat y)
TxPointhitTxPoint (GLfloat x, GLfloat y)
TxPointgetLastTxPoint ()
TxPointgetFirstTxPoint ()
void render ()
TxPointgetNearestNeighbour (unsigned short density)
void getLinearInterpolatedColor (unsigned short density, float &red, float &green, float &blue, float &alpha)


Detailed Description

This file defines a Transferfunction. A transferfunction is made of controlpoints and lines between them. The control points here are stored in a vector. To add a controlpoint, simply call the addControlPoint method.

Version:
12-04-2005

Definition at line 17 of file TxFunction.h.


Constructor & Destructor Documentation

TxFunction::TxFunction float  x1,
float  y1,
float  x2,
float  y2
 

The contructor the tranferfunction creates a function with 2 controlpoints - at the beginning and at the end. The controlpoints are usually given by the histogram dimensions.

Parameters:
x1 the x coordinate of the first control point
y1 the y coordinate of the first control point
x2 the x coordinate of the second control point
y2 the y coordinate of the second control point


Member Function Documentation

void TxFunction::addControlPoint GLfloat  x,
GLfloat  y,
GLfloat  red,
GLfloat  green,
GLfloat  blue,
GLfloat  alpha
 

Add a controlPoint to the vector wich holds the TxPoints. The function should only be called after the check.

Parameters:
x the x coordinate of the control point
y the y coordinate of the control point
red color part
green color part
blue color part
alpha value

Referenced by Histogram::onLeftMouseClick().

TxPoint * TxFunction::getFirstTxPoint  ) 
 

Retrieve the first point

Definition at line 37 of file TxFunction.cpp.

TxPoint * TxFunction::getLastTxPoint  ) 
 

Retrieve the last point

Definition at line 32 of file TxFunction.cpp.

void TxFunction::getLinearInterpolatedColor unsigned short  density,
float &  red,
float &  green,
float &  blue,
float &  alpha
 

Find the linear interpolated color of a given density. The method searches for the controlpoint that is next to the given density using the getNearestNeighbour method. Afterwards it calculates the distance to the two next neighbours and assigns the weighted color values to red, green, blue and alpha.

Parameters:
red component of the resulting color
green component of the resulting color
blue component of the resulting color
alpha component of the resulting color

Definition at line 103 of file TxFunction.cpp.

References getNearestNeighbour(), TxPoint::position, and TxPoint::rgba.

Referenced by Histogram::getColorByDensity().

TxPoint * TxFunction::getNearestNeighbour unsigned short  density  ) 
 

Find the next greater neighbour for a given density. This will also determine the

Definition at line 90 of file TxFunction.cpp.

Referenced by getLinearInterpolatedColor().

TxPoint* TxFunction::hitTxPoint GLfloat  x,
GLfloat  y
 

Check if the point is already in the function. This function is called each time before the user adds a point

Returns:
TxPoint* the point wich was slapped

Referenced by Histogram::onLeftMouseClick().

void TxFunction::moveControlPoint TxPoint point,
GLfloat  x,
GLfloat  y
 

Update the coordinates of a given controlpoint.

Parameters:
*point a valid point in the transferfunction list
x coodinate to move to
y coordinate to move to

Definition at line 42 of file TxFunction.cpp.

References TxPoint::moveTo().

Referenced by Histogram::onMouseDrag().

void TxFunction::removeControlPoint TxPoint p  ) 
 

Remove the given controlPoint from the list, if it is not the end or starting point of the transfer function.

Parameters:
*p a refernce to the point that should be removed

Definition at line 62 of file TxFunction.cpp.

Referenced by Histogram::removeControlPoint().

void TxFunction::render  ) 
 

This function draws the shape of the transfer function.

Definition at line 73 of file TxFunction.cpp.

References TxPoint::render().

Referenced by Histogram::render().


The documentation for this class was generated from the following files:
Generated on Mon Dec 12 15:20:26 2005 for CCube by  doxygen 1.4.1