Core 1.0
Public Member Functions | Protected Attributes | List of all members
VectorField2 Class Reference

A base two-dimensional field of Vector2 values. More...

#include <vectorfield.h>

Inheritance diagram for VectorField2:
Array2 Box2

Public Member Functions

 VectorField2 ()
 Empty.
 
 VectorField2 (const Box2 &, int, int, const Vector2 &=Vector2::Null)
 Create the field structure. More...
 
 VectorField2 (const Box2 &, int, int, const AnalyticVectorField2 &)
 Create the field structure from an analytic vector field. More...
 
 ~VectorField2 ()
 Empty.
 
void Set (const Vector2 &)
 Set the whole vector field to a constant vector. More...
 
Vector2 at (int, int) const
 Return the field value at a given array vertex. More...
 
Vector2 at (const QPoint &) const
 Return the field value at a given array vertex. More...
 
Vector2operator() (int, int)
 Return the field value at a given array vertex. More...
 
Vector2operator() (const QPoint &)
 Return the field value at a given array vertex. More...
 
Vector2 at (int) const
 Return the data in the field. More...
 
Vector2operator[] (int)
 Return the data in the field. More...
 
VectorField2operator+= (const VectorField2 &)
 Destructive sum of two vector fields. More...
 
VectorField2operator-= (const VectorField2 &)
 Destructive difference of two vector fields. More...
 
ScalarField2 GetNorm () const
 Compute the norm of the vector field.
 
ScalarField2 GetAngle () const
 Compute the angle of the vector field.
 
ScalarField2 GetComponent (int) const
 Create and return the scalar field with the x or y components. More...
 
QImage CreateAngleImage () const
 Create the angle image.
 
void Normalize ()
 Normalize the vector field, i.e. set the range of norm of the vectors [0,1].
 
void Unit ()
 Set all vectors to unit, i.e. set the norm of the vectors to 1. More...
 
VectorField2 Orthogonal () const
 Compute the orthogonal vector field. More...
 
void GetRange (Vector2 &, Vector2 &) const
 Compute the range of the vector field. More...
 
void GetNormRange (double &, double &) const
 Compute the range of norm the vector field. More...
 
double AverageNorm () const
 Compute the average norm.
 
virtual Vector2 Value (const Vector2 &) const
 Get the field value at a given point. More...
 
virtual Vector2 Value (int, int) const
 Return the field vector at a given array vertex. More...
 
virtual ScalarField2 Divergence () const
 Compute the divergence field. More...
 
virtual double Divergence (int, int) const
 Compute the divergence at a given sample. More...
 
void Add (const VectorField2 &)
 Add two vector fields. More...
 
void Sub (const VectorField2 &)
 Subtract two vector fields. More...
 
void Mul (const double &)
 Subtract two vector fields. More...
 
virtual ScalarField2 Curl () const
 Compute the curl of the vector field. More...
 
virtual double Curl (int, int) const
 Compute the curl at a given sample. More...
 
void Rotate (const Matrix2 &)
 Compute the rotated vector field. More...
 
void Lerp (const VectorField2 &, const VectorField2 &, const double &)
 Linear interpolation between two vector fields. More...
 
void Multiply (const Vector2 &, const double &, const double &)
 Multiply the vector field by a scaling factor locally. More...
 
void Radial (const Vector2 &, const double &, const double &)
 Adds to the vector field a radial component centered at center and goind towards the center (with scaling being positive) and towards the exterior of the center (with scaling being negative) More...
 
void Clone (const Vector2 &, const Vector2 &, const Vector2 &, const double &)
 Clone part of the vector field from source to destination positions, with a given radius. The destination is blended with a decreasing weight towards the disk boundary where it is null. More...
 
void CloneZone (const Vector2 &, const QPolygon &, int, const VectorField2 *=nullptr)
 Clone part of the vector field from source to destination positions. More...
 
void CloneBrokenLine (const QVector< Vector2 > &, const QVector< Vector2 > &, int, const VectorField2 *=nullptr)
 clones the gradient from the sourceLine along the destLine, cloning all points that are less than halfWidth away from the curves
 
QImage CreateImage () const
 Create an image from the field.
 
QImage CreateBlueRedImage () const
 Create the angle image.
 
