Panda3D
eggMesherFanMaker.I
1 // Filename: eggMesherFanMaker.I
2 // Created by: drose (22Mar05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: EggMesherFanMaker::operator <
18 // Access: Public
19 // Description: Provides a unique ordering between different fan
20 // makers based on the leading edge.
21 ////////////////////////////////////////////////////////////////////
22 INLINE bool EggMesherFanMaker::
23 operator < (const EggMesherFanMaker &other) const {
24  nassertr(!_edges.empty() && !other._edges.empty(), false);
25  return _edges.front() < other._edges.front();
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: EggMesherFanMaker::operator !=
30 // Access: Public
31 // Description: Provides a unique ordering between different fan
32 // makers based on the leading edge.
33 ////////////////////////////////////////////////////////////////////
34 INLINE bool EggMesherFanMaker::
35 operator != (const EggMesherFanMaker &other) const {
36  return !operator == (other);
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: EggMesherFanMaker::operator ==
41 // Access: Public
42 // Description: Provides a unique ordering between different fan
43 // makers based on the leading edge.
44 ////////////////////////////////////////////////////////////////////
45 INLINE bool EggMesherFanMaker::
46 operator == (const EggMesherFanMaker &other) const {
47  return _edges.front() == other._edges.front();
48 }
49 
50 ////////////////////////////////////////////////////////////////////
51 // Function: EggMesherFanMaker::is_empty
52 // Access: Public
53 // Description: Returns true if the fan maker has no edges, false
54 // otherwise.
55 ////////////////////////////////////////////////////////////////////
56 INLINE bool EggMesherFanMaker::
57 is_empty() const {
58  return (_edges.empty());
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: EggMesherFanMaker::is_valid
63 // Access: Public
64 // Description: Returns true if the fan maker has enough edges to
65 // define at least one fan, false otherwise.
66 ////////////////////////////////////////////////////////////////////
67 INLINE bool EggMesherFanMaker::
68 is_valid() const {
69  return (_edges.size() > 2);
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: EggMesherFanMaker::is_coplanar_with
74 // Access: Public
75 // Description: Returns true if the strip and the other strip are
76 // coplanar.
77 ////////////////////////////////////////////////////////////////////
78 INLINE bool EggMesherFanMaker::
79 is_coplanar_with(const EggMesherFanMaker &other) const {
80  return _planar && other._planar &&
81  _strips.front()->is_coplanar_with(*other._strips.front(),
82  egg_coplanar_threshold);
83 }
84 
85 INLINE ostream &
86 operator << (ostream &out, const EggMesherFanMaker &fm) {
87  fm.output(out);
88  return out;
89 }
bool operator==(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
This class is used by EggMesher::find_fans() to attempt to make an EggTriangleFan out of the polygons...
bool is_coplanar_with(const EggMesherFanMaker &other) const
Returns true if the strip and the other strip are coplanar.
bool operator<(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
bool is_valid() const
Returns true if the fan maker has enough edges to define at least one fan, false otherwise.
bool operator!=(const EggMesherFanMaker &other) const
Provides a unique ordering between different fan makers based on the leading edge.
bool is_empty() const
Returns true if the fan maker has no edges, false otherwise.