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