QImage CreateGradientImage (const double &) const
 Create the gradient image (similar to CreateBlueRedImage() with different color settings and 16 bits depth)
 
QImage CreateStreamLines () const
 Create an image from the field.
 
QImage CreateImageParticles (const double &) const
 Create an image from the field, showing trajectory with particle and streamlines. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a vector field. More...
 
Vector2 Euler (const Vector2 &, const double &, bool=false) const
 Compute the new position of a point in the vector field using forward Euler integration. More...
 
Vector2 RungeKutta (const Vector2 &, const double &) const
 Compute the new position of a point in the vector field using Runge Kutta 4 integration. More...
 
PointCurve2 EulerSteps (const Vector2 &, const double &, int, bool=false) const
 Compute trajectory of a point using Euler integration. More...
 
ScalarField2 LineIntegral (int) const
 Compute line integral convolution image. More...
 
VectorField2 GaussianBlur (const double &) const
 Perform a Gaussian blur. More...
 
VectorField2 GaussianBlur (int) const
 Perform a Gaussian blur. More...
 
- Public Member Functions inherited from Array2
 Array2 ()
 Empty array, with empty box.
 
 Array2 (const Box2 &, int, int)
 Create the array structure. More...
 
 Array2 (const Box2 &, int)
 Create the array structure. More...
 
Array2 DownSample (int) const
 Downsample the array. More...
 
Array2 UpSample (int) const
 Upsample the array. More...
 
 ~Array2 ()
 Empty.
 
int VertexSize () const
 Return the size of the vertex array.
 
int GetSizeX () const
 Get the vertex size of the array for x axis.
 
int GetSizeY () const
 Get the vertex size of the array for y axis.
 
int VertexBorderSize () const
 Return the size of the vertex array.
 
int CellSize () const
 Return the size of the cell array.
 
int CellSizeX () const
 Get the cell size of the array for x axis.
 
int CellSizeY () const
 Get the cell size of the array for y axis.
 
QSize GetQtSize () const
 Return the Qt size of the vertex array.
 
Box2 Cell (int) const
 Return the geometry of the cell. More...
 
Box2 Cell (int, int) const
 Return the geometry of the cell. More...
 
void HalfCell (int, int, bool, Triangle2 &, Triangle2 &) const
 Return the geometry of the cell. More...
 
Vector2 CellCenter (int, int) const
 Return the center of the cell. More...
 
void Scale (const Vector2 &)
 Scales the array structure. More...
 
void Scale (const double &)
 Scales the array structure. More...
 
Box2 GetBox () const
 Get the box of the array.
 
Box2 UnitCell () const
 Return the geometry of a generic cell. More...
 
Vector2 CellDiagonal () const
 Return the cell diagonal vector.
 
double CellArea () const
 Return the area of a cell. More...
 
Vector2 ArrayVertex (int, int) const
 Compute the coordinates of a point on the grid. More...
 
Vector2 ArrayVertex (const QPoint &) const
 Compute the coordinates of a point on the grid. More...
 
QVector< Vector2ArrayVertexes (const QVector< QPoint > &) const
 Compute the coordinates of a set of points on the grid. More...
 
Vector2 Size () const
 Return the size of the array.
 
QRect AreaInteger () const
 Return the range of integer values for the domain.
 
QImage ImageGrid (const Box2 &, const double &) const
 Create a texture with a regular grid. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw the cells of the grid. More...
 
void Subdivide ()
 Change the resolution. More...
 
bool IsEmpty () const
 Detect if the array is empty, i.e., any dimension equal to zero.
 
QPoint VertexBorder (int) const
 Compute the k-th point on the boundary of the domain. More...
 
int VertexBorderIndex (int, int) const
 Compute the index of a point on the boundary of the domain. More...
 
void VertexInteger (const Vector2 &, int &, int &) const
 Compute the coordinates of a vertex inside a cell. More...
 
QPoint VertexInteger (const Vector2 &) const
 Compute the coordinates of a vertex inside a cell. More...
 
QPoint VertexInteger (const Vector2 &, double &, double &) const
 Compute the point on the grid given an input point. More...
 
QRect VertexIntegerArea (const Box2 &) const
 Compute the integer coordinates of the vertices embedding a box. More...
 
