Brief description of class still missing. More...
#include <Parallelepiped.h>
Public Member Functions | |
void | add (const Point &p) |
double | dx () const |
double | dy () const |
double | dz () const |
bool | includes (const Point &p) const |
bool | includes (double x1, double y1, double z1, double x2, double y2, double z2) const |
bool | includes (const Point &p1, const Point &p2) const |
Parallelepiped () | |
Parallelepiped (const Point &p1, const Point &p2) | |
Parallelepiped (double nx1, double ny1, double nz1, double nx2, double ny2, double nz2) | |
Parallelepiped (const Parallelepiped &o) | |
void | setLimits (double nx1, double ny1, double nz1, double nx2, double ny2, double nz2) |
QList< Point > | vertice () const |
double | x1 () const |
double | x2 () const |
double | y1 () const |
double | y2 () const |
double | z1 () const |
double | z2 () const |
Protected Attributes | |
double | _x1 |
double | _x2 |
double | _y1 |
double | _y2 |
double | _z1 |
double | _z2 |
Brief description of class still missing.
Full description of class still missing
QGpCoreTools::Parallelepiped::Parallelepiped | ( | const Point & | p1, |
const Point & | p2 | ||
) | [inline] |
References setLimits(), QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
{ setLimits(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z()); }
QGpCoreTools::Parallelepiped::Parallelepiped | ( | double | nx1, |
double | ny1, | ||
double | nz1, | ||
double | nx2, | ||
double | ny2, | ||
double | nz2 | ||
) | [inline] |
References setLimits().
{ setLimits(nx1, ny1, nz1, nx2, ny2, nz2); }
void QGpCoreTools::Parallelepiped::add | ( | const Point & | p | ) |
References _x1, _x2, _y1, _y2, _z1, _z2, QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
{ if((p.x()>-INFINITY && p.x()<_x1) || _x1==-INFINITY) _x1=p.x(); if((p.x()<INFINITY && p.x()>_x2) || _x2==INFINITY) _x2=p.x(); if((p.y()>-INFINITY && p.y()<_y1) || _y1==-INFINITY) _y1=p.y(); if((p.y()<INFINITY && p.y()>_y2) || _y2==INFINITY) _y2=p.y(); if((p.z()>-INFINITY && p.z()<_z1) || _z1==-INFINITY) _z1=p.z(); if((p.z()<INFINITY && p.z()>_z2) || _z2==INFINITY) _z2=p.z(); }
double QGpCoreTools::Parallelepiped::dx | ( | ) | const [inline] |
double QGpCoreTools::Parallelepiped::dy | ( | ) | const [inline] |
double QGpCoreTools::Parallelepiped::dz | ( | ) | const [inline] |
bool QGpCoreTools::Parallelepiped::includes | ( | const Point & | p | ) | const |
Tests if the point is inside the rectangle
References _x1, _x2, _y1, _y2, _z1, _z2, TRACE, QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
Referenced by includes(), QGpCoreTools::Segment::includes(), and QGpCoreTools::Segment::intersects().
bool QGpCoreTools::Parallelepiped::includes | ( | double | x1, |
double | y1, | ||
double | z1, | ||
double | x2, | ||
double | y2, | ||
double | z2 | ||
) | const |
Tests if the segment defined by x1, y1, z1 and x2, y2, z2 is inside or crosses the rectangle
References _x1, _x2, _y1, _y2, _z1, _z2, QGpCoreTools::Rect::includes(), TRACE, QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
{ TRACE; if(x1>_x1 && x1<_x2 && y1>_y1 && y1<_y2 && z1>_z1 && z1<_z2) return true; if(x2>_x1 && x2<_x2 && y2>_y1 && y2<_y2 && z2>_z1 && z2<_z2) return true; // p1 is outside, p2 is outside // Try to find one intersection with sides of the rectangle Point u(x2-x1, y2-y1, z2-z1); Point p0(x1, y1, z1); Rect rx(_y1, _z1, _y2, _z2); Rect ry(_x1, _z1, _x2, _z2); Rect rz(_x1, _y1, _x2, _y2); double k; Point p; if(u.x()!=0.0) { k=(_x1-p0.x())/u.x(); p=u*k+p0; if(rx.includes(Point2D(p.y(), p.z()))) return true; k=(_x2-p0.x())/u.x(); p=u*k+p0; if(rx.includes(Point2D(p.y(), p.z()))) return true; } if(u.y()!=0.0) { k=(_y1-p0.y())/u.y(); p=u*k+p0; if(ry.includes(Point2D(p.x(), p.z()))) return true; k=(_y2-p0.y())/u.y(); p=u*k+p0; if(ry.includes(Point2D(p.x(), p.z()))) return true; } if(u.z()!=0.0) { k=(_z1-p0.y())/u.z(); p=u*k+p0; if(rz.includes(Point2D(p.x(), p.y()))) return true; k=(_z2-p0.y())/u.z(); p=u*k+p0; if(rz.includes(Point2D(p.x(), p.y()))) return true; } return false; }
bool QGpCoreTools::Parallelepiped::includes | ( | const Point & | p1, |
const Point & | p2 | ||
) | const [inline] |
References includes(), QGpCoreTools::Point2D::x(), QGpCoreTools::Point2D::y(), and QGpCoreTools::Point::z().
{ return includes(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z()); }
void QGpCoreTools::Parallelepiped::setLimits | ( | double | nx1, |
double | ny1, | ||
double | nz1, | ||
double | nx2, | ||
double | ny2, | ||
double | nz2 | ||
) |
Adjust the top-left-front and the bottom-rigth-back corners to include the points (nx1, ny1, nz1), and (nx2, ny2, nz2).
References _x1, _x2, _y1, _y2, _z1, _z2, and TRACE.
Referenced by Parallelepiped(), and QGpCoreTools::Segment::set().
QList< Point > QGpCoreTools::Parallelepiped::vertice | ( | ) | const |
double QGpCoreTools::Parallelepiped::x1 | ( | ) | const [inline] |
{return _x1;}
double QGpCoreTools::Parallelepiped::x2 | ( | ) | const [inline] |
{return _x2;}
double QGpCoreTools::Parallelepiped::y1 | ( | ) | const [inline] |
{return _y1;}
double QGpCoreTools::Parallelepiped::y2 | ( | ) | const [inline] |
{return _y2;}
double QGpCoreTools::Parallelepiped::z1 | ( | ) | const [inline] |
{return _z1;}
double QGpCoreTools::Parallelepiped::z2 | ( | ) | const [inline] |
{return _z2;}
double QGpCoreTools::Parallelepiped::_x1 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().
double QGpCoreTools::Parallelepiped::_x2 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().
double QGpCoreTools::Parallelepiped::_y1 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().
double QGpCoreTools::Parallelepiped::_y2 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().
double QGpCoreTools::Parallelepiped::_z1 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().
double QGpCoreTools::Parallelepiped::_z2 [protected] |
Referenced by add(), includes(), Parallelepiped(), setLimits(), and vertice().