mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-20 14:10:39 -04:00
NurbsMatrixVector -> NurbsBasisVector
This commit is contained in:
parent
b29c053644
commit
215de0e94e
@ -19,7 +19,7 @@
|
|||||||
nurbsCurveEvaluator.I nurbsCurveEvaluator.h \
|
nurbsCurveEvaluator.I nurbsCurveEvaluator.h \
|
||||||
nurbsCurveInterface.I nurbsCurveInterface.h \
|
nurbsCurveInterface.I nurbsCurveInterface.h \
|
||||||
nurbsCurveResult.I nurbsCurveResult.h \
|
nurbsCurveResult.I nurbsCurveResult.h \
|
||||||
nurbsMatrixVector.I nurbsMatrixVector.h \
|
nurbsBasisVector.I nurbsBasisVector.h \
|
||||||
nurbsVertex.h nurbsVertex.I \
|
nurbsVertex.h nurbsVertex.I \
|
||||||
parametricCurve.h \
|
parametricCurve.h \
|
||||||
parametricCurveCollection.I parametricCurveCollection.h \
|
parametricCurveCollection.I parametricCurveCollection.h \
|
||||||
@ -35,7 +35,7 @@
|
|||||||
nurbsCurveEvaluator.cxx \
|
nurbsCurveEvaluator.cxx \
|
||||||
nurbsCurveResult.cxx \
|
nurbsCurveResult.cxx \
|
||||||
nurbsCurveInterface.cxx \
|
nurbsCurveInterface.cxx \
|
||||||
nurbsMatrixVector.cxx \
|
nurbsBasisVector.cxx \
|
||||||
nurbsVertex.cxx \
|
nurbsVertex.cxx \
|
||||||
parametricCurve.cxx parametricCurveCollection.cxx \
|
parametricCurve.cxx parametricCurveCollection.cxx \
|
||||||
piecewiseCurve.cxx \
|
piecewiseCurve.cxx \
|
||||||
@ -53,7 +53,7 @@
|
|||||||
nurbsCurveEvaluator.I nurbsCurveEvaluator.h \
|
nurbsCurveEvaluator.I nurbsCurveEvaluator.h \
|
||||||
nurbsCurveInterface.I nurbsCurveInterface.h \
|
nurbsCurveInterface.I nurbsCurveInterface.h \
|
||||||
nurbsCurveResult.I nurbsCurveResult.h \
|
nurbsCurveResult.I nurbsCurveResult.h \
|
||||||
nurbsMatrixVector.I nurbsMatrixVector.h \
|
nurbsBasisVector.I nurbsBasisVector.h \
|
||||||
nurbsVertex.h nurbsVertex.I \
|
nurbsVertex.h nurbsVertex.I \
|
||||||
nurbsPPCurve.h \
|
nurbsPPCurve.h \
|
||||||
parametricCurve.h \
|
parametricCurve.h \
|
||||||
|
@ -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::
|
INLINE NurbsBasisVector::
|
||||||
NurbsMatrixVector() {
|
NurbsBasisVector() {
|
||||||
_order = 0;
|
_order = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: NurbsMatrixVector::Destructor
|
// Function: NurbsBasisVector::Destructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE NurbsMatrixVector::
|
INLINE NurbsBasisVector::
|
||||||
~NurbsMatrixVector() {
|
~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;
|
@ -1,4 +1,4 @@
|
|||||||
// Filename: nurbsMatrixVector.cxx
|
// Filename: nurbsBasisVector.cxx
|
||||||
// Created by: drose (03Dec02)
|
// Created by: drose (03Dec02)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -16,26 +16,26 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "nurbsMatrixVector.h"
|
#include "nurbsBasisVector.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: NurbsMatrixVector::clear
|
// Function: NurbsBasisVector::clear
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Removes all the segments from the curve.
|
// Description: Removes all the segments from the curve.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void NurbsMatrixVector::
|
void NurbsBasisVector::
|
||||||
clear(int order) {
|
clear(int order) {
|
||||||
_order = order;
|
_order = order;
|
||||||
_segments.clear();
|
_segments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: NurbsMatrixVector::append_segment
|
// Function: NurbsBasisVector::append_segment
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Computes a NURBS basis for one segment of the curve
|
// Description: Computes a NURBS basis for one segment of the curve
|
||||||
// and appends it to the set of basis matrices.
|
// and appends it to the set of basis matrices.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void NurbsMatrixVector::
|
void NurbsBasisVector::
|
||||||
append_segment(int vertex_index, const float knots[]) {
|
append_segment(int vertex_index, const float knots[]) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -67,12 +67,12 @@ append_segment(int vertex_index, const float knots[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: NurbsMatrixVector::nurbs_blending_function
|
// Function: NurbsBasisVector::nurbs_blending_function
|
||||||
// Access: Private, Static
|
// Access: Private, Static
|
||||||
// Description: Recursively computes the appropriate blending
|
// Description: Recursively computes the appropriate blending
|
||||||
// function for the indicated knot vector.
|
// function for the indicated knot vector.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
LVecBase4f NurbsMatrixVector::
|
LVecBase4f NurbsBasisVector::
|
||||||
nurbs_blending_function(int order, int i, int j, const float knots[]) {
|
nurbs_blending_function(int order, int i, int j, const float knots[]) {
|
||||||
// This is doubly recursive. Ick.
|
// This is doubly recursive. Ick.
|
||||||
LVecBase4f r;
|
LVecBase4f r;
|
@ -1,4 +1,4 @@
|
|||||||
// Filename: nurbsMatrixVector.h
|
// Filename: nurbsBasisVector.h
|
||||||
// Created by: drose (03Dec02)
|
// Created by: drose (03Dec02)
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -16,8 +16,8 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef NURBSMATRIXVECTOR_H
|
#ifndef NURBSBASISVECTOR_H
|
||||||
#define NURBSMATRIXVECTOR_H
|
#define NURBSBASISVECTOR_H
|
||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "luse.h"
|
#include "luse.h"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
class NurbsVertex;
|
class NurbsVertex;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : NurbsMatrixVector
|
// Class : NurbsBasisVector
|
||||||
// Description : This encapsulates a series of matrices that are used
|
// Description : This encapsulates a series of matrices that are used
|
||||||
// to represent the sequential segments of a
|
// to represent the sequential segments of a
|
||||||
// NurbsCurveEvaluator.
|
// NurbsCurveEvaluator.
|
||||||
@ -39,10 +39,10 @@ class NurbsVertex;
|
|||||||
// eventually replace the whole ParametricCurve class
|
// eventually replace the whole ParametricCurve class
|
||||||
// hierarchy.
|
// hierarchy.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class NurbsMatrixVector {
|
class EXPCL_PANDA NurbsBasisVector {
|
||||||
public:
|
public:
|
||||||
INLINE NurbsMatrixVector();
|
INLINE NurbsBasisVector();
|
||||||
INLINE ~NurbsMatrixVector();
|
INLINE ~NurbsBasisVector();
|
||||||
|
|
||||||
INLINE int get_order() const;
|
INLINE int get_order() const;
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ private:
|
|||||||
Segments _segments;
|
Segments _segments;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "nurbsMatrixVector.I"
|
#include "nurbsBasisVector.I"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
#define NURBSCURVEEVALUATOR_H
|
#define NURBSCURVEEVALUATOR_H
|
||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "nurbsMatrixVector.h"
|
#include "nurbsBasisVector.h"
|
||||||
#include "nurbsCurveResult.h"
|
#include "nurbsCurveResult.h"
|
||||||
#include "nurbsVertex.h"
|
#include "nurbsVertex.h"
|
||||||
#include "pointerTo.h"
|
#include "pointerTo.h"
|
||||||
@ -91,7 +91,7 @@ private:
|
|||||||
Knots _knots;
|
Knots _knots;
|
||||||
|
|
||||||
bool _basis_dirty;
|
bool _basis_dirty;
|
||||||
NurbsMatrixVector _basis;
|
NurbsBasisVector _basis;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "nurbsCurveEvaluator.I"
|
#include "nurbsCurveEvaluator.I"
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// and the indicated table of control vertex positions.
|
// and the indicated table of control vertex positions.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
NurbsCurveResult::
|
NurbsCurveResult::
|
||||||
NurbsCurveResult(const NurbsMatrixVector &basis,
|
NurbsCurveResult(const NurbsBasisVector &basis,
|
||||||
const LVecBase4f vecs[], const NurbsVertex *verts,
|
const LVecBase4f vecs[], const NurbsVertex *verts,
|
||||||
int num_vertices) :
|
int num_vertices) :
|
||||||
_basis(basis),
|
_basis(basis),
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "pandabase.h"
|
#include "pandabase.h"
|
||||||
#include "referenceCount.h"
|
#include "referenceCount.h"
|
||||||
#include "nurbsMatrixVector.h"
|
#include "nurbsBasisVector.h"
|
||||||
|
|
||||||
class NurbsVertex;
|
class NurbsVertex;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ class NurbsVertex;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDA NurbsCurveResult : public ReferenceCount {
|
class EXPCL_PANDA NurbsCurveResult : public ReferenceCount {
|
||||||
public:
|
public:
|
||||||
NurbsCurveResult(const NurbsMatrixVector &basis,
|
NurbsCurveResult(const NurbsBasisVector &basis,
|
||||||
const LVecBase4f vecs[], const NurbsVertex *verts,
|
const LVecBase4f vecs[], const NurbsVertex *verts,
|
||||||
int num_vertices);
|
int num_vertices);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ private:
|
|||||||
int find_segment(float t);
|
int find_segment(float t);
|
||||||
int r_find_segment(float t, int top, int bot) const;
|
int r_find_segment(float t, int top, int bot) const;
|
||||||
|
|
||||||
NurbsMatrixVector _basis;
|
NurbsBasisVector _basis;
|
||||||
const NurbsVertex *_verts;
|
const NurbsVertex *_verts;
|
||||||
|
|
||||||
// We pre-compose the basis matrix and the geometry vectors, so we
|
// We pre-compose the basis matrix and the geometry vectors, so we
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
#include "parametricCurveDrawer.cxx"
|
#include "parametricCurveDrawer.cxx"
|
||||||
#include "nurbsCurveEvaluator.cxx"
|
#include "nurbsCurveEvaluator.cxx"
|
||||||
#include "nurbsCurveResult.cxx"
|
#include "nurbsCurveResult.cxx"
|
||||||
#include "nurbsMatrixVector.cxx"
|
#include "nurbsBasisVector.cxx"
|
||||||
#include "nurbsVertex.cxx"
|
#include "nurbsVertex.cxx"
|
||||||
#include "ropeNode.cxx"
|
#include "ropeNode.cxx"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user