Panda3D
Loading...
Searching...
No Matches
nurbsCurveInterface.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 nurbsCurveInterface.h
10 * @author drose
11 * @date 2001-03-02
12 */
13
14#ifndef NURBSCURVEINTERFACE_H
15#define NURBSCURVEINTERFACE_H
16
17#include "pandabase.h"
18
19#include "luse.h"
20#include "filename.h"
21
22class ParametricCurve;
23
24/**
25 * This abstract class defines the interface only for a Nurbs-style curve,
26 * with knots and coordinates in homogeneous space.
27 *
28 * The NurbsCurve class inherits both from this and from ParametricCurve.
29 */
30class EXPCL_PANDA_PARAMETRICS NurbsCurveInterface {
31PUBLISHED:
32 virtual ~NurbsCurveInterface();
33 virtual void set_order(int order)=0;
34 virtual int get_order() const=0;
35
36 virtual int get_num_cvs() const=0;
37 virtual int get_num_knots() const=0;
38
39 virtual bool insert_cv(PN_stdfloat t)=0;
40
41 INLINE int append_cv(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
42 INLINE int append_cv(const LVecBase3 &v);
43 INLINE int append_cv(const LVecBase4 &v);
44
45 virtual bool remove_cv(int n)=0;
46 virtual void remove_all_cvs()=0;
47
48 INLINE bool set_cv_point(int n, PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
49 INLINE bool set_cv_point(int n, const LVecBase3 &v);
50 INLINE LVecBase3 get_cv_point(int n) const;
51
52 bool set_cv_weight(int n, PN_stdfloat w);
53 INLINE PN_stdfloat get_cv_weight(int n) const;
54
55 virtual bool set_cv(int n, const LVecBase4 &v)=0;
56 virtual LVecBase4 get_cv(int n) const=0;
57
58 virtual bool set_knot(int n, PN_stdfloat t)=0;
59 virtual PN_stdfloat get_knot(int n) const=0;
60
61 MAKE_SEQ(get_cvs, get_num_cvs, get_cv);
62 MAKE_SEQ(get_knots, get_num_knots, get_knot);
63
64 void write_cv(std::ostream &out, int n) const;
65
66protected:
67 virtual int append_cv_impl(const LVecBase4 &v)=0;
68
69 void write(std::ostream &out, int indent_level) const;
70 bool format_egg(std::ostream &out, const std::string &name,
71 const std::string &curve_type, int indent_level) const;
72
73 bool convert_to_nurbs(ParametricCurve *nc) const;
74
75public:
76 static TypeHandle get_class_type() {
77 return _type_handle;
78 }
79 static void init_type() {
80 register_type(_type_handle, "NurbsCurveInterface");
81 }
82
83private:
84 static TypeHandle _type_handle;
85};
86
87#include "nurbsCurveInterface.I"
88
89#endif
This abstract class defines the interface only for a Nurbs-style curve, with knots and coordinates in...
A virtual base class for parametric curves.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...