Polyhedral-net Splines
Loading...
Searching...
No Matches
PnSPatch.hpp
1/* copyright(c)Jorg Peters [jorg.peters@gmail.com] */
2
3#pragma once
4
5#include <cstdint>
6#include "PnSPatch_impl.hpp"
7
8struct Patch;
9
20class PnSPatch {
21public:
28
32 ~PnSPatch();
33
38 PnSPatch(const PnSPatch& patch);
39
44 PnSPatch(PnSPatch&& patch) noexcept;
45
51 PnSPatch& operator=(const PnSPatch& a_Other);
52
58 PnSPatch& operator=(PnSPatch&& other) noexcept;
59
68 const double& operator()(uint32_t i, uint32_t j, uint32_t k) const;
69
74 bool isValid() const;
75
81 void degRaise();
82
87 uint32_t getDegreeU() const;
88
93 uint32_t getDegreeV() const;
94
95private:
103
104 friend class PnSpline;
105
108};
109
110
111
113
114inline PnSPatch::PnSPatch(Patch *impl) : impl(PnSPatch_clone(impl)) {}
115
117 PnSPatch_destroy(impl);
118}
119
120inline PnSPatch::PnSPatch(const PnSPatch& patch){
121 impl = PnSPatch_clone(patch.impl);
122}
123
124inline PnSPatch::PnSPatch(PnSPatch&& patch) noexcept : impl(patch.impl) {
125 patch.impl = nullptr;
126}
127
128inline PnSPatch& PnSPatch::operator=(const PnSPatch& a_Other){
129 if (this != &a_Other) {
130 PnSPatch_destroy(impl);
131 impl = PnSPatch_clone(a_Other.impl);
132 }
133 return *this;
134}
135
136inline PnSPatch& PnSPatch::operator=(PnSPatch&& other) noexcept {
137 if (this != &other) {
138 PnSPatch_destroy(impl);
139 impl = other.impl;
140 other.impl = nullptr;
141 }
142 return *this;
143}
144
145inline const double& PnSPatch::operator()(uint32_t i, uint32_t j, uint32_t k) const{
146 return PnSPatch_getValue(impl, i, j, k);
147}
148
149inline bool PnSPatch::isValid() const{
150 return PnSPatch_isValid(impl);
151}
152
153inline void PnSPatch::degRaise(){
154 PnSPatch_degRaise(impl);
155}
156
157inline uint32_t PnSPatch::getDegreeU() const{
158 return PnSPatch_getDegreeU(impl);
159}
160
161inline uint32_t PnSPatch::getDegreeV() const{
162 return PnSPatch_getDegreeV(impl);
163}
void degRaise()
Perform degree elevation on the patch.
Definition PnSPatch.hpp:153
uint32_t getDegreeV() const
Get the polynomial degree in the v-direction.
Definition PnSPatch.hpp:161
~PnSPatch()
Destructor.
Definition PnSPatch.hpp:116
PnSPatch()
Default constructor.
PnSPatch & operator=(const PnSPatch &a_Other)
Copy assignment operator.
Definition PnSPatch.hpp:128
const double & operator()(uint32_t i, uint32_t j, uint32_t k) const
Access Bézier coefficient by index.
Definition PnSPatch.hpp:145
bool isValid() const
Check whether this patch is valid.
Definition PnSPatch.hpp:149
Patch * impl
Opaque pointer to implementation (PIMPL idiom). This is to ensure binary compatibility.
Definition PnSPatch.hpp:107
uint32_t getDegreeU() const
Get the polynomial degree in the u-direction.
Definition PnSPatch.hpp:157
PnSplineImpl * impl
Opaque pointer to implementation (PIMPL idiom). This is to ensure binary compatibility.
Definition PnSpline.hpp:128
A class representing a Bézier patch.
Definition Patch.hpp:20