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

A simple set of vectors in the plane. More...

#include <vectorset.h>

Inheritance diagram for VectorSet2:
PointCurve2

Public Member Functions

 VectorSet2 ()
 Empty.
 
 VectorSet2 (const QVector< Vector2 > &)
 Create a set of vectors. More...
 
 ~VectorSet2 ()
 Empty.
 
int Size () const
 Return the size of the set.
 
Vector2 At (int) const
 Access to element.
 
Vector2operator[] (int)
 Access to element.
 
Vector2 Barycenter () const
 Compute the barycenter.
 
Box2 GetBox () const
 Compute the bounding box. More...
 
Convex2 GetHull () const
 Compute the convex hull of the set.
 
void Rotate (const Matrix2 &)
 Rotate all the points. More...
 
void Rotate (const double &)
 Rotate all the points. More...
 
void Translate (const Vector2 &)
 Translate all the points. More...
 
void Scale (const double &)
 Scale all the points. More...
 
void Scale (const Vector2 &)
 Scale all the points. More...
 
VectorSet2 Translated (const Vector2 &) const
 Compute the translated set. More...
 
VectorSet2 Rotated (const double &) const
 Compute the rotated set. More...
 
VectorSet2 Scaled (const Vector2 &) const
 Compute the scaled set. More...
 
QVector< Vector2 > & Get ()
 Access to the internal structure.
 
int Nearest (const Vector2 &) const
 Compute the index of the nearest point to the argument point. More...
 
QVector< Vector2Nearest (const Vector2 &, int) const
 Compute the k-nearest points to the argument point. More...
 
QVector< int > NearestIndexes (const Vector2 &, int) const
 Compute the set of indexes of the k-nearest points to the argument point. More...
 
QVector< int > NearestIndexes (int, int, const double &=Math::Infinity) const
 Compute the set of indexes of the k-nearest points to the argument point in the set. More...
 

Protected Attributes

QVector< Vector2v
 Vectors.
 

Friends

std::ostream & operator<< (std::ostream &, const VectorSet2 &)
 Overloaded output-stream operator. More...
 

Detailed Description

A simple set of vectors in the plane.

See also
VectorSet

Constructor & Destructor Documentation

◆ VectorSet2()

VectorSet2::VectorSet2 ( const QVector< Vector2 > &  s)

Create a set of vectors.

Parameters
sThe set.

Member Function Documentation

◆ GetBox()

Box2 VectorSet2::GetBox ( ) const

Compute the bounding box.

Simply calls Box::Box(const QVector&).

◆ Nearest() [1/2]

int VectorSet2::Nearest ( const Vector2 p) const

Compute the index of the nearest point to the argument point.

Parameters
pPoint.

◆ Nearest() [2/2]

QVector< Vector2 > VectorSet2::Nearest ( const Vector2 p,
int  n 
) const

Compute the k-nearest points to the argument point.

Parameters
pPoint.
nNumber of points.

◆ NearestIndexes() [1/2]

QVector< int > VectorSet2::NearestIndexes ( const Vector2 p,
int  n 
) const

Compute the set of indexes of the k-nearest points to the argument point.

Parameters
pPoint.
nNumber of points.

◆ NearestIndexes() [2/2]

QVector< int > VectorSet2::NearestIndexes ( int  ip,
int  n,
const double &  d = Math::Infinity 
) const

Compute the set of indexes of the k-nearest points to the argument point in the set.

Parameters
ipIndex of the point.
nNumber of points.
dMaximum distance threshold.

◆ Rotate() [1/2]

void VectorSet2::Rotate ( const double &  a)

Rotate all the points.

Parameters
aRotation angle.

◆ Rotate() [2/2]

void VectorSet2::Rotate ( const Matrix2 r)

Rotate all the points.

Parameters
rRotation matrix.

◆ Rotated()

VectorSet2 VectorSet2::Rotated ( const double &  a) const

Compute the rotated set.

Parameters
sScaling vector.

◆ Scale() [1/2]

void VectorSet2::Scale ( const double &  s)

Scale all the points.

Parameters
sScaling factor.

◆ Scale() [2/2]

void VectorSet2::Scale ( const Vector2 s)

Scale all the points.

Parameters
sScaling vector.

◆ Scaled()

VectorSet2 VectorSet2::Scaled ( const Vector2 s) const

Compute the scaled set.

Parameters
sScaling vector.

◆ Translate()

void VectorSet2::Translate ( const Vector2 t)

Translate all the points.

Parameters
tTranslation vector.

◆ Translated()

VectorSet2 VectorSet2::Translated ( const Vector2 t) const

Compute the translated set.

Parameters
sScaling vector.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const VectorSet2 set 
)
friend

Overloaded output-stream operator.

Parameters
setSet.
sStream.