Qt 4.8
Public Functions | Static Public Functions | Private Functions | Properties | Friends | Related Functions | List of all members
QVector2D Class Reference

The QVector2D class represents a vector or vertex in 2D space. More...

#include <qvector2d.h>

Public Functions

bool isNull () const
 Returns true if the x and y coordinates are set to 0. More...
 
qreal length () const
 Returns the length of the vector from the origin. More...
 
qreal lengthSquared () const
 Returns the squared length of the vector from the origin. More...
 
void normalize ()
 Normalizes the currect vector in place. More...
 
QVector2D normalized () const
 Returns the normalized unit vector form of this vector. More...
 
 operator QVariant () const
 Returns the 2D vector as a QVariant. More...
 
QVector2Doperator*= (qreal factor)
 Multiplies this vector's coordinates by the given factor, and returns a reference to this vector. More...
 
QVector2Doperator*= (const QVector2D &vector)
 Multiplies the components of this vector by the corresponding components in vector. More...
 
QVector2Doperator+= (const QVector2D &vector)
 Adds the given vector to this vector and returns a reference to this vector. More...
 
QVector2Doperator-= (const QVector2D &vector)
 Subtracts the given vector from this vector and returns a reference to this vector. More...
 
QVector2Doperator/= (qreal divisor)
 Divides this vector's coordinates by the given divisor, and returns a reference to this vector. More...
 
 QVector2D ()
 Constructs a null vector, i. More...
 
 QVector2D (qreal xpos, qreal ypos)
 Constructs a vector with coordinates (xpos, ypos). More...
 
 QVector2D (const QPoint &point)
 Constructs a vector with x and y coordinates from a 2D point. More...
 
 QVector2D (const QPointF &point)
 Constructs a vector with x and y coordinates from a 2D point. More...
 
 QVector2D (const QVector3D &vector)
 Constructs a vector with x and y coordinates from a 3D vector. More...
 
 QVector2D (const QVector4D &vector)
 Constructs a vector with x and y coordinates from a 3D vector. More...
 
void setX (qreal x)
 Sets the x coordinate of this point to the given x coordinate. More...
 
void setY (qreal y)
 Sets the y coordinate of this point to the given y coordinate. More...
 
QPoint toPoint () const
 Returns the QPoint form of this 2D vector. More...
 
QPointF toPointF () const
 Returns the QPointF form of this 2D vector. More...
 
QVector3D toVector3D () const
 Returns the 3D form of this 2D vector, with the z coordinate set to zero. More...
 
QVector4D toVector4D () const
 Returns the 4D form of this 2D vector, with the z and w coordinates set to zero. More...
 
qreal x () const
 Returns the x coordinate of this point. More...
 
qreal y () const
 Returns the y coordinate of this point. More...
 

Static Public Functions

static qreal dotProduct (const QVector2D &v1, const QVector2D &v2)
 Returns the dot product of v1 and v2. More...
 

Private Functions

 QVector2D (float xpos, float ypos, int dummy)
 

Properties

float xp
 
float yp
 

Friends

bool operator!= (const QVector2D &v1, const QVector2D &v2)
 Returns true if v1 is not equal to v2; otherwise returns false. More...
 
const QVector2D operator* (qreal factor, const QVector2D &vector)
 
const QVector2D operator* (const QVector2D &vector, qreal factor)
 
const QVector2D operator* (const QVector2D &v1, const QVector2D &v2)
 
const QVector2D operator+ (const QVector2D &v1, const QVector2D &v2)
 Returns a QVector2D object that is the sum of the given vectors, v1 and v2; each component is added separately. More...
 
const QVector2D operator- (const QVector2D &v1, const QVector2D &v2)
 Returns a QVector2D object that is formed by subtracting v2 from v1; each component is subtracted separately. More...
 
const QVector2D operator- (const QVector2D &vector)
 Returns a QVector2D object that is formed by changing the sign of the components of the given vector. More...
 
const QVector2D operator/ (const QVector2D &vector, qreal divisor)
 Returns the QVector2D object formed by dividing all three components of the given vector by the given divisor. More...
 
bool operator== (const QVector2D &v1, const QVector2D &v2)
 Returns true if v1 is equal to v2; otherwise returns false. More...
 
bool qFuzzyCompare (const QVector2D &v1, const QVector2D &v2)
 Returns true if v1 and v2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise. More...
 
