Triangle

Defines a triangle class for easy triangle handling (Includes transformation operator (|))2

[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

AUTHORS
CHANGES LOG
GOALS
USAGE

Class Summary

class Triangle

{
public:
Triangle();
Triangle(const Vector3& a,const Vector3& b,const Vector3& c);
Triangle(const Triangle& tr);
Triangle& operator=(const Triangle& tr);
Vector3 baricenter() const;
Triangle operator+(const Vector3& vec) const;
RigidTrans3 operator|(const Triangle& tr) const
static float area(const Vector3& a,const Vector3& b,const Vector3& c);
static Vector3 sideLengths(const Vector3& a,const Vector3& b,const Vector3& c);
protected:
}; // Triangle

Back to the top of Triangle


AUTHORS

Yevgeny Menaker. (genmen@post.tau.ac.il)

Copyright: SAMBA group, Tel-Aviv Univ. Israel, 2001.

Back to the top of Triangle


CHANGES LOG

Back to the top of Triangle


GOALS

This class simplifies the work with triangle form allowing easy and fast operation with them. The core of this class is transformation operator, which performs 3D transformation, transforming one triangle to fit the second one effectively.

Back to the top of Triangle


USAGE

There are provided three operators: assignment(=), shifting the triangle by Vector3 (+) and transforming operator(|). In addition the Baricenter method is provided to calculate the baricenter of triangle.

A new triangle may be constructed with 3 3D vectors - one for each vertix of triangle

    Vector3 v_A(1.0, 2.0, 3.0);
    Vector3 v_B(1.0, 5.0, 1.0);
    Vector3 v_C(0.0, 2.5, 2.0);

    triangle tr(v_A, v_B, v_C);

You may calculate the baricenter of given triangle:

    Vector3 baricenter = tr.Baricenter();

Shifting of triangle:

	triangle tr2 = tr + Vector3(1.0,1.0,1.0);

And finally the calculation of 3D transformation of two triangles, assuming they can be fit

    RigidTrans3 rt3 = tr | tr2;

    cout << "The transformation is: " << rt3;

Back to the top of Triangle


Triangle();

Default constructor

  Triangle();

Back to the top of Triangle


Triangle(const Vector3& a,const Vector3& b,const Vector3& c);

Constructor with vertices initialization

  Triangle(const Vector3& a,const Vector3& b,const Vector3& c);

Back to the top of Triangle


Triangle(const Triangle& tr);

Copy constructor

  Triangle(const Triangle& tr);

Back to the top of Triangle


Triangle& operator=(const Triangle& tr);

Assignment operator

  Triangle& operator=(const Triangle& tr);

Back to the top of Triangle


Vector3 baricenter() const;

Calculates the Baricenter of the triangle We assume that every vertix of triangle has the same weight (1)

  Vector3 baricenter() const;

Back to the top of Triangle


Triangle operator+(const Vector3& vec) const;

Calculates a shift of Baricenter of triangle (add vector) (doesn't change the object itself)

  Triangle operator+(const Vector3& vec) const;

Back to the top of Triangle


RigidTrans3 operator|(const Triangle& tr) const

Returns a transformation to fit triangle tr onto this triangle

  RigidTrans3 operator|(const Triangle& tr) const                                                                                

Back to the top of Triangle


float area(const Vector3& a,const Vector3& b,const Vector3& c);

returns area of triangle formed by a b c

  static float area(const Vector3& a,const Vector3& b,const Vector3& c);

Back to the top of Triangle


Vector3 sideLengths(const Vector3& a,const Vector3& b,const Vector3& c);

returns side lengths of triangle formed by a b c

  static Vector3 sideLengths(const Vector3& a,const Vector3& b,const Vector3& c);

Back to the top of Triangle


All Members

public:
Triangle& operator=(const Triangle& tr);
Vector3 baricenter() const;
Triangle operator+(const Vector3& vec) const;
RigidTrans3 operator|(const Triangle& tr) const
static float area(const Vector3& a,const Vector3& b,const Vector3& c);
static Vector3 sideLengths(const Vector3& a,const Vector3& b,const Vector3& c);
protected:

Back to the top of Triangle


Ancestors

Class does not inherit from any other class.

Back to the top of Triangle


Descendants

Class is not inherited by any others.

Back to the top of Triangle


Generated from source by the Cocoon utilities on Sun Nov 15 13:35:26 2009 .

Report problems to jkotula@unimax.com