-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPNtriangle.h
32 lines (28 loc) · 934 Bytes
/
PNtriangle.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
#pragma once
#include "typedefs.h"
#include <math.h>
#define GL_SILENCE_DEPRECATION
#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
class PNtriangle
{
// Координаты и нормали обыкновенного треугольника
Point_3 p300, p030, p003;
Point_3 n200, n020, n002;
// Дополнительные координаты и нормали
Point_3 p210, p120, p201, p102, p021, p012, p111;
Point_3 n110, n011, n101;
int tessellationLevel;
void calcPNcoefs();
Point_3 pointFromBarycentric(double u, double v, double w);
Point_3 normalFromBarycentric(double u, double v, double w);
void drawPoint(double u, double v, double w);
public:
PNtriangle(Point_3 p1, Point_3 p2, Point_3 p3,
Point_3 n1, Point_3 n2, Point_3 n3, int tessellationLevel = 0);
PNtriangle(Point_3 p1, Point_3 p2, Point_3 p3, int tessellationLevel = 0);
void drawTriangle();
};