1
/***************************************************************************
4
--------------------------------------------------------------------
5
Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6
Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
7
Description : 3D cone class (code from Cone class in QwtPlot3D library with modified destructor)
9
***************************************************************************/
11
/***************************************************************************
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
28
***************************************************************************/
30
#include "qwt3d_color.h"
31
#include "qwt3d_plot.h"
34
using namespace Qwt3D;
36
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38
// Cone3D (code from Cone class in QwtPlot3D library with modified destructor)
40
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
44
hat = gluNewQuadric();
45
disk = gluNewQuadric();
50
Cone3D::Cone3D(double rad, unsigned quality)
52
hat = gluNewQuadric();
53
disk = gluNewQuadric();
55
configure(rad, quality);
62
void Cone3D::configure(double rad, unsigned quality)
69
gluQuadricDrawStyle(hat,GLU_FILL);
70
gluQuadricNormals(hat,GLU_SMOOTH);
71
gluQuadricOrientation(hat,GLU_OUTSIDE);
72
gluQuadricDrawStyle(disk,GLU_FILL);
73
gluQuadricNormals(disk,GLU_SMOOTH);
74
gluQuadricOrientation(disk,GLU_OUTSIDE);
77
void Cone3D::draw(Qwt3D::Triple const& pos)
79
RGBA rgba = (*plot->dataColor())(pos);
80
glColor4d(rgba.r,rgba.g,rgba.b,rgba.a);
83
glGetIntegerv(GL_MATRIX_MODE, &mode);
84
glMatrixMode( GL_MODELVIEW );
87
glTranslatef(pos.x, pos.y, pos.z);
89
gluCylinder(hat, 0.0, radius_, radius_*2, quality_, 1);
90
glTranslatef(0, 0, radius_*2);
91
gluDisk(disk, 0.0, radius_, quality_, 1);