VICUS Library
Documentation of Vicus library
|
#include <VICUS_GridPlane.h>
Public Member Functions | |
GridPlane ()=default | |
GridPlane (const IBKMK::Vector3D &offset, const IBKMK::Vector3D &normal, const IBKMK::Vector3D &localX, const QColor majorGridColor, double width, double majorGridSpacing) | |
void | readXML (const TiXmlElement *element) |
TiXmlElement * | writeXML (TiXmlElement *parent) const |
void | updateLocalY () |
bool | intersectsLine (const IBKMK::Vector3D &p, const IBKMK::Vector3D &direction, double &t, IBKMK::Vector3D &intersectionPoint) const |
void | closestSnapPoint (const IBKMK::Vector3D &intersectionPoint, IBKMK::Vector3D &snapPoint) const |
Public Attributes | |
QString | m_name |
bool | m_isVisible = true |
bool | m_isActive = true |
IBKMK::Vector3D | m_offset |
IBKMK::Vector3D | m_normal |
IBKMK::Vector3D | m_localX |
QColor | m_color |
double | m_width = 100 |
double | m_spacing = 10 |
Friends | |
class | Vic3D::GridObject |
Contains definition of a single grid plane and related functionality.
A grid plane is defined by the offset (always in the middle), its normal vector and local X vector, that defines the orientation.
The dimension of the grid plane is defined by width (total width) and the major grid spacing. The width is automatically adjusted to hold an even number number of grid spacings. For example, if the grid is defined with a width of 125 m, and grid spacing is 10 m, than the final grid will extend from -70..70 covering a total of 140 m.
The minor grid spacing is computed automatically to be 1/10 of the major grid.
|
default |
VICUS::GridPlane::GridPlane | ( | const IBKMK::Vector3D & | offset, |
const IBKMK::Vector3D & | normal, | ||
const IBKMK::Vector3D & | localX, | ||
const QColor | majorGridColor, | ||
double | width, | ||
double | majorGridSpacing | ||
) |
Initializing constructor, generated grid will be visible and active by default.
void VICUS::GridPlane::closestSnapPoint | ( | const IBKMK::Vector3D & | intersectionPoint, |
IBKMK::Vector3D & | snapPoint | ||
) | const |
Determines the snap point nearest to the intersection point (which must lie on the plane).
intersectionPoint | Point on the plane |
snapPoint | Will hold the snap point on grid nearest to the intersection point |
bool VICUS::GridPlane::intersectsLine | ( | const IBKMK::Vector3D & | p, |
const IBKMK::Vector3D & | direction, | ||
double & | t, | ||
IBKMK::Vector3D & | intersectionPoint | ||
) | const |
Computes intersection point of a line defined by point p and direction with the plane, and also returns the nearest grid snap point. Throws an exception if plane is invalid (null vector).
p | Start point of the line |
direction | Direction vector of the line |
t | Here the scale factor for the line to hit the plane is stored (0...1) |
intersectionPoint | Will hold the point where line hits the surface |
void VICUS::GridPlane::readXML | ( | const TiXmlElement * | element | ) |
void VICUS::GridPlane::updateLocalY | ( | ) |
This function checks for valid normal and localX vectors and updates the cached localY vector. Throws an exception in case of invalid vectors.
TiXmlElement * VICUS::GridPlane::writeXML | ( | TiXmlElement * | parent | ) | const |
|
friend |
QColor VICUS::GridPlane::m_color |
Major grid color (minor grid color is automatically adjusted, either brighter or dimmer depending on current theme)
bool VICUS::GridPlane::m_isActive = true |
True, if grid should be clickable.
bool VICUS::GridPlane::m_isVisible = true |
True, if grid should be shown.
IBKMK::Vector3D VICUS::GridPlane::m_localX |
Local X vector of grid plane, must be perpendicular to m_normal; indicates the orientation of the grid.
QString VICUS::GridPlane::m_name |
Some descriptive name of the grid.
IBKMK::Vector3D VICUS::GridPlane::m_normal |
Normal vector of grid plane, must have magnitude 1 for intersectsLine() function to work.
IBKMK::Vector3D VICUS::GridPlane::m_offset |
Offset vector of grid plane
double VICUS::GridPlane::m_spacing = 10 |
Major grid spacing in [m].
double VICUS::GridPlane::m_width = 100 |
Grid width in [m].