00001 // Filename: parametricCurveCollection.I 00002 // Created by: drose (04Mar01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: ParametricCurveCollection::Destructor 00022 // Access: Published 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE ParametricCurveCollection:: 00026 ~ParametricCurveCollection() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: ParametricCurveCollection::get_num_curves 00031 // Access: Published 00032 // Description: Returns the number of ParametricCurves in the collection. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE int ParametricCurveCollection:: 00035 get_num_curves() const { 00036 return _curves.size(); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ParametricCurveCollection::get_curve 00041 // Access: Published 00042 // Description: Returns the nth ParametricCurve in the collection. 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE ParametricCurve *ParametricCurveCollection:: 00045 get_curve(int index) const { 00046 nassertr(index >= 0 && index < (int)_curves.size(), (ParametricCurve *)NULL); 00047 00048 return _curves[index]; 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: ParametricCurveCollection::get_max_t 00053 // Access: Published 00054 // Description: Returns the maximum T value associated with the 00055 // *last* curve in the collection. Normally, this will 00056 // be either the XYZ or HPR curve, or a timewarp curve. 00057 //////////////////////////////////////////////////////////////////// 00058 INLINE float ParametricCurveCollection:: 00059 get_max_t() const { 00060 if (_curves.empty()) { 00061 return 0.0f; 00062 } 00063 return _curves.back()->get_max_t(); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ParametricCurveCollection::evaluate_xyz 00068 // Access: Published 00069 // Description: Computes only the XYZ part of the curves. See 00070 // evaluate(). 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE bool ParametricCurveCollection:: 00073 evaluate_xyz(float t, LVecBase3f &xyz) const { 00074 LVecBase3f hpr; 00075 return evaluate(t, xyz, hpr); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: ParametricCurveCollection::evaluate_hpr 00080 // Access: Published 00081 // Description: Computes only the HPR part of the curves. See 00082 // evaluate(). 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE bool ParametricCurveCollection:: 00085 evaluate_hpr(float t, LVecBase3f &hpr) const { 00086 LVecBase3f xyz; 00087 return evaluate(t, xyz, hpr); 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: ParametricCurveCollection::adjust_xyz 00092 // Access: Published 00093 // Description: Adjust the XYZ curve at the indicated time to the new 00094 // value. The curve shape will change correspondingly. 00095 // Returns true if successful, false if unable to make 00096 // the adjustment for some reason. 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE bool ParametricCurveCollection:: 00099 adjust_xyz(float t, float x, float y, float z) { 00100 return adjust_xyz(t, LVecBase3f(x, y, z)); 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: ParametricCurveCollection::adjust_hpr 00105 // Access: Published 00106 // Description: Adjust the HPR curve at the indicated time to the new 00107 // value. The curve shape will change correspondingly. 00108 // Returns true if successful, false if unable to make 00109 // the adjustment for some reason. 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE bool ParametricCurveCollection:: 00112 adjust_hpr(float t, float h, float p, float r) { 00113 return adjust_hpr(t, LVecBase3f(h, p, r)); 00114 }