-
Notifications
You must be signed in to change notification settings - Fork 0
/
BezierSurface.h
78 lines (65 loc) · 2.12 KB
/
BezierSurface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//---------------------------------------------------------------------------
#ifndef BezierSurfaceH
#define BezierSurfaceH
//---------------------------------------------------------------------------
#include "GraphicObject.h"
#include "Edge.h"
#include "Vertice.h"
#include "Matrix.h"
#include <cstdlib>
#include <map>
#include "Constants.h"
#include "Object3D.h"
//---------------------------------------------------------------------------
using namespace std;
class Triangle;
class BezierSurface : virtual public Object3D
{
private :
GraphicObject *grid;
vector<Triangle *> surfaceTriangles;
vector<GraphicObject *> surfaceWire;
const unsigned ptsPerUnit;
static Matrix *getU(double, int);
static Matrix *getN(int);
static Matrix *getW(double, int);
static inline long fact(int);
static inline unsigned Binom(int, int);
static inline UnicodeString tagWithName(const wchar_t *, int, int);
bool useFilling;
TSize lastCanvasSize;
float **zBuffer;
void refreshZbuffer(TSize);
public :
BezierSurface(const unsigned, const unsigned, const unsigned, const bool, const bool);
BezierSurface(const BezierSurface&);
~BezierSurface();
void applyTransform(Matrix *);
void applyRotation(const double, const double);
void draw(Graphics::TBitmap *);
void drawTriangle(const Triangle *, TCanvas *, TColor);
bool gridHidden;
TColor frontColor;
TColor backColor;
};
//---------------------------------------------------------------------------
// Helpers
//---------------------------------------------------------------------------
inline UnicodeString BezierSurface::tagWithName(const wchar_t *name, int i, int j)
{
UnicodeString tag = L"";
tag.printf(L"%s{%d;%d}", name, i, j);
return tag;
}
//---------------------------------------------------------------------------
inline long BezierSurface::fact(int n)
{
return n == 0L ? 1L : n * fact (n - 1);
}
//---------------------------------------------------------------------------
inline unsigned BezierSurface::Binom(int n, int i)
{
return fact(n)/(fact(i) * fact(n - i));
}
//---------------------------------------------------------------------------
#endif