ESyS-Particle
2.2
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Triangle.h
Go to the documentation of this file.
1
2
// //
3
// Copyright (c) 2003-2013 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
#ifndef __TRIANGLE_H
14
#define __TRIANGLE_H
15
16
17
//-- Project includes --
18
#include "
Foundation/vec3.h
"
19
#include "
Foundation/Matrix3.h
"
20
21
//-- STL includes --
22
#include <utility>
23
using
std::pair;
24
using
std::make_pair;
25
26
//-- IO includes --
27
#include <iostream>
28
using
std::ostream;
29
31
class
TriangleError
32
{
33
public
:
34
TriangleError
(){};
35
};
36
37
47
class
Triangle
48
{
49
public
:
// types
50
typedef
Vec3
(
Triangle
::*
VectorFieldFunction
)()
const
;
51
typedef
double (
Triangle
::*
ScalarFieldFunction
)()
const
;
52
53
private
:
54
Matrix3
m_invtrans
;
55
Matrix3
m_trans
;
56
Vec3
m_p0
,
m_p1
,
m_p2
;
57
Vec3
m_normal
;
58
Vec3
m_force
;
59
int
m_id0
,
m_id1
,
m_id2
;
60
int
m_tri_id
,
m_tag
;
61
62
double
EdgeSep
(
const
Vec3
&,
const
Vec3
& ,
const
Vec3
& )
const
;
63
64
public
:
65
Triangle
(
int
,
int
,
int
,
const
Vec3
&,
const
Vec3
&,
const
Vec3
&,
int
,
int
);
66
67
double
sep
(
const
Vec3
&)
const
;
68
pair<bool,double>
dist
(
const
Vec3
&)
const
;
// signed separation according to direction of the normal
69
Vec3
getBoundingBoxMin
()
const
;
70
Vec3
getBoundingBoxMax
()
const
;
71
Vec3
getNormal
()
const
{
return
m_normal
;};
72
Vec3
toGlobal
(
const
Vec3
&);
73
Vec3
toLocal
(
const
Vec3
&);
74
bool
containsEdge
(
const
Vec3
&,
const
Vec3
&)
const
;
75
void
moveNode
(
int
,
const
Vec3
&);
76
void
move
(
const
Vec3
&);
77
inline
int
getID
()
const
{
return
m_tri_id
;};
78
inline
int
getTag
()
const
{
return
m_tag
;};
79
inline
void
applyForce
(
const
Vec3
& f){
m_force
+=f;};
80
inline
void
zeroForce
(){
m_force
=
Vec3
(0.0,0.0,0.0);};
81
82
// get id/pos pairs for each node -> mainly for checkpointing
83
pair<int,Vec3>
getP0
()
const
{
return
make_pair(
m_id0
,
m_p0
);};
84
pair<int,Vec3>
getP1
()
const
{
return
make_pair(
m_id1
,
m_p0
+
m_p1
);};
85
pair<int,Vec3>
getP2
()
const
{
return
make_pair(
m_id2
,
m_p0
+
m_p2
);};
86
87
// access functions
88
static
VectorFieldFunction
getVectorFieldFunction
(
const
string
&);
89
static
ScalarFieldFunction
getScalarFieldFunction
(
const
string
&);
90
91
Vec3
getForce
()
const
{
return
m_force
;};
92
double
getPressure
()
const
;
93
95
friend
ostream&
operator<<
(ostream&,
const
Triangle
&);
96
};
97
98
#endif //__TRIANGLE_H
Geometry
Triangle.h
Generated on Mon May 6 2013 23:26:30 for ESyS-Particle by
1.8.3.1