libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
BaseLib::Math::Triangle Class Reference

Class defining a triangle. More...

#include <Math.h>

Public Member Functions

 Triangle ()
 
 Triangle (const Point2D &a, const Point2D &b, const Point2D &c)
 
virtual ~Triangle ()
 
Point2D getA () const
 
void setA (Point2D value)
 
void setA (Point2D &value)
 
Point2D getB () const
 
void setB (Point2D value)
 
void setB (Point2D &value)
 
Point2D getC () const
 
void setC (Point2D value)
 
void setC (Point2D &value)
 
double distance (const Point2D &p, Point2D *closestPoint=nullptr)
 Calculates the distance of a point to the triangle. More...
 

Protected Attributes

Point2D _a
 
Point2D _b
 
Point2D _c
 

Detailed Description

Class defining a triangle.

Constructor & Destructor Documentation

§ Triangle() [1/2]

BaseLib::Math::Triangle::Triangle ( )
inline

§ Triangle() [2/2]

BaseLib::Math::Triangle::Triangle ( const Point2D a,
const Point2D b,
const Point2D c 
)
inline

§ ~Triangle()

virtual BaseLib::Math::Triangle::~Triangle ( )
inlinevirtual

Member Function Documentation

§ distance()

double BaseLib::Math::Triangle::distance ( const Point2D p,
Point2D closestPoint = nullptr 
)

Calculates the distance of a point to the triangle.

See also
Flash example by mutantleg
Parameters
[in]pThe point to check.
[out]closestPoint(default nullptr) When specified, the closest point in/on the triangle is stored in this variable.
Returns
Returns the squared distance or 0 if the point is within the triangle.

§ getA()

Point2D BaseLib::Math::Triangle::getA ( ) const
inline

§ getB()

Point2D BaseLib::Math::Triangle::getB ( ) const
inline

§ getC()

Point2D BaseLib::Math::Triangle::getC ( ) const
inline

§ setA() [1/2]

void BaseLib::Math::Triangle::setA ( Point2D  value)
inline

§ setA() [2/2]

void BaseLib::Math::Triangle::setA ( Point2D value)
inline

§ setB() [1/2]

void BaseLib::Math::Triangle::setB ( Point2D  value)
inline

§ setB() [2/2]

void BaseLib::Math::Triangle::setB ( Point2D value)
inline

§ setC() [1/2]

void BaseLib::Math::Triangle::setC ( Point2D  value)
inline

§ setC() [2/2]

void BaseLib::Math::Triangle::setC ( Point2D value)
inline

Member Data Documentation

§ _a

Point2D BaseLib::Math::Triangle::_a
protected

§ _b

Point2D BaseLib::Math::Triangle::_b
protected

§ _c

Point2D BaseLib::Math::Triangle::_c
protected

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