Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QRay3D Class

The QRay3D class defines a directional line in 3D space extending through an origin point. More...

 #include <QRay3D>

This class was introduced in Qt 4.8.

Public Functions

QRay3D()
QRay3D(const QVector3D & origin, const QVector3D & direction)
bool contains(const QVector3D & point) const
bool contains(const QRay3D & ray) const
QVector3D direction() const
qreal distanceTo(const QVector3D & point) const
qreal fromPoint(const QVector3D & point) const
QVector3D origin() const
QVector3D point(qreal t) const
QVector3D project(const QVector3D & vector) const
void setDirection(const QVector3D & direction)
void setOrigin(const QVector3D & value)
void transform(const QMatrix4x4 & matrix)
QRay3D transformed(const QMatrix4x4 & matrix) const
bool operator!=(const QRay3D & other)
bool operator==(const QRay3D & other)

Related Non-Members

bool qFuzzyCompare(const QRay3D & ray1, const QRay3D & ray2)

Detailed Description

The QRay3D class defines a directional line in 3D space extending through an origin point.

A ray is defined by the origin() point and the direction() vector. Rays are infinite in length, extending out from origin() in both directions. If the direction() is zero length, then the behavior of the class is undefined.

A ray can be thought of as a one-dimensional co-ordinate system. If the co-ordinate is t then the origin() point is at t = 0, the point origin() + direction() is at t = 1, and the point origin() - direction() is at t = -1. The point() method can be used to obtain the position of a point within this one-dimensional co-ordinate system. The fromPoint() method can be used to convert a point into a value in this one-dimensional co-ordinate system.

Member Function Documentation

QRay3D::QRay3D()

Construct a default ray with an origin() of (0, 0, 0) and a direction() of (1, 0, 0).

QRay3D::QRay3D(const QVector3D & origin, const QVector3D & direction)

Construct a ray given its defining origin and direction. The direction does not need to be normalized.

To construct a ray that passes through two points, use the following:

 QRay3D thruAB(pointA, pointB - pointA);

bool QRay3D::contains(const QVector3D & point) const

Returns true if point lies on this ray; false otherwise.

bool QRay3D::contains(const QRay3D & ray) const

Returns true if ray lies on this ray; false otherwise. If true, this implies that the two rays are the actually the same, but with different origin() points or an inverted direction().

QVector3D QRay3D::direction() const

Returns the direction vector of this ray. The default value is (1, 0, 0).

See also setDirection() and origin().

qreal QRay3D::distanceTo(const QVector3D & point) const

Returns the minimum distance from this ray to point, or equivalently the length of a line perpendicular to this ray which passes through point. If point is on the ray, then this function will return zero.

See also point().

qreal QRay3D::fromPoint(const QVector3D & point) const

Returns the number of direction() units along the ray from origin() to point. Essentially, this function computes the value t, where point = origin() + t * direction(). If point is not on the ray, then the closest point that is on the ray will be used instead.

If the return value is positive, then point lies in front of the origin() with respect to the direction() vector. If the return value is negative, then point lies behind the origin() with respect to the direction() vector.

See also point() and project().

QVector3D QRay3D::origin() const

Returns the origin of this ray. The default value is (0, 0, 0).

See also setOrigin() and direction().

QVector3D QRay3D::point(qreal t) const

Returns the point on the ray defined by moving t units along the ray in the direction of the direction() vector. Note that t may be negative in which case the point returned will lie behind the origin() point with respect to the direction() vector.

The units for t are defined by direction(). The return value is precisely origin() + t * direction().

See also fromPoint() and distanceTo().

QVector3D QRay3D::project(const QVector3D & vector) const

Returns the projection of vector onto this ray. In the following diagram, the dotted line is the ray, and V is the vector. The return value will be the vector V':

See also fromPoint().

void QRay3D::setDirection(const QVector3D & direction)

Sets the direction vector of this ray to direction.

See also direction() and setOrigin().

void QRay3D::setOrigin(const QVector3D & value)

Sets the origin point of this ray to value.

See also origin() and setDirection().

void QRay3D::transform(const QMatrix4x4 & matrix)

Transforms this ray using matrix, replacing origin() and direction() with the transformed versions.

See also transformed().

QRay3D QRay3D::transformed(const QMatrix4x4 & matrix) const

Returns a new ray that is formed by transforming origin() and direction() using matrix.

See also transform().

bool QRay3D::operator!=(const QRay3D & other)

Returns true if this ray is not the same as other; false otherwise.

See also operator==().

bool QRay3D::operator==(const QRay3D & other)

Returns true if this ray is the same as other; false otherwise.

See also operator!=().

Related Non-Members

bool qFuzzyCompare(const QRay3D & ray1, const QRay3D & ray2)

Returns true if ray1 and ray2 are almost equal; false otherwise.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web