class QVector3D
 
class QVector4D
 

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &stream, const QVector2D &vector)
 Writes the given vector to the given stream and returns a reference to the stream. More...
 
QDataStreamoperator>> (QDataStream &stream, QVector2D &vector)
 Reads a 2D vector from the given stream into the given vector and returns a reference to the stream. More...
 

Detailed Description

The QVector2D class represents a vector or vertex in 2D space.

Since
4.6

The QVector2D class can also be used to represent vertices in 2D space. We therefore do not need to provide a separate vertex class.

Note: By design values in the QVector2D instance are stored as float. This means that on platforms where the qreal arguments to QVector2D functions are represented by double values, it is possible to lose precision.

See also
QVector3D, QVector4D, QQuaternion

Definition at line 60 of file qvector2d.h.

Constructors and Destructors

◆ QVector2D() [1/7]

QVector2D::QVector2D ( )
inline

Constructs a null vector, i.

e. with coordinates (0, 0, 0).

Definition at line 131 of file qvector2d.h.

Referenced by normalized(), operator*(), operator+(), operator-(), and operator/().

131 : xp(0.0f), yp(0.0f) {}
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ QVector2D() [2/7]

QVector2D::QVector2D ( qreal  xpos,
qreal  ypos 
)
inline

Constructs a vector with coordinates (xpos, ypos).

Definition at line 135 of file qvector2d.h.

135 : xp(xpos), yp(ypos) {}
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ QVector2D() [3/7]

QVector2D::QVector2D ( const QPoint point)
inlineexplicit

Constructs a vector with x and y coordinates from a 2D point.

Definition at line 137 of file qvector2d.h.

137 : xp(point.x()), yp(point.y()) {}
float xp
Definition: qvector2d.h:121
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
float yp
Definition: qvector2d.h:121
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ QVector2D() [4/7]

QVector2D::QVector2D ( const QPointF point)
inlineexplicit

Constructs a vector with x and y coordinates from a 2D point.

Definition at line 139 of file qvector2d.h.

139 : xp(point.x()), yp(point.y()) {}
float xp
Definition: qvector2d.h:121
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
float yp
Definition: qvector2d.h:121

◆ QVector2D() [5/7]

QVector2D::QVector2D ( const QVector3D vector)
explicit

Constructs a vector with x and y coordinates from a 3D vector.

The z coordinate of vector is dropped.

See also
toVector3D()

Definition at line 118 of file qvector2d.cpp.

