QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Qwt3DFunction Class Referenceabstract

Abstract base class for mathematical functions. More...

#include <qwt3d_function.h>

Inheritance diagram for Qwt3DFunction:
Qwt3DGridMapping Qwt3DMapping

Public Member Functions

 Qwt3DFunction ()
 Default constructor.
 
virtual double operator() (double x, double y)=0
 
void setMinZ (double val)
 Sets minimum z value for the function.
 
void setMaxZ (double val)
 Sets maximum z value for the function.
 
virtual Qwt3DFunctionData create ()
 Evaluates the function over the mesh grid and returns the result.
 
- Public Member Functions inherited from Qwt3DGridMapping
 Qwt3DGridMapping ()
 Default constructor.
 
void setMesh (unsigned int columns, unsigned int rows)
 
void setDomain (double minu, double maxu, double minv, double maxv)
 Sets the domain (parameter range) for the u and v directions.
 
void restrictRange (ParallelEpiped const &)
 Restricts the data range to a parallelepiped.
 
- Public Member Functions inherited from Qwt3DMapping
virtual QString name () const
 

Additional Inherited Members

- Protected Member Functions inherited from Qwt3DGridMapping
ParallelEpipedrange ()
 
const ParallelEpipedrange () const
 
unsigned int meshU () const
 
unsigned int meshV () const
 
double minU () const
 
double maxU () const
 
double minV () const
 
double maxV () const
 

Detailed Description

Abstract base class for mathematical functions.

A Qwt3DFunction encapsulates a mathematical function with rectangular domain. The user has to adapt the pure virtual operator() to get a working object. Also, the client code should call setDomain, setMesh and create for reasonable operating conditions.

create() returns a Qwt3DFunctionData struct that the caller feeds to Qwt3DSurface::loadFromData(). The function no longer holds a back-pointer to the surface item (deferred smell #2, resolved).

class MyFunction : public Qwt3DFunction
{
public:
double operator()(double x, double y) override { return std::sin(x + y); }
};
MyFunction func;
func.setMesh(50, 50);
func.setDomain(-3, 3, -3, 3);
auto data = func.create();
surface->loadFromData(data);
Abstract base class for mathematical functions.
Definition qwt3d_function.h:34

Member Function Documentation

◆ create()

Qwt3DFunctionData Qwt3DFunction::create ( )
virtual

Evaluates the function over the mesh grid and returns the result.

Returns
Qwt3DFunctionData containing the z-value matrix and domain bounds

Allocates a z-value matrix, evaluates operator() over the mesh grid, clips values to the min/max z range, and returns the result. The caller is responsible for feeding this to Qwt3DSurface::loadFromData(). Returns an empty result (columns=0) if the mesh is too small.

◆ setMaxZ()

void Qwt3DFunction::setMaxZ ( double  val)

Sets maximum z value for the function.

Parameters
valMaximum z value

◆ setMinZ()

void Qwt3DFunction::setMinZ ( double  val)

Sets minimum z value for the function.

Parameters
valMinimum z value

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