00001 // Filename: nurbsCurveInterface.I 00002 // Created by: drose (02Mar01) 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: NurbsCurveInterface::append_cv 00022 // Access: Published 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE int NurbsCurveInterface:: 00026 append_cv(float x, float y, float z) { 00027 return append_cv(LVecBase3f(x, y, z)); 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: NurbsCurveInterface::append_cv 00032 // Access: Published 00033 // Description: 00034 //////////////////////////////////////////////////////////////////// 00035 INLINE int NurbsCurveInterface:: 00036 append_cv(const LVecBase3f &v) { 00037 return append_cv(LVecBase4f(v[0], v[1], v[2], 1.0f)); 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: NurbsCurveInterface::append_cv 00042 // Access: Published 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE int NurbsCurveInterface:: 00046 append_cv(const LVecBase4f &v) { 00047 return append_cv_impl(v); 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: NurbsCurveInterface::set_cv_point 00052 // Access: Public, Scheme 00053 // Description: Repositions the indicated CV. Returns true if 00054 // successful, false otherwise. 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE bool NurbsCurveInterface:: 00057 set_cv_point(int n, float x, float y, float z) { 00058 return set_cv_point(n, LVecBase3f(x, y, z)); 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: NurbsCurveInterface::set_cv_point 00063 // Access: Public, Scheme 00064 // Description: Repositions the indicated CV. Returns true if 00065 // successful, false otherwise. 00066 //////////////////////////////////////////////////////////////////// 00067 INLINE bool NurbsCurveInterface:: 00068 set_cv_point(int n, const LVecBase3f &v) { 00069 nassertr(n >= 0 && n < get_num_cvs(), false); 00070 return set_cv(n, LVecBase4f(v[0], v[1], v[2], 1.0f) * get_cv_weight(n)); 00071 } 00072 00073 //////////////////////////////////////////////////////////////////// 00074 // Function: NurbsCurveInterface::get_cv_point 00075 // Access: Public, Scheme 00076 // Description: Returns the position of the indicated CV. 00077 //////////////////////////////////////////////////////////////////// 00078 INLINE LVecBase3f NurbsCurveInterface:: 00079 get_cv_point(int n) const { 00080 nassertr(n >= 0 && n < get_num_cvs(), LVecBase3f::zero()); 00081 LVecBase4f p = get_cv(n); 00082 nassertr(p[3] != 0.0f, LVecBase3f::zero()); 00083 return LVecBase3f(p[0], p[1], p[2]) / p[3]; 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function: NurbsCurveInterface::get_cv_weight 00088 // Access: Published 00089 // Description: Returns the weight of the indicated CV. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE float NurbsCurveInterface:: 00092 get_cv_weight(int n) const { 00093 return get_cv(n)[3]; 00094 }