~choreonoid/choreonoid/debian

« back to all changes in this revision

Viewing changes to src/Collision/Opcode/Ice/IceTriList.h

  • Committer: Thomas Moulard
  • Date: 2012-10-23 12:43:24 UTC
  • Revision ID: git-v1:351cf736ad49bc7a9a7b9767dee760a013517a5d
Tags: upstream/1.1.0
ImportedĀ UpstreamĀ versionĀ 1.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
2
/**
 
3
 *      Contains code for a triangle container.
 
4
 *      \file           IceTrilist.h
 
5
 *      \author         Pierre Terdiman
 
6
 *      \date           April, 4, 2000
 
7
 */
 
8
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
9
 
 
10
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
11
// Include Guard
 
12
#ifndef __ICETRILIST_H__
 
13
#define __ICETRILIST_H__
 
14
 
 
15
        class ICEMATHS_API TriList : public Container
 
16
        {
 
17
                public:
 
18
                // Constructor / Destructor
 
19
                                                                TriList()                                       {}
 
20
                                                                ~TriList()                                      {}
 
21
 
 
22
                inline_ udword                  GetNbTriangles()        const   { return GetNbEntries()/9;                      }
 
23
                inline_ Triangle*               GetTriangles()          const   { return (Triangle*)GetEntries();       }
 
24
 
 
25
                                void                    AddTri(const Triangle& tri)
 
26
                                                                {
 
27
                                                                        Add(tri.mVerts[0].x).Add(tri.mVerts[0].y).Add(tri.mVerts[0].z);
 
28
                                                                        Add(tri.mVerts[1].x).Add(tri.mVerts[1].y).Add(tri.mVerts[1].z);
 
29
                                                                        Add(tri.mVerts[2].x).Add(tri.mVerts[2].y).Add(tri.mVerts[2].z);
 
30
                                                                }
 
31
 
 
32
                                void                    AddTri(const Point& p0, const Point& p1, const Point& p2)
 
33
                                                                {
 
34
                                                                        Add(p0.x).Add(p0.y).Add(p0.z);
 
35
                                                                        Add(p1.x).Add(p1.y).Add(p1.z);
 
36
                                                                        Add(p2.x).Add(p2.y).Add(p2.z);
 
37
                                                                }
 
38
        };
 
39
 
 
40
        class ICEMATHS_API TriangleList : public Container
 
41
        {
 
42
                public:
 
43
                // Constructor / Destructor
 
44
                                                                        TriangleList()                          {}
 
45
                                                                        ~TriangleList()                         {}
 
46
 
 
47
                inline_ udword                          GetNbTriangles()        const   { return GetNbEntries()/3;                              }
 
48
                inline_ IndexedTriangle*        GetTriangles()          const   { return (IndexedTriangle*)GetEntries();}
 
49
 
 
50
                                void                            AddTriangle(const IndexedTriangle& tri)
 
51
                                                                        {
 
52
                                                                                Add(tri.mVRef[0]).Add(tri.mVRef[1]).Add(tri.mVRef[2]);
 
53
                                                                        }
 
54
 
 
55
                                void                            AddTriangle(udword vref0, udword vref1, udword vref2)
 
56
                                                                        {
 
57
                                                                                Add(vref0).Add(vref1).Add(vref2);
 
58
                                                                        }
 
59
        };
 
60
 
 
61
#endif //__ICETRILIST_H__