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