QRect VertexIntegerArea (const Circle2 &) const
 Compute the integer coordinates of the vertices embedding a circle. More...
 
QRect VertexIntegerArea (const QRect &) const
 Compute the integer coordinates span of the vertices embedding a rectangle. More...
 
void CellInteger (const Vector2 &, int &, int &) const
 Compute the coordinates of a vertex inside a cell. More...
 
void CellInteger (const Vector2 &, int &, int &, double &, double &) const
 Compute the point on the grid given an input point. More...
 
QPoint CellInteger (const Vector2 &) const
 Compute the coordinates of a vertex inside a cell. More...
 
QPoint CellInteger (const Vector2 &, double &, double &) const
 Compute the point on the grid given an input point. More...
 
QRect CellIntegerArea (const Box2 &) const
 Compute the integer coordinates of the cells of the array embedding an input box. More...
 
QRect CellIntegerArea (const Circle2 &) const
 Compute the integer coordinates of the cells of the array embedding an input circle. More...
 
void Translate (const Vector2 &)
 Translate the array. More...
 
Vector2 Center () const
 Return the center of the array.
 
constexpr bool InsideVertexIndex (int, int) const
 Check if the indexes are within range. More...
 
constexpr bool OutsideVertexIndex (int, int) const
 Check if the indexes are outside or on the border. More...
 
constexpr bool InsideVertexIndex (const QPoint &) const
 Check if the indexes are within range. More...
 
constexpr bool InsideVertexIndex (int, int, int) const
 Check if the indexes are within k-range. More...
 
bool Inside (const Vector2 &) const
 Check if a point is in the rectangular domain. More...
 
constexpr bool BorderVertexIndex (int, int) const
 Check if the indexes are on the border. More...
 
constexpr bool BorderVertexIndex (const QPoint &) const
 Check if the indexes are on the border. More...
 
constexpr int VertexIndex (int, int) const
 Compute the index of a given cell. More...
 
constexpr int VertexIndex (const QPoint &) const
 Compute the index of a given cell. More...
 
QPoint Next (const QPoint &, int) const
 Compute the point next to another one. More...
 
QImage CreateEmptyImage () const
 Create an image with the same size as the array. More...
 
QString Statistics () const
 Get statistics.
 
void ClampVertexIndex (int &, int &) const
 Clamp vertex indexes to the size of the array. More...
 

Protected Attributes

QVector< Vector2field
 Field samples.
 
- Protected Attributes inherited from Array2
int ny = 0
 Sizes.
 
Vector2 celldiagonal = Vector2::Null
 Cell diagonal.
 
Vector2 inversecelldiagonal = Vector2::Null
 Inverse cell diagonal.
 
- Protected Attributes inherited from Box2
Vector2 b
 Lower and upper vertices of the box.
 

Additional Inherited Members

- Static Public Member Functions inherited from Array2
static int NeighborCode (int, int)
 Convert a direction to an 8 bit integer code. More...
 
static QPoint codeToDir (int)
 Convert an 8 bit integer code direction into a direction vector. More...
 
- Protected Member Functions inherited from Array2
constexpr void InverseVertexIndex (int, int &, int &) const
 Compute the coordinates of a given cell. More...
 
constexpr QPoint InverseVertexIndex (int) const
 Compute the coordinates of a given cell. More...
 
constexpr int CellIndex (int, int) const
 Compute the index of a given cell. More...
 
constexpr int CellIndex (const QPoint &) const
 Compute the index of a given cell. More...
 
constexpr bool InsideCellIndex (int, int) const
 Check if the indexes are within range. More...
 
constexpr bool InsideCellIndex (const QPoint &) const
 Check if the indexes are within range. More...
 
void InverseCellIndex (int, int &, int &) const
 Compute the coordinates of a given cell. More...
 