119 {
120  xp = vector.xp;
121  yp = vector.yp;
122 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector3d.h:132
float xp
Definition: qvector3d.h:132
float yp
Definition: qvector2d.h:121

◆ QVector2D() [6/7]

QVector2D::QVector2D ( const QVector4D vector)
explicit

Constructs a vector with x and y coordinates from a 3D vector.

The z and w coordinates of vector are dropped.

See also
toVector4D()

Definition at line 134 of file qvector2d.cpp.

135 {
136  xp = vector.xp;
137  yp = vector.yp;
138 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector4d.h:129
float yp
Definition: qvector2d.h:121
float xp
Definition: qvector4d.h:129

◆ QVector2D() [7/7]

QVector2D::QVector2D ( float  xpos,
float  ypos,
int  dummy 
)
inlineprivate

Definition at line 133 of file qvector2d.h.

133 : xp(xpos), yp(ypos) {}
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

Functions

◆ dotProduct()

qreal QVector2D::dotProduct ( const QVector2D v1,
const QVector2D v2 
)
static

Returns the dot product of v1 and v2.

Definition at line 311 of file qvector2d.cpp.

312 {
313  return v1.xp * v2.xp + v1.yp * v2.yp;
314 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ isNull()

bool QVector2D::isNull ( ) const
inline

Returns true if the x and y coordinates are set to 0.

0, otherwise returns false.

Definition at line 141 of file qvector2d.h.

142 {
143  return qIsNull(xp) && qIsNull(yp);
144 }
float xp
Definition: qvector2d.h:121
static bool qIsNull(double d)
Definition: qglobal.h:2061
float yp
Definition: qvector2d.h:121

◆ length()

qreal QVector2D::length ( ) const

Returns the length of the vector from the origin.

See also
lengthSquared(), normalized()

Definition at line 201 of file qvector2d.cpp.

202 {
203  return qSqrt(xp * xp + yp * yp);
204 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
qreal qSqrt(qreal v)
Definition: qmath.h:205

◆ lengthSquared()

qreal QVector2D::lengthSquared ( ) const

Returns the squared length of the vector from the origin.

This is equivalent to the dot product of the vector with itself.

See also
length(), dotProduct()

Definition at line 212 of file qvector2d.cpp.

213 {
214  return xp * xp + yp * yp;
215 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ normalize()

void QVector2D::normalize ( )

Normalizes the currect vector in place.

Nothing happens if this vector is a null vector or the length of the vector is very close to 1.

See also
length(), normalized()

Definition at line 245 of file qvector2d.cpp.

246 {
247  // Need some extra precision if the length is very small.
248  double len = double(xp) * double(xp) +
249  double(yp) * double(yp);
250  if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
251  return;
252 
253  len = qSqrt(len);
254 
255  xp /= len;
256  yp /= len;
257 }
float xp
Definition: qvector2d.h:121
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
float yp
Definition: qvector2d.h:121
qreal qSqrt(qreal v)
Definition: qmath.h:205

◆ normalized()

QVector2D QVector2D::normalized ( ) const

Returns the normalized unit vector form of this vector.

If this vector is null, then a null vector is returned. If the length of the vector is very close to 1, then the vector will be returned as-is. Otherwise the normalized form of the vector of length 1 will be returned.

See also
length(), normalize()

Definition at line 226 of file qvector2d.cpp.

227 {
228  // Need some extra precision if the length is very small.
229  double len = double(xp) * double(xp) +
230  double(yp) * double(yp);
231  if (qFuzzyIsNull(len - 1.0f))
232  return *this;
233  else if (!qFuzzyIsNull(len))
234  return *this / qSqrt(len);
235  else
236  return QVector2D();
237 }
float xp
Definition: qvector2d.h:121
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
float yp
Definition: qvector2d.h:121
qreal qSqrt(qreal v)
Definition: qmath.h:205
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator QVariant()

QVector2D::operator QVariant ( ) const

Returns the 2D vector as a QVariant.

Definition at line 481 of file qvector2d.cpp.

482 {
483  return QVariant(QVariant::Vector2D, this);
484 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92

◆ operator*=() [1/2]

QVector2D & QVector2D::operator*= ( qreal  factor)
inline

Multiplies this vector's coordinates by the given factor, and returns a reference to this vector.

See also
operator/=()

Definition at line 166 of file qvector2d.h.

167 {
168  xp *= factor;
169  yp *= factor;
170  return *this;
171 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator*=() [2/2]

QVector2D & QVector2D::operator*= ( const QVector2D vector)
inline

Multiplies the components of this vector by the corresponding components in vector.

Definition at line 173 of file qvector2d.h.

174 {
175  xp *= vector.xp;
176  yp *= vector.yp;
177  return *this;
178 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator+=()

QVector2D & QVector2D::operator+= ( const QVector2D vector)
inline

Adds the given vector to this vector and returns a reference to this vector.

See also
operator-=()

Definition at line 152 of file qvector2d.h.

153 {
154  xp += vector.xp;
155  yp += vector.yp;
156  return *this;
157 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator-=()

QVector2D & QVector2D::operator-= ( const QVector2D vector)
inline

Subtracts the given vector from this vector and returns a reference to this vector.

See also
operator+=()

Definition at line 159 of file qvector2d.h.

160 {
161  xp -= vector.xp;
162  yp -= vector.yp;
163  return *this;
164 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator/=()

QVector2D & QVector2D::operator/= ( qreal  divisor)
inline

Divides this vector's coordinates by the given divisor, and returns a reference to this vector.

See also
operator*=()

Definition at line 180 of file qvector2d.h.

181 {
182  xp /= divisor;
183  yp /= divisor;
184  return *this;
185 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ setX()

void QVector2D::setX ( qreal  x)
inline

Sets the x coordinate of this point to the given x coordinate.

See also
x(), setY()

Definition at line 149 of file qvector2d.h.

Referenced by operator>>(), and QDeclarativeVector2DValueType::setX().

149 { xp = aX; }
float xp
Definition: qvector2d.h:121

◆ setY()

void QVector2D::setY ( qreal  y)
inline

Sets the y coordinate of this point to the given y coordinate.

See also
y(), setX()

Definition at line 150 of file qvector2d.h.

Referenced by operator>>(), and QDeclarativeVector2DValueType::setY().

150 { yp = aY; }
float yp
Definition: qvector2d.h:121

◆ toPoint()

QPoint QVector2D::toPoint ( ) const
inline

Returns the QPoint form of this 2D vector.

See also
toPointF(), toVector3D()

Definition at line 237 of file qvector2d.h.

238 {
239  return QPoint(qRound(xp), qRound(yp));
240 }
float xp
Definition: qvector2d.h:121
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
float yp
Definition: qvector2d.h:121
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ toPointF()

QPointF QVector2D::toPointF ( ) const
inline

Returns the QPointF form of this 2D vector.

See also
toPoint(), toVector3D()

Definition at line 242 of file qvector2d.h.

243 {
244  return QPointF(qreal(xp), qreal(yp));
245 }
double qreal
Definition: qglobal.h:1193
float xp
Definition: qvector2d.h:121
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
float yp
Definition: qvector2d.h:121

◆ toVector3D()

QVector3D QVector2D::toVector3D ( ) const

Returns the 3D form of this 2D vector, with the z coordinate set to zero.

See also
toVector4D(), toPoint()

Definition at line 435 of file qvector2d.cpp.

436 {
437  return QVector3D(xp, yp, 0.0f, 1);
438 }
float xp
Definition: qvector2d.h:121
friend class QVector3D
Definition: qvector2d.h:125
float yp
Definition: qvector2d.h:121

◆ toVector4D()

QVector4D QVector2D::toVector4D ( ) const

Returns the 4D form of this 2D vector, with the z and w coordinates set to zero.

See also
toVector3D(), toPoint()

Definition at line 449 of file qvector2d.cpp.

450 {
451  return QVector4D(xp, yp, 0.0f, 0.0f, 1);
452 }
float xp
Definition: qvector2d.h:121
friend class QVector4D
Definition: qvector2d.h:126
float yp
Definition: qvector2d.h:121

◆ x()

qreal QVector2D::x ( ) const
inline

Returns the x coordinate of this point.

See also
setX(), y()

Definition at line 146 of file qvector2d.h.

Referenced by operator<<(), operator>>(), and QDeclarativeVector2DValueType::setValue().

146 { return qreal(xp); }
double qreal
Definition: qglobal.h:1193
float xp
Definition: qvector2d.h:121

◆ y()

qreal QVector2D::y ( ) const
inline

Returns the y coordinate of this point.

See also
setY(), x()

Definition at line 147 of file qvector2d.h.

Referenced by operator<<(), operator>>(), and QDeclarativeVector2DValueType::setValue().

147 { return qreal(yp); }
double qreal
Definition: qglobal.h:1193
float yp
Definition: qvector2d.h:121

Friends and Related Functions

◆ operator!=

bool operator!= ( const QVector2D v1,
const QVector2D v2 
)
friend

Returns true if v1 is not equal to v2; otherwise returns false.

This operator uses an exact floating-point comparison.

Definition at line 192 of file qvector2d.h.

193 {
194  return v1.xp != v2.xp || v1.yp != v2.yp;
195 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator* [1/3]

const QVector2D operator* ( qreal  factor,
const QVector2D vector 
)
friend

Returns a copy of the given vector, multiplied by the given factor.

See also
QVector2D::operator*=()

Definition at line 207 of file qvector2d.h.

208 {
209  return QVector2D(vector.xp * factor, vector.yp * factor, 1);
210 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator* [2/3]

const QVector2D operator* ( const QVector2D vector,
qreal  factor 
)
friend

Returns a copy of the given vector, multiplied by the given factor.

See also
QVector2D::operator*=()

Definition at line 212 of file qvector2d.h.

213 {
214  return QVector2D(vector.xp * factor, vector.yp * factor, 1);
215 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator* [3/3]

const QVector2D operator* ( const QVector2D v1,
const QVector2D v2 
)
friend

Multiplies the components of v1 by the corresponding components in v2.

Definition at line 217 of file qvector2d.h.

218 {
219  return QVector2D(v1.xp * v2.xp, v1.yp * v2.yp, 1);
220 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator+

const QVector2D operator+ ( const QVector2D v1,
const QVector2D v2 
)
friend

Returns a QVector2D object that is the sum of the given vectors, v1 and v2; each component is added separately.

See also
QVector2D::operator+=()

Definition at line 197 of file qvector2d.h.

198 {
199  return QVector2D(v1.xp + v2.xp, v1.yp + v2.yp, 1);
200 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator- [1/2]

const QVector2D operator- ( const QVector2D v1,
const QVector2D v2 
)
friend

Returns a QVector2D object that is formed by subtracting v2 from v1; each component is subtracted separately.

See also
QVector2D::operator-=()

Definition at line 202 of file qvector2d.h.

203 {
204  return QVector2D(v1.xp - v2.xp, v1.yp - v2.yp, 1);
205 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator- [2/2]

const QVector2D operator- ( const QVector2D vector)
friend

Returns a QVector2D object that is formed by changing the sign of the components of the given vector.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to {QVector2D(0,0) - vector}.

Definition at line 222 of file qvector2d.h.

223 {
224  return QVector2D(-vector.xp, -vector.yp, 1);
225 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator/

const QVector2D operator/ ( const QVector2D vector,
qreal  divisor 
)
friend

Returns the QVector2D object formed by dividing all three components of the given vector by the given divisor.

See also
QVector2D::operator/=()

Definition at line 227 of file qvector2d.h.

228 {
229  return QVector2D(vector.xp / divisor, vector.yp / divisor, 1);
230 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121
QVector2D()
Constructs a null vector, i.
Definition: qvector2d.h:131

◆ operator<<()

QDataStream & operator<< ( QDataStream stream,
const QVector2D vector 
)
related

Writes the given vector to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 511 of file qvector2d.cpp.

Referenced by toPointF().

512 {
513  stream << double(vector.x()) << double(vector.y());
514  return stream;
515 }
static FILE * stream
qreal x() const
Returns the x coordinate of this point.
Definition: qvector2d.h:146
qreal y() const
Returns the y coordinate of this point.
Definition: qvector2d.h:147

◆ operator==

bool operator== ( const QVector2D v1,
const QVector2D v2 
)
friend

Returns true if v1 is equal to v2; otherwise returns false.

This operator uses an exact floating-point comparison.

Definition at line 187 of file qvector2d.h.

188 {
189  return v1.xp == v2.xp && v1.yp == v2.yp;
190 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator>>()

QDataStream & operator>> ( QDataStream stream,
QVector2D vector 
)
related

Reads a 2D vector from the given stream into the given vector and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 530 of file qvector2d.cpp.

Referenced by toPointF().

531 {
532  double x, y;
533  stream >> x;
534  stream >> y;
535  vector.setX(qreal(x));
536  vector.setY(qreal(y));
537  return stream;
538 }
double qreal
Definition: qglobal.h:1193
void setX(qreal x)
Sets the x coordinate of this point to the given x coordinate.
Definition: qvector2d.h:149
static FILE * stream
qreal x() const
Returns the x coordinate of this point.
Definition: qvector2d.h:146
void setY(qreal y)
Sets the y coordinate of this point to the given y coordinate.
Definition: qvector2d.h:150
qreal y() const
Returns the y coordinate of this point.
Definition: qvector2d.h:147

◆ qFuzzyCompare

bool qFuzzyCompare ( const QVector2D v1,
const QVector2D v2 
)
friend

Returns true if v1 and v2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.

Definition at line 232 of file qvector2d.h.

Referenced by qFuzzyCompare().

233 {
234  return qFuzzyCompare(v1.xp, v2.xp) && qFuzzyCompare(v1.yp, v2.yp);
235 }
float xp
Definition: qvector2d.h:121
friend bool qFuzzyCompare(const QVector2D &v1, const QVector2D &v2)
Returns true if v1 and v2 are equal, allowing for a small fuzziness factor for floating-point compari...
Definition: qvector2d.h:232
float yp
Definition: qvector2d.h:121

◆ QVector3D

friend class QVector3D
friend

Definition at line 125 of file qvector2d.h.

Referenced by toVector3D().

◆ QVector4D

friend class QVector4D
friend

Definition at line 126 of file qvector2d.h.

Referenced by toVector4D().

Properties

◆ xp

float QVector2D::xp
private

◆ yp

float QVector2D::yp
private

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