Panda3D

Loading...
Searching...
No Matches
nurbsBasisVector.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file nurbsBasisVector.h
10 * @author drose
11 * @date 2002-12-03
12 */
13
14#ifndef NURBSBASISVECTOR_H
15#define NURBSBASISVECTOR_H
16
17#include "pandabase.h"
18#include "luse.h"
19#include "epvector.h"
20#include "pmap.h"
21
22 class NurbsVertex;
23
24/**
25 * This encapsulates a series of matrices that are used to represent the
26 * sequential segments of a NurbsCurveEvaluator.
27 *
28 * This is not related to NurbsCurve, CubicCurveseg or any of the
29 * ParametricCurve-derived objects in this module. It is a completely
30 * parallel implementation of NURBS curves, and will probably eventually
31 * replace the whole ParametricCurve class hierarchy.
32 */
33 class EXPCL_PANDA_PARAMETRICS NurbsBasisVector {
34 public:
35 INLINE NurbsBasisVector();
36 INLINE ~NurbsBasisVector();
37
38 INLINE int get_order() const;
39
40 INLINE int get_num_segments() const;
41 INLINE PN_stdfloat get_start_t() const;
42 INLINE PN_stdfloat get_end_t() const;
43
44 INLINE int get_vertex_index(int segment) const;
45 INLINE PN_stdfloat get_from(int segment) const;
46 INLINE PN_stdfloat get_to(int segment) const;
47 INLINE const LMatrix4 &get_basis(int segment) const;
48 INLINE PN_stdfloat scale_t(int segment, PN_stdfloat t) const;
49
50 void clear(int order);
51 void append_segment(int vertex_index, const PN_stdfloat knots[]);
52
53 void transpose();
54
55 private:
56 static LVecBase4 nurbs_blending_function(int order, int i, int j,
57 const PN_stdfloat knots[]);
58
59 private:
60 int _order;
61
62 class Segment {
63 public:
64 int _vertex_index;
65 PN_stdfloat _from;
66 PN_stdfloat _to;
67 LMatrix4 _basis;
68 };
69
70 typedef epvector<Segment> Segments;
71 Segments _segments;
72};
73
74#include "nurbsBasisVector.I"
75
76#endif
NurbsBasisVector::transpose
void transpose()
Transposes the basis matrices stored in the vector.
Definition nurbsBasisVector.cxx:64
NurbsBasisVector::get_num_segments
int get_num_segments() const
Returns the number of piecewise continuous segments in the curve.
Definition nurbsBasisVector.I:41
NurbsBasisVector::get_start_t
PN_stdfloat get_start_t() const
Returns the first legal value of t on the curve.
Definition nurbsBasisVector.I:49
NurbsBasisVector::append_segment
void append_segment(int vertex_index, const PN_stdfloat knots[])
Computes a NURBS basis for one segment of the curve and appends it to the set of basis matrices.
Definition nurbsBasisVector.cxx:30
NurbsBasisVector::get_end_t
PN_stdfloat get_end_t() const
Returns the last legal value of t on the curve.
Definition nurbsBasisVector.I:58
NurbsBasisVector::get_order
int get_order() const
Returns the order of the segments in the curve.
Definition nurbsBasisVector.I:33
NurbsBasisVector::get_basis
const LMatrix4 & get_basis(int segment) const
Returns the basis matrix associated with the nth segment.
Definition nurbsBasisVector.I:98
NurbsBasisVector::get_to
PN_stdfloat get_to(int segment) const
Returns the t value of the end of this segment.
Definition nurbsBasisVector.I:87
NurbsBasisVector::get_vertex_index
int get_vertex_index(int segment) const
Returns the vertex index of the nth segment.
Definition nurbsBasisVector.I:69
NurbsBasisVector::clear
void clear(int order)
Removes all the segments from the curve.
Definition nurbsBasisVector.cxx:20
NurbsBasisVector::get_from
PN_stdfloat get_from(int segment) const
Returns the t value of the beginning of this segment.
Definition nurbsBasisVector.I:78
NurbsBasisVector::scale_t
PN_stdfloat scale_t(int segment, PN_stdfloat t) const
Scales the value of t into the range [0, 1] corresponding to [from, to].
Definition nurbsBasisVector.I:108
NurbsVertex
This represents a single control vertex in a NurbsEvaluator.
Definition nurbsVertex.h:32
epvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
nurbsBasisVector.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pmap.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.