Panda3D
Loading...
Searching...
No Matches
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 */
17INLINE SubdivSegment::
18SubdivSegment(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 */
28INLINE double SubdivSegment::
29get_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 */
37INLINE double SubdivSegment::
38get_need() const {
39 return get_score() / (double)(_num_cuts+1);
40}
41
42/**
43 * Sorts the segments in descending order of need.
44 */
45INLINE bool SubdivSegment::
46operator < (const SubdivSegment &other) const {
47 return get_need() > other.get_need();
48}
Represents a single hypothetical subdivided segment, under consideration by the IsoPlacer.
double get_score() const
Returns the net score of the segment.
bool operator<(const SubdivSegment &other) const
Sorts the segments in descending order of need.
double get_need() const
Returns a score that indicates how badly the segment needs to be further subdivided.