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

#include <VICUS_PlaneGeometry.h>

Classes

struct  Hole
 

Public Member Functions

 PlaneGeometry ()
 
 PlaneGeometry (IBKMK::Polygon2D::type_t t, const IBKMK::Vector3D &a, const IBKMK::Vector3D &b, const IBKMK::Vector3D &c)
 
 PlaneGeometry (const IBKMK::Polygon3D &poly3D)
 
bool isValid () const
 
double inclination (int digits=1) const
 
double orientation (int digits=1) const
 
const VICUS::Polygon3Dpolygon3D () const
 
const IBKMK::Vector3D & offset () const
 
const IBKMK::Vector3D & normal () const
 
const IBKMK::Vector3D & localX () const
 
const IBKMK::Vector3D & localY () const
 
double area (int digits=1) const
 
IBKMK::Vector3D centerPoint () const
 
const IBKMK::Polygon2D & polygon2D () const
 
const std::vector< Hole > & holes () const
 
void setPolygon (const Polygon3D &polygon3D)
 
void setHoles (const std::vector< Hole > &holes)
 
void setGeometry (const Polygon3D &polygon3D, const std::vector< Hole > &holes)
 
void flip ()
 
void changeOrigin (unsigned int idx)
 
const PlaneTriangulationDatatriangulationData () const
 
const PlaneTriangulationDatatriangulationDataWithoutHoles () const
 
const std::vector< PlaneTriangulationData > & holeTriangulationData () const
 
bool intersectsLine (const IBKMK::Vector3D &p1, const IBKMK::Vector3D &d, IBKMK::Vector3D &intersectionPoint, double &dist, int &holeIndex, bool hitBackfacingPlanes=false, bool endlessPlane=false) const
 

Detailed Description

Class PlaneGeometry encapsulates the vertex data and plane type of a single plane in the geometrical model. Its main purpose is the triangulation of the outer polygon (optionally with holes) and the triangulation of the subsurfaces and to provide said data for visualization. Also, it implements intersection tests (for picking).

Since triangulation operations may be costly, the class implements lazy evaluation. Anything setting function that affects the computed triangulation just marks the PlaneGeometry as dirty. The triangulation is then computed on demand the triangulation data is accessed.

Note: PlaneGeometry is a runtime-only class and not used in the VICUS::Project data model. Instead, all data stored in PlaneGeometry is actually held in VICUS::Surface and its member variables.

Constructor & Destructor Documentation

◆ PlaneGeometry() [1/3]

VICUS::PlaneGeometry::PlaneGeometry ( )
inline

Default constructor.

◆ PlaneGeometry() [2/3]

VICUS::PlaneGeometry::PlaneGeometry ( IBKMK::Polygon2D::type_t  t,
const IBKMK::Vector3D &  a,
const IBKMK::Vector3D &  b,
const IBKMK::Vector3D &  c 
)

Initializing constructor. Vertexes a, b and c must be given in counter-clockwise order, so that (b-a) x (c-a) yields the normal vector of the plane.

◆ PlaneGeometry() [3/3]

VICUS::PlaneGeometry::PlaneGeometry ( const IBKMK::Polygon3D &  poly3D)

Convenience constructor, initializes plane geometry with Polygon3D.

Member Function Documentation

◆ area()

double VICUS::PlaneGeometry::area ( int  digits = 1) const

Calculates surface area in m2. Requires valid polygon, otherwise an exception is thrown.

◆ centerPoint()

IBKMK::Vector3D VICUS::PlaneGeometry::centerPoint ( ) const
inline

Calculates the center point of the surface/polygon . Requires valid polygon, otherwise an exception is thrown.

◆ changeOrigin()

void VICUS::PlaneGeometry::changeOrigin ( unsigned int  idx)

◆ flip()

void VICUS::PlaneGeometry::flip ( )

Flips the normal vector of the geometry. Does not require update of triangulation. Requires valid polygon, otherwise an exception is thrown.

◆ holes()

const std::vector< Hole > & VICUS::PlaneGeometry::holes ( ) const
inline

Returns the vector of holes (2D polygons in the plane of the polygon).

◆ holeTriangulationData()

const std::vector< PlaneTriangulationData > & VICUS::PlaneGeometry::holeTriangulationData ( ) const

Returns the triangulation data for each of the holes.

◆ inclination()

double VICUS::PlaneGeometry::inclination ( int  digits = 1) const

Return the inclination in Deg. 0° -> Roof; 90° -> Wall; 180° -> Floor.

◆ intersectsLine()

bool VICUS::PlaneGeometry::intersectsLine ( const IBKMK::Vector3D &  p1,
const IBKMK::Vector3D &  d,
IBKMK::Vector3D &  intersectionPoint,
double &  dist,
int &  holeIndex,
bool  hitBackfacingPlanes = false,
bool  endlessPlane = false 
) const

Tests if a line (with equation p = p1 + t * d) hits this plane. Returns true if intersection is found, and returns the normalized distance (t) between intersection point 'intersectionPoint' and point p1.

The optional argument hitBackfacingPlanes disables the front-facing check (if true). The optional argument endlessPlane disables the check if the intersection point lies within the plane (useful for getting intersections with, for example, the xy-plane).

If plane contains holes, 'holeIndex' contains the index of the respective hole. If the plane does not have any holes or the opaque surface was clicked, holeIndex will be -1.

◆ isValid()

bool VICUS::PlaneGeometry::isValid ( ) const

A polygon is considered "fully valid" for painting, if it has enough vertexes, a valid polygon and can be correctly triangulated (triangles not empty).

◆ localX()

const IBKMK::Vector3D & VICUS::PlaneGeometry::localX ( ) const
inline

◆ localY()

const IBKMK::Vector3D & VICUS::PlaneGeometry::localY ( ) const
inline

◆ normal()

const IBKMK::Vector3D & VICUS::PlaneGeometry::normal ( ) const
inline

◆ offset()

const IBKMK::Vector3D & VICUS::PlaneGeometry::offset ( ) const
inline

Returns the offset point (origin of the plane's local coordinate system)

◆ orientation()

double VICUS::PlaneGeometry::orientation ( int  digits = 1) const

Return the orientation in Deg. 0° -> North; 90° -> East; 180° -> South; etc.

◆ polygon2D()

const IBKMK::Polygon2D & VICUS::PlaneGeometry::polygon2D ( ) const
inline

Returns the 2D polygon (only if it exists) in the plane of the polygon.

◆ polygon3D()

const VICUS::Polygon3D & VICUS::PlaneGeometry::polygon3D ( ) const
inline

◆ setGeometry()

void VICUS::PlaneGeometry::setGeometry ( const Polygon3D polygon3D,
const std::vector< Hole > &  holes 
)

Set outer polygon and holes together (needs only one call to triangulate()).

◆ setHoles()

void VICUS::PlaneGeometry::setHoles ( const std::vector< Hole > &  holes)

Sets the vector of holes (2D polygons in the plane of the polygon).

◆ setPolygon()

void VICUS::PlaneGeometry::setPolygon ( const Polygon3D polygon3D)

Sets the outer polygon alone.

◆ triangulationData()

const PlaneTriangulationData & VICUS::PlaneGeometry::triangulationData ( ) const

Returns the triangulation data for the opaque surface (excluding holes).

◆ triangulationDataWithoutHoles()

const PlaneTriangulationData & VICUS::PlaneGeometry::triangulationDataWithoutHoles ( ) const

Returns the triangulation data for the opaque surface (including holes, as if there were no holes).


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