geirs2Panic  Richard J. Mathar
Fits header keyword batch editor
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Public Attributes | List of all members
Tria2D Class Reference

A triangle represented by the Cartesian coordinates of its three vertices. More...

#include <Tria2D.h>

Collaboration diagram for Tria2D:
Collaboration graph

Public Member Functions

 Tria2D (const Point2D &pt1, const Point2D &pt2, const Point2D &pt3)
 
 Tria2D ()
 
Line2D edge (int no) const
 
double area () const
 
Circle2D circumC () const
 
vector< Tria2Dchop (const Line2D &lin) const
 
vector< Tria2Dintersect (const Tria2D &oth) const
 Compute the common portion (intersection) between this and another triangle. More...
 
vector< Tria2Dintersect (const Square2D &oth) const
 Compute the common area (intersection) between this and a square. More...
 

Public Attributes

Point2D vert [3]
 The three points at the vertices. More...
 

Detailed Description

A triangle represented by the Cartesian coordinates of its three vertices.

Since
2013-07-03
Author
Richard J. Mathar

Constructor & Destructor Documentation

Tria2D::Tria2D ( const Point2D pt1,
const Point2D pt2,
const Point2D pt3 
)

Create a planar triangle given its three vertices.

Parameters
pt1The first vertex.
pt2The second vertex.
pt3The third vertex.
Tria2D::Tria2D ( )

Create an empty triangle with three vertices all at the origin.

Member Function Documentation

Line2D Tria2D::edge ( int  no) const

Create a line that connects vertex number 'no' with the next vertex along the edge.

Parameters
noThe edge number in the range 0 to 2.
Returns
The line that connects point no with point no+1. Edge 0 connects vertex 0 to 1. Edge 1 connects vertex 1 to 2. Edge 2 connects vertex 2 to 0.
double Tria2D::area ( ) const

Compute the area of the triangle.

Returns
The area of all points within the triangle.
Circle2D Tria2D::circumC ( ) const

Compute the circumcircle.

Returns
The circumcircle. By definition, the perimeter of the circle touches all three vertices of the triangle.
vector< Tria2D > Tria2D::chop ( const Line2D lin) const

Compute the portion of this that is left from the infinite line lin.

Parameters
linThe line that cuts the 2D plane in half.
Returns
The vector of mutually non-intersecting pieces of the subarea of this that is to the left from the line.
vector< Tria2D > Tria2D::intersect ( const Tria2D oth) const

Compute the common portion (intersection) between this and another triangle.


Returns
The vector of mutually non-intersecting pieces of the common area of both triangles. If they do not overlap, the vector is empty.
vector< Tria2D > Tria2D::intersect ( const Square2D oth) const

Compute the common area (intersection) between this and a square.


Returns
The vector of mutually non-intersecting pieces of the common area of both polygons.. If they do not overlap, the vector is empty.

Member Data Documentation

Point2D Tria2D::vert[3]

The three points at the vertices.