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
22class 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 */
33class EXPCL_PANDA_PARAMETRICS NurbsBasisVector {
34public:
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
55private:
56 static LVecBase4 nurbs_blending_function(int order, int i, int j,
57 const PN_stdfloat knots[]);
58
59private:
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
void transpose()
Transposes the basis matrices stored in the vector.
int get_num_segments() const
Returns the number of piecewise continuous segments in the curve.
PN_stdfloat get_start_t() const
Returns the first legal value of t on the curve.
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.
PN_stdfloat get_end_t() const
Returns the last legal value of t on the curve.
int get_order() const
Returns the order of the segments in the curve.
const LMatrix4 & get_basis(int segment) const
Returns the basis matrix associated with the nth segment.
PN_stdfloat get_to(int segment) const
Returns the t value of the end of this segment.
int get_vertex_index(int segment) const
Returns the vertex index of the nth segment.
void clear(int order)
Removes all the segments from the curve.
PN_stdfloat get_from(int segment) const
Returns the t value of the beginning of this segment.
PN_stdfloat scale_t(int segment, PN_stdfloat t) const
Scales the value of t into the range [0, 1] corresponding to [from, to].
This represents a single control vertex in a NurbsEvaluator.
Definition nurbsVertex.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.