- Protected Member Functions inherited from Box2
 Box2 ()
 Empty.
 
 Box2 (const double &)
 Create a square box centered at the origin and of given half side length. More...
 
 Box2 (const double &, const double &)
 Create a box centered at the origin and of given dimensions. More...
 
 Box2 (const Vector2 &)
 Create a box from a single vertex. More...
 
 Box2 (const Vector2 &, const Vector2 &)
 Create a box. More...
 
 Box2 (const Vector2 &, const double &)
 Creates a box. More...
 
 Box2 (const Box &)
 Create a box in the plane given a box. More...
 
 Box2 (const Box2 &, const Box2 &)
 Create a box embedding two boxes. More...
 
 Box2 (const Box2 &, const Matrix2 &)
 Creates an axis aligned bounding box from a box and a transformation matrix. More...
 
 Box2 (const Box2 &, const Frame2 &)
 Creates an axis aligned bounding box from a box and a frame. More...
 
 Box2 (const QVector< Vector2 > &)
 Compute the bounding box of a set of points. More...
 
 Box2 (const QSize &)
 Create a box from a Qt size. More...
 
Vector2operator[] (int)
 Returns either end vertex of the box.
 
Vector2 operator[] (int) const
 Overloaded.
 
Vector2 Size () const
 Compute the size (width and height) of a box.
 
double Width () const
 Compute the width of a box. More...
 
double Height () const
 Compute the height of a box. More...
 
Vector2 Diagonal () const
 Returns the diagonal of the box.
 
double Radius () const
 Returns the radius of the box, i.e. the length of the half diagonal of the box.
 
double Area () const
 Compute the surface area of a box.
 
double Perimeter () const
 Compute the perimeter of the box.
 
Vector2 Center () const
 Returns the center of the box.
 
Vector2 Vertex (int) const
 Returns the k-th vertex of the box. More...
 
Vector2 Vertex (int, int, int, int) const
 Compute the coordinates of a grid aligned point. More...
 
Box2 Sub (int) const
 Computes the sub-box in the n-th quadrant. More...
 
double R (const Vector2 &) const
 Compute the squared distance between the box and a point. More...
 
double Signed (const Vector2 &) const
 Computes the signed distance between the box and a point. More...
 
double R (const Box2 &) const
 Compute the squared Euclidean distance between two boxes. More...
 
void Translate (const Vector2 &)
 Translates a box. More...
 
void Scale (const Vector2 &)
 Scales a box. More...
 
void Scale (const double &)
 Scales a box. More...
 
Box2 Translated (const Vector2 &) const
 Translated box. More...
 
Box2 Scaled (const double &) const
 Scales a box and return the scaled box. More...
 
Box2 Scaled (const Vector2 &) const
 Scales a box and return the scaled box. More...
 
Box2 Scaled (const QSize &) const
 Scales a box according to a Qt size. More...
 
Box2 ScaledTo (const double &) const
 Scale the box so that the largest side should equal the argument value. More...
 
Box2 Rotated (const double &) const
 Compute the box embedding the rotated box. More...
 
Box2 Rotated (const Matrix2 &) const
 Compute the box embedding the rotated box. More...
 
Box2 Centered () const
 Compute the box translated to origin. More...
 
void SetCubic ()
 Creates the tightest embedding cube from an arbitrarilly shaped box. More...
 
void SetInscribedCubic ()
 Creates the biggest cube inscribed in the box. More...
 
Box2 Cube () const
 Return the tightest embedding cube from an arbitrarilly shaped box. More...
 
void Extend (const double &)
 Extend the limits of the box by a given distance. More...
 
void Extend (const Vector2 &)
 Extend the limits of the box given a point. More...
 
Box2 Extended (const double &) const
 Extend the limits of the box by a given distance. More...
 
void SetParallelepipedic (int, int &, int &)
 Inflates a box so that its dimensions should be a fraction of its maximum side length. More...
 
void SetParallelepipedic (const double &, int &, int &)
 Creates a parallelepipedic box whose dimensions are integer multiples of a given input reference size. More...
 
bool Inside (const Vector2 &) const
 Test if a point is inside the box. More...
 
bool Inside (const Vector2 &, const double &) const
 Test if a point lies withing a given range of the box. More...
 
bool Intersect (const Box2 &) const
 Check if the box intersects another box. More...
 
double OverlapArea (const Box2 &) const
 Computes the overlapping area of two boxes. More...
 
Box2 Intersection (const Box2 &) const
 Computes the intersection between two boxes. More...
 
Box ToBox (const double &, const double &) const
 Convert a planar Box2 to a Box. More...
 
