Panda3D
nurbsSurfaceResult.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 nurbsSurfaceResult.h
10  * @author drose
11  * @date 2003-10-10
12  */
13 
14 #ifndef NURBSSURFACERESULT_H
15 #define NURBSSURFACERESULT_H
16 
17 #include "pandabase.h"
18 #include "referenceCount.h"
19 #include "nurbsBasisVector.h"
20 #include "epvector.h"
21 
22 class NurbsVertex;
23 
24 /**
25  * The result of a NurbsSurfaceEvaluator. This object represents a surface in
26  * a particular coordinate space. It can return the point and/or normal to
27  * the surface at any point.
28  */
29 class EXPCL_PANDA_PARAMETRICS NurbsSurfaceResult : public ReferenceCount {
30 public:
31  NurbsSurfaceResult(const NurbsBasisVector &u_basis,
32  const NurbsBasisVector &v_basis,
33  const LVecBase4 vecs[], const NurbsVertex *verts,
34  int num_u_vertices, int num_v_vertices);
35 
36 PUBLISHED:
37  INLINE ~NurbsSurfaceResult();
38 
39  INLINE PN_stdfloat get_start_u() const;
40  INLINE PN_stdfloat get_end_u() const;
41 
42  INLINE PN_stdfloat get_start_v() const;
43  INLINE PN_stdfloat get_end_v() const;
44 
45  INLINE bool eval_point(PN_stdfloat u, PN_stdfloat v, LVecBase3 &point);
46  INLINE bool eval_normal(PN_stdfloat u, PN_stdfloat v, LVecBase3 &normal);
47  INLINE PN_stdfloat eval_extended_point(PN_stdfloat u, PN_stdfloat v, int d);
48  INLINE bool eval_extended_points(PN_stdfloat u, PN_stdfloat v, int d,
49  PN_stdfloat result[], int num_values);
50 
51  INLINE int get_num_u_segments() const;
52  INLINE int get_num_v_segments() const;
53  void eval_segment_point(int ui, int vi, PN_stdfloat u, PN_stdfloat v, LVecBase3 &point) const;
54  void eval_segment_normal(int ui, int vi, PN_stdfloat u, PN_stdfloat v, LVecBase3 &normal) const;
55  PN_stdfloat eval_segment_extended_point(int ui, int vi, PN_stdfloat u, PN_stdfloat v, int d) const;
56  void eval_segment_extended_points(int ui, int vi, PN_stdfloat u, PN_stdfloat v, int d,
57  PN_stdfloat result[], int num_values) const;
58  INLINE PN_stdfloat get_segment_u(int ui, PN_stdfloat u) const;
59  INLINE PN_stdfloat get_segment_v(int vi, PN_stdfloat v) const;
60 
61 private:
62  INLINE int verti(int ui, int vi) const;
63  INLINE int segi(int ui, int vi) const;
64 
65  int find_u_segment(PN_stdfloat u);
66  int r_find_u_segment(PN_stdfloat u, int top, int bot) const;
67  int find_v_segment(PN_stdfloat v);
68  int r_find_v_segment(PN_stdfloat v, int top, int bot) const;
69 
70  NurbsBasisVector _u_basis;
71  NurbsBasisVector _v_basis;
72  const NurbsVertex *_verts;
73  int _num_u_vertices;
74  int _num_v_vertices;
75 
76  // We pre-compose the basis matrix and the geometry vectors, so we have
77  // these handy for evaluation. There is one entry in the _composed for each
78  // entry in u_basis._segments * v_basis._segments.
79  class ComposedMats {
80  public:
81  LMatrix4 _x, _y, _z, _w;
82  };
83  typedef epvector<ComposedMats> ComposedGeom;
84  ComposedGeom _composed;
85 
86 
87  int _last_u_segment;
88  PN_stdfloat _last_u_from;
89  PN_stdfloat _last_u_to;
90  int _last_v_segment;
91  PN_stdfloat _last_v_from;
92  PN_stdfloat _last_v_to;
93 };
94 
95 #include "nurbsSurfaceResult.I"
96 
97 #endif
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.
This represents a single control vertex in a NurbsEvaluator.
Definition: nurbsVertex.h:32
This encapsulates a series of matrices that are used to represent the sequential segments of a NurbsC...
The result of a NurbsSurfaceEvaluator.
A base class for all things that want to be reference-counted.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.