Panda3D
subdivSegment.I
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 subdivSegment.I
10  * @author drose
11  * @date 2003-10-14
12  */
13 
14 /**
15  *
16  */
17 INLINE SubdivSegment::
18 SubdivSegment(const double *cint, int f, int t) :
19  _cint(cint),
20  _f(f),
21  _t(t)
22 {
23 }
24 
25 /**
26  * Returns the net score of the segment.
27  */
28 INLINE double SubdivSegment::
29 get_score() const {
30  return _cint[_t] - _cint[_f];
31 }
32 
33 /**
34  * Returns a score that indicates how badly the segment needs to be further
35  * subdivided. The greater the number, the greater the need.
36  */
37 INLINE double SubdivSegment::
38 get_need() const {
39  return get_score() / (double)(_num_cuts+1);
40 }
41 
42 /**
43  * Sorts the segments in descending order of need.
44  */
45 INLINE bool SubdivSegment::
46 operator < (const SubdivSegment &other) const {
47  return get_need() > other.get_need();
48 }
double get_need() const
Returns a score that indicates how badly the segment needs to be further subdivided.
Definition: subdivSegment.I:38
bool operator<(const SubdivSegment &other) const
Sorts the segments in descending order of need.
Definition: subdivSegment.I:46
double get_score() const
Returns the net score of the segment.
Definition: subdivSegment.I:29
Represents a single hypothetical subdivided segment, under consideration by the IsoPlacer.
Definition: subdivSegment.h:25