int Quadrant (const Vector2 &) const
 Computes quadrant index of a vertex with respect to the box center. More...
 
bool Intersect (const Ray2 &, double &, double &) const
 Computes the intersection between a box and a ray. More...
 
bool Intersect (const Ray2 &) const
 Computes the intersection between a box and a ray. More...
 
bool Intersect (const Line2 &, double &, double &) const
 Computes the intersection between a box and a line. More...
 
bool Intersect (const Segment2 &, double &, double &) const
 Compute the intersection between a box and a segment. More...
 
bool Intersect (const Line2 &) const
 Check the intersection between a box and a line. More...
 
bool Intersect (const Segment2 &) const
 Check the intersection between a box and a segment. More...
 
void Draw (QGraphicsScene &, const QPen &=QPen(), const QBrush &=QBrush()) const
 Draw a rectangle. More...
 
Vector2 RandomInside (Random &=Random::R239) const
 Generate a random vector inside the box. More...
 
Vector2 RandomOn (Random &=Random::R239) const
 Generate a random vector on the perimeter of the box. More...
 
QRectF GetQtRect () const
 Create the Qt rectangle.
 
QRect TileRange (const Box2 &) const
 Compute the range of index for tiling the argument box so that it covers the box. More...
 
Box2 Tile (int, int) const
 Return the tiled the box using integer coordinates. More...
 
Box2 Tile (const QRect &) const
 Return the tiled the box using integer coordinates. More...
 
QVector< Vector2Poisson (const double &, int, Random &=Random::R239) const
 Compute a Poisson disc distribution inside a box. More...
 
- Static Protected Member Functions inherited from Box2
static Box2 MinMax (const Vector2 &, const Vector2 &)
 Create a box from any two points. More...
 
- Static Protected Attributes inherited from Array2
static const QPoint next [8] = { QPoint(1, 0), QPoint(1, 1), QPoint(0, 1), QPoint(-1, 1), QPoint(-1, 0), QPoint(-1, -1), QPoint(0, -1), QPoint(1, -1) }
 Array of points in the 1-ring neighborhood.
 
static const double length [8] = { 1.0, sqrt(2.0), 1.0, sqrt(2.0), 1.0, sqrt(2.0), 1.0, sqrt(2.0) }
 Length to the i-th neighbor.
 
static const double inverselength [8] = { 1.0, 1.0 / sqrt(2.0), 1.0, 1.0 / sqrt(2.0), 1.0, 1.0 / sqrt(2.0), 1.0, 1.0 / sqrt(2.0) }
 Inverse length.
 
- Static Protected Attributes inherited from Box2
static const double epsilon = 1.0e-5
 Epsilon value used to check intersections and some round off errors.
 
static const Box2 Infinity
 Huge bounding box, which should enclose any other.
 
static const Box2 Null
 Null box, equivalent to. More...
 
static const Box2 Unit
 Unit box, defined as. More...
 

Detailed Description

A base two-dimensional field of Vector2 values.

Constructor & Destructor Documentation

◆ VectorField2() [1/2]

VectorField2::VectorField2 ( const Box2 box,
int  x,
int  y,
const Vector2 v = Vector2::Null 
)
explicit

Create the field structure.

Parameters
boxThe box.
x,ySize of the array.
vDefault value of field.

◆ VectorField2() [2/2]

VectorField2::VectorField2 ( const Box2 box,
int  x,
int  y,
const AnalyticVectorField2 a 
)
explicit

Create the field structure from an analytic vector field.

Parameters
boxThe box.
x,ySize of the array.
aThe analytic vector field.

Member Function Documentation

◆ Add()

void VectorField2::Add ( const VectorField2 v)

Add two vector fields.

Parameters
vArgument vector field. Optimized with AVX

◆ at() [1/3]

Vector2 VectorField2::at ( const QPoint &  p) const
inline

Return the field value at a given array vertex.

Parameters
pPoint with its coordinates.

◆ at() [2/3]

Vector2 VectorField2::at ( int  c) const
inline

Return the data in the field.

Parameters
cIndex.

◆ at() [3/3]

Vector2 VectorField2::at ( int  i,
int  j 
) const
inline

