Panda3D
subdivSegment.I
1 // Filename: subdivSegment.I
2 // Created by: drose (14Oct03)
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: SubdivSegment::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE SubdivSegment::
22 SubdivSegment(const double *cint, int f, int t) :
23  _cint(cint),
24  _f(f),
25  _t(t)
26 {
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function: SubdivSegment::get_score
31 // Access: Public
32 // Description: Returns the net score of the segment.
33 ////////////////////////////////////////////////////////////////////
34 INLINE double SubdivSegment::
35 get_score() const {
36  return _cint[_t] - _cint[_f];
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: SubdivSegment::get_need
41 // Access: Public
42 // Description: Returns a score that indicates how badly the segment
43 // needs to be further subdivided. The greater the
44 // number, the greater the need.
45 ////////////////////////////////////////////////////////////////////
46 INLINE double SubdivSegment::
47 get_need() const {
48  return get_score() / (double)(_num_cuts+1);
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: SubdivSegment::operator <
53 // Access: Public
54 // Description: Sorts the segments in descending order of need.
55 ////////////////////////////////////////////////////////////////////
56 INLINE bool SubdivSegment::
57 operator < (const SubdivSegment &other) const {
58  return get_need() > other.get_need();
59 }
double get_need() const
Returns a score that indicates how badly the segment needs to be further subdivided.
Definition: subdivSegment.I:47
bool operator<(const SubdivSegment &other) const
Sorts the segments in descending order of need.
Definition: subdivSegment.I:57
double get_score() const
Returns the net score of the segment.
Definition: subdivSegment.I:35
Represents a single hypothetical subdivided segment, under consideration by the IsoPlacer.
Definition: subdivSegment.h:27