Member Function Documentation
QPlane3D::QPlane3D()
Constructs a default plane object. The defining origin() of the plane is set to (0, 0, 0) and the normal() vector is to (1, 0, 0).
QPlane3D::QPlane3D(const QVector3D & point, const QVector3D & normal)
Constructs a new plane, where point lies on the plane, and normal is perpendicular to it. The normal does not have to be normalized. If normal is zero, the behavior of the plane is undefined.
Constructs a new plane defined by the three points p, q, and r. The point p is used as the plane's origin() point, and a normal() is constructed from the cross-product of q - p and r - q.
bool QPlane3D::contains(const QVector3D & point) const
Returns true if point lies in this plane; false otherwise.
bool QPlane3D::contains(const QRay3D & ray) const
Returns true if all of the points on ray lie in this plane; false otherwise.
qreal QPlane3D::distanceTo(const QVector3D & point) const
Returns the distance from this plane to point. The value will be positive if point is above the plane in the direction of normal(), and negative if point is below the plane.
qreal QPlane3D::intersection(const QRay3D & ray) const
Returns the t value at which ray intersects this plane, or not-a-number if there is no intersection.
When the ray intersects this plane, the return value is a parametric value that can be passed to QRay3D::point() to determine the actual intersection point, as shown in the following example:
qreal t = plane.intersection(ray);
QVector3D pt;
if (qIsNaN(t)) {
qWarning("no intersection occurred");
else
pt = ray.point(t);
If the return value is positive, then the QRay3D::origin() of ray begins below the plane and then extends through it. If the return value is negative, then the origin begins above the plane.
There are two failure cases where no single intersection point exists:
- when the ray is parallel to the plane (but does not lie on it)
- the ray lies entirely in the plane (thus every point "intersects")
This method does not distinguish between these two failure cases and simply returns not-a-number for both.
See also intersects().
bool QPlane3D::intersects(const QRay3D & ray) const
Returns true if an intersection of ray with this plane exists; false otherwise.
See also intersection().
QVector3D QPlane3D::normal() const
Returns this plane's normal vector. The default value is (1, 0, 0).
See also setNormal() and origin().
QVector3D QPlane3D::origin() const
Returns this plane's defining origin point. The default value is (0, 0, 0).
See also setOrigin() and normal().
void QPlane3D::setNormal(const QVector3D & value)
Set this plane's normal vector to value. The value does not have to be normalized. If value is zero, the behavior of the plane is undefined.
See also normal() and setOrigin().
void QPlane3D::setOrigin(const QVector3D & value)
Set this plane's defining origin point to value.
See also origin() and setNormal().
void QPlane3D::transform(const QMatrix4x4 & matrix)
Transforms this plane using matrix, replacing origin() and normal() with the transformed versions.
See also transformed().
QPlane3D QPlane3D::transformed(const QMatrix4x4 & matrix) const
Returns a new plane that is formed by transforming origin() and normal() using matrix.
See also transform().
bool QPlane3D::operator!=(const QPlane3D & other)
Returns true if this plane is not the same as other; false otherwise.
See also operator==().
bool QPlane3D::operator==(const QPlane3D & other)
Returns true if this plane is the same as other; false otherwise.
See also operator!=().