![]() The vector must have no component that is either zero or NaN. QVector2D &QVector2D:: operator/=( QVector2D vector)ĭivides each component of this vector by the corresponding component of vector and returns a reference to this vector. The divisor must not be either zero or NaN. QVector2D &QVector2D:: operator/=( float divisor)ĭivides this vector's coordinates by the given divisor and returns a reference to this vector. Subtracts the given vector from this vector and returns a reference to this vector. QVector2D &QVector2D:: operator-=( QVector2D vector) QVector2D &QVector2D:: operator+=( QVector2D vector)Īdds the given vector to this vector and returns a reference to this vector. (Its components add up to the dot product of this vector and vector.) Note: This is not a cross product of this vector with vector. Multiplies each component of this vector by the corresponding component of vector and returns a reference to this vector. QVector2D &QVector2D:: operator*=( QVector2D vector) Multiplies this vector's coordinates by the given finite factor and returns a reference to this vector. QVector2D &QVector2D:: operator*=( float factor) QVariant QVector2D:: operator QVariant() const Returns the 4D form of this 2D vector, with the z and w coordinates set to zero. Returns the 3D form of this 2D vector, with the z coordinate set to zero. Returns the QPointF form of this 2D vector. Each coordinate is rounded to the nearest integer. Returns the QPoint form of this 2D vector. Sets the y coordinate of this point to the given finite y coordinate. ![]() Sets the x coordinate of this point to the given finite x coordinate. Otherwise the normalized form of the vector of length 1 will be returned. If the length of the vector is very close to 1, then the vector will be returned as-is. If this vector is null, then a null vector is returned. Returns the normalized unit vector form of this vector. Nothing happens if this vector is a null vector or the length of the vector is very close to 1. This is equivalent to the dot product of the vector with itself. Returns the squared length of the vector from the origin. See also lengthSquared() and normalized(). Returns the length of the vector from the origin. Returns true if the x and y coordinates are set to 0.0, otherwise returns false. float QVector2D:: dotProduct( QVector2D v1, QVector2D v2) Returns the distance from this vertex to a point defined by the vertex point. float QVector2D:: distanceToPoint( QVector2D point) const In that case, the distance from point to this vertex is returned. ![]() If direction is a null vector, then it does not define a line. Returns the distance that this vertex is from a line defined by point and the unit vector direction. float QVector2D:: distanceToLine( QVector2D point, QVector2D direction) const ![]() QVector2D:: QVector2D()Ĭonstructs a null vector, i.e. QVector2D:: QVector2D( float xpos, float ypos)Ĭonstructs a vector with coordinates ( xpos, ypos). QVector2D:: QVector2D( QPoint point)Ĭonstructs a vector with x and y coordinates from a 2D point. QVector2D:: QVector2D( QPointF point)Ĭonstructs a vector with x and y coordinates from a 2D point. QVector2D:: QVector2D( QVector3D vector)Ĭonstructs a vector with x and y coordinates from a 3D vector. The z and w coordinates of vector are dropped. I understand that it is essentially a vector of vectors, but I'm confused about how to insert a new value into one of the "subvectors".Member Function Documentation QVector2D:: QVector2D( QVector4D vector)Ĭonstructs a vector with x and y coordinates from a 3D vector. It's getting difficult wrapping my head around 2D vectors. Currently in my class definition I initialized two vectors:Īnd I declared two functions that I plan to use to make it: So I'm creating a class that implements an adjacency list. Recently on SO: Inserting elements into 2D vector Quick A: Index into the desired sub- vector and call push_back. « Prev Next » Quick Q: How do I add elements to a 2D vector of ints?-StackOverflow
0 Comments
Leave a Reply. |