Return the field value at a given array vertex.

Parameters
i,jInteger coordinates of the vertex.

◆ Clone()

void VectorField2::Clone ( const Vector2 center,
const Vector2 source,
const Vector2 strokebegin,
const double &  radius 
)

Clone part of the vector field from source to destination positions, with a given radius. The destination is blended with a decreasing weight towards the disk boundary where it is null.

Parameters
centerDestination position.
sourceSource position.
strokebeginStroke starting position.
radiusScaling of the effect.

◆ CloneZone()

void VectorField2::CloneZone ( const Vector2 center,
const QPolygon &  lassoedZone,
int  borderBlendTreshold,
const VectorField2 gradientSource = nullptr 
)

Clone part of the vector field from source to destination positions.

The destination is blended with a decreasing weight towards the disk boundary where it is null.

Parameters
centerTarget position.
lassoedZoneSelected area.
borderBlendTresholdBorder threshold.
gradientSourceSource.

◆ CreateImageParticles()

QImage VectorField2::CreateImageParticles ( const double &  dt) const

Create an image from the field, showing trajectory with particle and streamlines.

Author
Axel Paris.
Parameters
dtTime step for tracing particle trajectories.

◆ Curl() [1/2]

ScalarField2 VectorField2::Curl ( ) const
virtual

Compute the curl of the vector field.

See also
Curl(int, int)

◆ Curl() [2/2]

double VectorField2::Curl ( int  i,
int  j 
) const
virtual

Compute the curl at a given sample.

See also
Curl()
Parameters
i,jInteger coordinates of the sample.

◆ Divergence() [1/2]

ScalarField2 VectorField2::Divergence ( ) const
virtual

Compute the divergence field.

See also
Divergence(int, int)
Author
Mathieu Gaillard

◆ Divergence() [2/2]

double VectorField2::Divergence ( int  i,
int  j 
) const
virtual

Compute the divergence at a given sample.

See also
Divergence()
Author
Mathieu Gaillard
Parameters
i,jInteger coordinates of the sample.

◆ Draw()

void VectorField2::Draw ( QGraphicsScene &  scene,
const QPen &  pen = QPen(),
const QBrush &  brush = QBrush() 
) const

Draw a vector field.

Parameters
sceneGraphics scene.
penThe pen.
brushThe brush.

◆ Euler()

Vector2 VectorField2::Euler ( const Vector2 p,
const double &  t,
bool  s = false 
) const

Compute the new position of a point in the vector field using forward Euler integration.

Direct forward Euler integration simply returns p + t v(p), error is bounded by O(t2).

Improved Euler’s method use a prediction-correction scheme, error is bounded by O(t3).

Parameters
pPoint.
tTime step.
sScheme: false is simple Euler method, true for prediction-correction.

◆ EulerSteps()

PointCurve2 VectorField2::EulerSteps ( const Vector2 p,
const double &  t,
int  n,
bool  s = false 
) const

Compute trajectory of a point using Euler integration.

Parameters
pPoint.
tTime step.
nNumber of steps.
sScheme: false is simple Euler method, true for prediction-correction.

◆ GaussianBlur() [1/2]

VectorField2 VectorField2::GaussianBlur ( const double &  r) const

Perform a Gaussian blur.

Parameters
rRadius of blur.
See also
ScalarField2::GaussianBlur(int)

◆ GaussianBlur() [2/2]

VectorField2 VectorField2::GaussianBlur ( int  r) const

Perform a Gaussian blur.

Parameters
rRadius (in cells) of blur.

◆ GetComponent()

ScalarField2 VectorField2::GetComponent ( int  i) const

Create and return the scalar field with the x or y components.

Parameters
iIndex.

◆ GetNormRange()

void VectorField2::GetNormRange ( double &  a,
double &  b 
) const

Compute the range of norm the vector field.

Parameters
a,bReturned minimum and maximum norms.

◆ GetRange()

void VectorField2::GetRange ( Vector2 a,
Vector2 b 
) const

Compute the range of the vector field.

Parameters
a,bReturned minimum and maximum vector values.

◆ Lerp()

void VectorField2::Lerp ( const VectorField2 a,
const VectorField2 b,
const double &  t 
)

Linear interpolation between two vector fields.

