Panda3D
Loading...
Searching...
No Matches
eggMorph.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 eggMorph.I
10 * @author drose
11 * @date 1999-01-29
12 */
13
14/**
15 *
16 */
17template<class Parameter>
19EggMorph(const std::string &name, const Parameter &offset)
20 : Namable(name), _offset(offset) {
21}
22
23
24
25/**
26 *
27 */
28template<class Parameter>
29INLINE void EggMorph<Parameter>::
30set_offset(const Parameter &offset) {
31 _offset = offset;
32}
33
34
35/**
36 *
37 */
38template<class Parameter>
39INLINE const Parameter &EggMorph<Parameter>::
40get_offset() const {
41 return _offset;
42}
43
44
45/**
46 *
47 */
48template<class Parameter>
49INLINE bool EggMorph<Parameter>::
50operator < (const EggMorph<Parameter> &other) const {
51 return get_name() < other.get_name();
52}
53
54
55/**
56 *
57 */
58template<class Parameter>
59INLINE bool EggMorph<Parameter>::
60operator == (const EggMorph<Parameter> &other) const {
61 return get_name() == other.get_name();
62}
63
64/**
65 *
66 */
67template<class Parameter>
68INLINE bool EggMorph<Parameter>::
69operator != (const EggMorph<Parameter> &other) const {
70 return !operator == (other);
71}
72
73/**
74 * compare_to() compares a different space than the operator methods, which
75 * only check the name. compare_to() compares the name and the value as well.
76 */
77template<class Parameter>
79compare_to(const EggMorph<Parameter> &other, double threshold) const {
80 int compare = strcmp(get_name().c_str(), other.get_name().c_str());
81 if (compare != 0) {
82 return compare;
83 }
84 return _offset.compare_to(other._offset, threshold);
85}
86
87/**
88 *
89 */
90template<class Parameter>
91INLINE void EggMorph<Parameter>::
92output(std::ostream &out, const std::string &tag, int num_dimensions) const {
93 out << tag << " " << get_name() << " {";
94 for (int i = 0; i < num_dimensions; ++i) {
95 out << " " << MAYBE_ZERO(_offset[i]);
96 }
97 out << " }";
98}
A single <Dxyz> or <Duv> or some such entry.
Definition eggMorph.h:30
int compare_to(const EggMorph< Parameter > &other, double threshold) const
compare_to() compares a different space than the operator methods, which only check the name.
Definition eggMorph.I:79
A base class for all things which can have a name.
Definition namable.h:26