OFELI's Logo

An Object Oriented Finite Element Library

To store and treat a triangle. More...

#include <Figure.h>

+ Inheritance diagram for Triangle:

Public Member Functions

 Triangle ()
 Default constructor. More...
 
 Triangle (const Point< real_t > &v1, const Point< real_t > &v2, const Point< real_t > &v3, int code=1)
 Constructor with vertices and code. More...
 
void setVertex1 (const Point< real_t > &v)
 Assign first vertex of triangle.
 
void setVertex2 (const Point< real_t > &v)
 Assign second vertex of triangle.
 
void setVertex3 (const Point< real_t > &v)
 Assign third vertex of triangle.
 
real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance of a given point from the current triangle. More...
 
Triangleoperator+= (Point< real_t > a)
 Operator +=. More...
 
Triangleoperator+= (real_t a)
 Operator *=. More...
 
virtual real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance from a given point to current figure. More...
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points. More...
 
real_t dLine (const Point< real_t > &p, const Point< real_t > &a, const Point< real_t > &b) const
 Compute signed distance from a line. More...
 
- Public Member Functions inherited from Figure
 Figure ()
 Default constructor.
 
 Figure (const Figure &f)
 Copy constructor.
 
virtual ~Figure ()
 Destructor.
 
void setCode (int code)
 Choose a code for the domain defined by the figure.
 
virtual real_t getSignedDistance (const Point< real_t > &p) const
 Return signed distance from a given point to current figure. More...
 
Figureoperator= (const Figure &f)
 Operator =.
 
void getSignedDistance (const Grid &g, Vect< real_t > &d) const
 Calculate signed distance to current figure with respect to grid points. More...
 
real_t dLine (const Point< real_t > &p, const Point< real_t > &a, const Point< real_t > &b) const
 Compute signed distance from a line. More...
 

Detailed Description

To store and treat a triangle.

Constructor & Destructor Documentation

◆ Triangle() [1/2]

Triangle ( )

Default constructor.

Constructs a unit triangle with vertices (0,0), (1,0) and (0,1)

◆ Triangle() [2/2]

Triangle ( const Point< real_t > &  v1,
const Point< real_t > &  v2,
const Point< real_t > &  v3,
int  code = 1 
)

Constructor with vertices and code.

Parameters
[in]v1Coordinates of first vertex of triangle
[in]v2Coordinates of second vertex of triangle
[in]v3Coordinates of third vertex of triangle
[in]codeCode to assign to the generated figure [Default: 1]
Remarks
Vertices must be given in couterclockwise order

Member Function Documentation

◆ dLine()

real_t dLine ( const Point< real_t > &  p,
const Point< real_t > &  a,
const Point< real_t > &  b 
) const

Compute signed distance from a line.

Parameters
[in]pPoint for which distance is computed
[in]aFirst vertex of line
[in]bSecond vertex of line
Returns
Signed distance

◆ getSignedDistance() [1/3]

void getSignedDistance ( const Grid g,
Vect< real_t > &  d 
) const

Calculate signed distance to current figure with respect to grid points.

Parameters
[in]gGrid instance
[in]dVect instance containing calculated distance from each grid index to Figure
Remarks
Vector d doesn't need to be sized before invoking this function

◆ getSignedDistance() [2/3]

virtual real_t getSignedDistance ( const Point< real_t > &  p) const
virtual

Return signed distance from a given point to current figure.

Parameters
[in]pPoint instance from which distance is computed

Reimplemented from Figure.

◆ getSignedDistance() [3/3]

real_t getSignedDistance ( const Point< real_t > &  p) const
virtual

Return signed distance of a given point from the current triangle.

The computed distance is negative if p lies in the triangle, positive if it is outside, and 0 on its boundary

Parameters
[in]pPoint<double> instance

Reimplemented from Figure.

◆ operator+=() [1/2]

Triangle & operator+= ( Point< real_t a)

Operator +=.

Translate triangle by a vector a

◆ operator+=() [2/2]

Triangle & operator+= ( real_t  a)

Operator *=.

Scale triangle by a factor a






Copyright © 1998-2022 Rachid Touzani