VICUS Library
Documentation of Vicus library
Loading...
Searching...
No Matches
VICUS::GridPlane Class Reference

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GridPlane() [1/2]

VICUS::GridPlane::GridPlane ( )
default

◆ GridPlane() [2/2]

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.

Member Function Documentation

◆ closestSnapPoint()

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).

Parameters
intersectionPointPoint on the plane
snapPointWill hold the snap point on grid nearest to the intersection point

◆ intersectsLine()

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).

Parameters
pStart point of the line
directionDirection vector of the line
tHere the scale factor for the line to hit the plane is stored (0...1)
intersectionPointWill hold the point where line hits the surface
Returns
Returns true, if an intersection was found, otherwise false. If plane is inactive, function always returns false;

◆ readXML()

void VICUS::GridPlane::readXML ( const TiXmlElement *  element)

◆ updateLocalY()

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.

◆ writeXML()

TiXmlElement * VICUS::GridPlane::writeXML ( TiXmlElement *  parent) const

Friends And Related Symbol Documentation

◆ Vic3D::GridObject

friend class Vic3D::GridObject
friend

Member Data Documentation

◆ m_color

QColor VICUS::GridPlane::m_color

Major grid color (minor grid color is automatically adjusted, either brighter or dimmer depending on current theme)

◆ m_isActive

bool VICUS::GridPlane::m_isActive = true

True, if grid should be clickable.

◆ m_isVisible

bool VICUS::GridPlane::m_isVisible = true

True, if grid should be shown.

◆ m_localX

IBKMK::Vector3D VICUS::GridPlane::m_localX

Local X vector of grid plane, must be perpendicular to m_normal; indicates the orientation of the grid.

◆ m_name

QString VICUS::GridPlane::m_name

Some descriptive name of the grid.

◆ m_normal

IBKMK::Vector3D VICUS::GridPlane::m_normal

Normal vector of grid plane, must have magnitude 1 for intersectsLine() function to work.

◆ m_offset

IBKMK::Vector3D VICUS::GridPlane::m_offset

Offset vector of grid plane

◆ m_spacing

double VICUS::GridPlane::m_spacing = 10

Major grid spacing in [m].

◆ m_width

double VICUS::GridPlane::m_width = 100

Grid width in [m].


The documentation for this class was generated from the following files: