|
@@ -1,4 +1,4 @@
|
|
|
-// Filename: nurbsMatrixVector.I
|
|
|
|
|
|
|
+// Filename: nurbsBasisVector.I
|
|
|
// Created by: drose (04Dec02)
|
|
// Created by: drose (04Dec02)
|
|
|
//
|
|
//
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -18,125 +18,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::Constructor
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::Constructor
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE NurbsMatrixVector::
|
|
|
|
|
-NurbsMatrixVector() {
|
|
|
|
|
|
|
+INLINE NurbsBasisVector::
|
|
|
|
|
+NurbsBasisVector() {
|
|
|
_order = 0;
|
|
_order = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::Destructor
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::Destructor
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE NurbsMatrixVector::
|
|
|
|
|
-~NurbsMatrixVector() {
|
|
|
|
|
|
|
+INLINE NurbsBasisVector::
|
|
|
|
|
+~NurbsBasisVector() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_order
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_order
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the order of the segments in the curve.
|
|
// Description: Returns the order of the segments in the curve.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE int NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE int NurbsBasisVector::
|
|
|
get_order() const {
|
|
get_order() const {
|
|
|
return _order;
|
|
return _order;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_num_segments
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_num_segments
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the number of piecewise continuous segments
|
|
// Description: Returns the number of piecewise continuous segments
|
|
|
// in the curve.
|
|
// in the curve.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE int NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE int NurbsBasisVector::
|
|
|
get_num_segments() const {
|
|
get_num_segments() const {
|
|
|
return _segments.size();
|
|
return _segments.size();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_start_t
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_start_t
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the first legal value of t on the curve.
|
|
// Description: Returns the first legal value of t on the curve.
|
|
|
// Usually this is 0.0.
|
|
// Usually this is 0.0.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE float NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE float NurbsBasisVector::
|
|
|
get_start_t() const {
|
|
get_start_t() const {
|
|
|
nassertr(!_segments.empty(), 0.0f);
|
|
nassertr(!_segments.empty(), 0.0f);
|
|
|
return _segments.front()._from;
|
|
return _segments.front()._from;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_end_t
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_end_t
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the last legal value of t on the curve.
|
|
// Description: Returns the last legal value of t on the curve.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE float NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE float NurbsBasisVector::
|
|
|
get_end_t() const {
|
|
get_end_t() const {
|
|
|
nassertr(!_segments.empty(), 0.0f);
|
|
nassertr(!_segments.empty(), 0.0f);
|
|
|
return _segments.back()._to;
|
|
return _segments.back()._to;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_vertex_index
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_vertex_index
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the vertex index of the nth segment. This is
|
|
// Description: Returns the vertex index of the nth segment. This is
|
|
|
// the index number of the first associated control
|
|
// the index number of the first associated control
|
|
|
// vertex within the source NurbsCurveEvaluator object.
|
|
// vertex within the source NurbsCurveEvaluator object.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE int NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE int NurbsBasisVector::
|
|
|
get_vertex_index(int segment) const {
|
|
get_vertex_index(int segment) const {
|
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0);
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0);
|
|
|
return _segments[segment]._vertex_index;
|
|
return _segments[segment]._vertex_index;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_from
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_from
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the t value of the beginning of this segment.
|
|
// Description: Returns the t value of the beginning of this segment.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE float NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE float NurbsBasisVector::
|
|
|
get_from(int segment) const {
|
|
get_from(int segment) const {
|
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
|
return _segments[segment]._from;
|
|
return _segments[segment]._from;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_to
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_to
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the t value of the end of this segment.
|
|
// Description: Returns the t value of the end of this segment.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE float NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE float NurbsBasisVector::
|
|
|
get_to(int segment) const {
|
|
get_to(int segment) const {
|
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
|
return _segments[segment]._to;
|
|
return _segments[segment]._to;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::get_basis
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::get_basis
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Returns the basis matrix associated with the nth
|
|
// Description: Returns the basis matrix associated with the nth
|
|
|
// segment. This is the pure matrix based on the knot
|
|
// segment. This is the pure matrix based on the knot
|
|
|
// vector over the segment; it does not depend on the
|
|
// vector over the segment; it does not depend on the
|
|
|
// control vertices.
|
|
// control vertices.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE const LMatrix4f &NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE const LMatrix4f &NurbsBasisVector::
|
|
|
get_basis(int segment) const {
|
|
get_basis(int segment) const {
|
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), LMatrix4f::ident_mat());
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), LMatrix4f::ident_mat());
|
|
|
return _segments[segment]._basis;
|
|
return _segments[segment]._basis;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: NurbsMatrixVector::scale_t
|
|
|
|
|
|
|
+// Function: NurbsBasisVector::scale_t
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
// Description: Scales the value of t into the range [0, 1]
|
|
// Description: Scales the value of t into the range [0, 1]
|
|
|
// corresponding to [from, to]. Returns the scaled
|
|
// corresponding to [from, to]. Returns the scaled
|
|
|
// value.
|
|
// value.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-INLINE float NurbsMatrixVector::
|
|
|
|
|
|
|
+INLINE float NurbsBasisVector::
|
|
|
scale_t(int segment, float t) const {
|
|
scale_t(int segment, float t) const {
|
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
nassertr(segment >= 0 && segment < (int)_segments.size(), 0.0f);
|
|
|
float from = _segments[segment]._from;
|
|
float from = _segments[segment]._from;
|