Parameters
a,bScalar fields, should have the same resolution.
tInterpolant. Optimized with AVX

◆ LineIntegral()

ScalarField2 VectorField2::LineIntegral ( int  n) const

Compute line integral convolution image.

This is the implementation of Cabral, Brian and Leedom, Leith Casey. Imaging Vector Fields Using Line Integral Convolution. Proceedings of SIGGRAPH, 263–270, 1993.

Stalling, Detlev and Hege, Hans-Christian. Fast and resolution independent line integral convolution. Proceedings of SIGGRAPH, 249–256, 1995.

The vector field should be converted to unit direction vector using VectorField2::Unit.

See also
VectorField2::Unit().
Parameters
nNumber of steps.

◆ Mul()

void VectorField2::Mul ( const double &  s)

Subtract two vector fields.

Parameters
sScalar. Optimized with AVX

◆ Multiply()

void VectorField2::Multiply ( const Vector2 center,
const double &  radius,
const double &  scaling 
)

Multiply the vector field by a scaling factor locally.

At the center, the scaling will be applied and at the boundary it will be equal to 1.

Parameters
centerCenter.
radiusRadius.
scalingScaling of the effect.

◆ operator()() [1/2]

Vector2 & VectorField2::operator() ( const QPoint &  p)
inline

Return the field value at a given array vertex.

Parameters
pPoint.

◆ operator()() [2/2]

Vector2 & VectorField2::operator() ( int  i,
int  j 
)
inline

Return the field value at a given array vertex.

Parameters
i,jInteger coordinates of the vertex.

◆ operator+=()

VectorField2 & VectorField2::operator+= ( const VectorField2 f)

Destructive sum of two vector fields.

Parameters
fVector field.

◆ operator-=()

VectorField2 & VectorField2::operator-= ( const VectorField2 f)

Destructive difference of two vector fields.

Parameters
fVector field.

◆ operator[]()

Vector2 & VectorField2::operator[] ( int  c)
inline

Return the data in the field.

Parameters
cIndex.

◆ Orthogonal()

VectorField2 VectorField2::Orthogonal ( ) const

Compute the orthogonal vector field.

Note that this is the same as rotating the field, but more efficient:

static const double Pi
Ď€.
Definition: mathematics.h:174
This class implements 22 matrix.
Definition: matrix.h:426
A base two-dimensional field of Vector2 values.
Definition: vectorfield.h:26
void Rotate(const Matrix2 &)
Compute the rotated vector field.
Definition: vectorfield2.cpp:69

◆ Radial()

void VectorField2::Radial ( const Vector2 center,
const double &  radius,
const double &  scaling 
)

Adds to the vector field a radial component centered at center and goind towards the center (with scaling being positive) and towards the exterior of the center (with scaling being negative)

Parameters
centerCenter.
radiusRadius.
scalingScaling of the effect.

◆ Rotate()

void VectorField2::Rotate ( const Matrix2 r)

Compute the rotated vector field.

Parameters
rRotation matrix.

◆ RungeKutta()

Vector2 VectorField2::RungeKutta ( const Vector2 p,
const double &  t 
) const

Compute the new position of a point in the vector field using Runge Kutta 4 integration.

Error is bounded by O(t4).

Parameters
pPoint.
tTime step.

◆ Set()

void VectorField2::Set ( const Vector2 v)

Set the whole vector field to a constant vector.

Parameters
vVector.

◆ Sub()

void VectorField2::Sub ( const VectorField2 v)

Subtract two vector fields.

Parameters
vArgument vector field. Optimized with AVX

◆ Unit()

void VectorField2::Unit ( )

Set all vectors to unit, i.e. set the norm of the vectors to 1.

See also
VectorField2::Normalize()

◆ Value() [1/2]

Vector2 VectorField2::Value ( const Vector2 p) const
virtual

Get the field value at a given point.

This function relies on a bi-linear interpolation of the vectors.

See also
Math::Bilinear
Parameters
pPoint.

◆ Value() [2/2]

Vector2 VectorField2::Value ( int  i,
int  j 
) const
virtual

Return the field vector at a given array vertex.

Parameters
i,jInteger coordinates of the vertex.
See also
at(int,int)