00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020
00021
#ifndef CYLINDER_H
00022
#define CYLINDER_H
00023
00024
#include <vector>
00025
#include <math.h>
00026
00027
#include "../primitives/point.h"
00028
#include "../primitives/vector3D.h"
00029
#include "../primitives/primitive.h"
00030
#include "../interface/utilities.h"
00031
00032
using namespace std;
00033
00035 const int SCALE_FACTOR_SIMPLE = 4;
00036
00038 const int SCALE_FACTOR_PROFILE = 20;
00039
00040
00049 class Cylinder
00050 {
00051
private :
00052
00054 int nbSections;
00055
00057 vector<Point3D *>
points;
00058
00060 vector<int>
facets;
00061
00063 vector<Point3D *>
axis;
00064
00066 vector<Point3D *>
section;
00067
00069 vector<Point3D *>
profile;
00070
00072 bool closedShape;
00073
00075 int twistAngle;
00076
00078
void clearVectors();
00079
00083 vector<Vector3D *>
calculateTangents();
00084
00089
void calculatePoints(vector<Point3D *> &points,
00090
const vector<Vector3D *> &tangents);
00091
00098
void calculateProfilePoints(vector<Point3D *> &points,
00099
const vector<Vector3D *> &tangents,
00100 vector<double> &radius,
00101 vector<int> &indexes);
00102
00106
void calculateFacets(vector<int> &facets);
00107
00108
public :
00109
00111
Cylinder();
00112
00116
Cylinder(
const Cylinder &cyl);
00117
00122
Cylinder(
const vector<Primitive *> &primAxis,
00123
const vector<Primitive *> &primSection);
00124
00130
Cylinder(
const vector<Primitive *> &primAxis,
00131
const vector<Primitive *> &primSection,
00132
const vector<Primitive *> &primProfile);
00133
00134
00135
~Cylinder();
00136
00142
Vector3D *
approximationTangent(
Point3D *pt1,
Point3D *pt2);
00143
00148
void simpleExtrusion(vector<Point3D *> &points,
00149 vector<int> &facets);
00150
00155
void profileExtrusion(vector<Point3D *> &points,
00156 vector<int> &facets);
00157
00161 inline void setClosedSection(
bool closed) {
closedShape = closed;}
00162
00166 inline void setTwist(
int angle) {
twistAngle = angle;}
00167
00168 };
00169
00170
#endif
00171