-
Notifications
You must be signed in to change notification settings - Fork 5
/
edge.h
88 lines (65 loc) · 1.6 KB
/
edge.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*!
* @file edge.h
* @brief Edge class
*/
#ifndef __EDGE_H__
#define __EDGE_H__
#include "vertex.h"
#include "face.h"
#include <boost/logic/tribool.hpp>
namespace psalm
{
/*!
* @class edge
* @brief Data for an oriented edge (u,v) of the mesh
*/
class edge
{
public:
edge();
edge(vertex* u, vertex* v);
void set(vertex* u, vertex* v);
vertex* get_u();
const vertex* get_u() const;
vertex* get_v();
const vertex* get_v() const;
void set_u(vertex* u);
void set_v(vertex* v);
void set_f(face* f);
void set_g(face* g);
face* get_f();
const face* get_f() const;
face* get_g();
const face* get_g() const;
/*!
* @brief Pointer to edge point.
*
* Pointer to edge point that corresponds to the current
* edge. This pointer is only set and read during
* subdivision algorithms and must \e not be relied on
* within other functions.
*/
vertex* edge_point;
bool is_on_boundary();
void set_on_boundary(bool boundary = true);
double calc_length() const;
double calc_angle(const edge* e) const;
private:
vertex* u; ///< Pointer to start vertex
vertex* v; ///< Pointer to end vertex
face* f; ///< Pointer to first adjacent face
face* g; ///< Pointer to second adjacent face
boost::logic::tribool boundary; ///< Flag signalling that the edge is a
///< boundary edge
};
/*!
* @returns Length of the edge as the Euclidean distance between its start
* and end vector.
*/
inline double edge::calc_length() const
{
v3ctor d = u->get_position() - v->get_position();
return(d.length()); // XXX: Optimization?
}
} // end of namespace "psalm"
#endif