Revision 3107,
1.1 KB
checked in by mattausch, 16 years ago
(diff) |
added converter for vbo format from ralf
|
Rev | Line | |
---|
[3107] | 1 | #ifndef __SIMPLETRI_H
|
---|
| 2 | #define __SIMPLETRI_H
|
---|
| 3 |
|
---|
| 4 | #include <iostream>
|
---|
| 5 | #include "SimpleVec.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | struct SimpleTri
|
---|
| 9 | {
|
---|
| 10 | SimpleTri() {};
|
---|
| 11 | SimpleTri(const SimpleVec &a, const SimpleVec &b, const SimpleVec &c);
|
---|
| 12 |
|
---|
| 13 | void Init(const SimpleVec &a, const SimpleVec &b, const SimpleVec &c);
|
---|
| 14 |
|
---|
| 15 | SimpleVec GetNormal() const;
|
---|
| 16 |
|
---|
| 17 | SimpleVec GetWorldCenter() const;
|
---|
| 18 |
|
---|
| 19 | float GetSpatialAngle(const SimpleVec &point) const;
|
---|
| 20 |
|
---|
| 21 | float GetArea() const;
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | friend std::ostream& operator<< (std::ostream &s, const SimpleTri &A);
|
---|
| 25 | friend std::istream& operator>> (std::istream &s, SimpleTri &A);
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | ///////////////////
|
---|
| 29 |
|
---|
| 30 | /// the triangle vertices
|
---|
| 31 | SimpleVec mVertices[3];
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | // Overload << operator for C++-style output
|
---|
| 36 | inline std::ostream&
|
---|
| 37 | operator<< (std::ostream &s, const SimpleTri &A)
|
---|
| 38 | {
|
---|
| 39 | return s << "(" << A.mVertices[0] << ", " << A.mVertices[1] << ", " << A.mVertices[2] << ")";
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | // Overload >> operator for C++-style input
|
---|
| 43 | inline std::istream&
|
---|
| 44 | operator>> (std::istream &s, SimpleTri &A)
|
---|
| 45 | {
|
---|
| 46 | char a;
|
---|
| 47 | // read "(x, y, z)"
|
---|
| 48 | return s >> a >> A.mVertices[0] >> a >> A.mVertices[1] >> a >> A.mVertices[2] >> a;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.