Panda3D
Loading...
Searching...
No Matches
eggMesherEdge.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggMesherEdge.h
10 * @author drose
11 * @date 2005-03-13
12 */
13
14#ifndef EGGMESHEREDGE_H
15#define EGGMESHEREDGE_H
16
17#include "pandabase.h"
18#include "eggVertexPool.h"
19#include "eggVertex.h"
20#include "plist.h"
21
22class EggMesherStrip;
23
24/**
25 * Represents one edge of a triangle, as used by the EggMesher to discover
26 * connected triangles. The edge is actually represented as a pair of vertex
27 * indices into the same vertex pool.
28 */
29class EXPCL_PANDA_EGG EggMesherEdge {
30public:
31 INLINE EggMesherEdge(int vi_a, int vi_b);
32 INLINE EggMesherEdge(const EggMesherEdge &copy);
33
34 void remove(EggMesherStrip *strip);
36
37 INLINE bool contains_vertex(int vi) const;
38
39 INLINE bool matches(const EggMesherEdge &other) const;
40
41 INLINE EggMesherEdge *common_ptr();
42
43 INLINE bool operator == (const EggMesherEdge &other) const;
44 INLINE bool operator != (const EggMesherEdge &other) const;
45 INLINE bool operator < (const EggMesherEdge &other) const;
46
47 INLINE double compute_length(const EggVertexPool *vertex_pool) const;
48 INLINE LVecBase3d compute_box(const EggVertexPool *vertex_pool) const;
49
50 void output(std::ostream &out) const;
51
52 int _vi_a, _vi_b;
53
54 typedef plist<EggMesherStrip *> Strips;
55 Strips _strips;
56 EggMesherEdge *_opposite;
57};
58
59INLINE std::ostream &
60operator << (std::ostream &out, const EggMesherEdge &edge) {
61 edge.output(out);
62 return out;
63}
64
65#include "eggMesherEdge.I"
66
67#endif
Represents one edge of a triangle, as used by the EggMesher to discover connected triangles.
void remove(EggMesherStrip *strip)
Removes an edge from a particular strip.
EggMesherEdge(int vi_a, int vi_b)
Defines an edge as a pair of vertices.
void change_strip(EggMesherStrip *from, EggMesherStrip *to)
Reparents the edge from strip "from" to strip "to".
void output(std::ostream &out) const
Formats the edge for output in some sensible way.
double compute_length(const EggVertexPool *vertex_pool) const
Returns the length of the edge in model units.
bool matches(const EggMesherEdge &other) const
Returns true if this edge represents the same line segment as the other edge, in either direction.
EggMesherEdge * common_ptr()
Returns an arbitrary pointer that is used to represent both this edge and its opposite.
LVecBase3d compute_box(const EggVertexPool *vertex_pool) const
Returns a 3-component vector that represents the lengths of the sides of the smalled axis-aligned box...
bool contains_vertex(int vi) const
Returns true if the edge contains the indicated vertex index, false otherwise.
Represents a triangle strip or quad strip in progress, as assembled by the mesher.
A collection of vertices.
This is our own Panda specialization on the default STL list.
Definition plist.h:35
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.