qt opengl stl显示,旋转,放大

这是一个使用Qt库和OpenGL显示、旋转及缩放STL模型的程序。程序包括了多个头文件和源代码,涉及OpenGL窗口、点坐标类、STL文件读取以及Solar Position Algorithm等。主要功能是加载并渲染STL模型,并实现了对模型的交互操作,如旋转和缩放。
摘要由CSDN通过智能技术生成

基于qt的opengl显示slt模型的程序

include “mainwindow.h”

include

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

return a.exec();

}

include “mainwindow.h”

include “ui_mainwindow.h”

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include “openglwindow.h”

include “D:\qt\Qt5.10.0\Tools\mingw530_32\i686-w64-mingw32\include\GL\gl.h”

include

include

include

include

include

include

include

include

include

include

include

include

include

include “point3f.h”

//Point3f::Point3f()
//{

//}
//#pragma once

include”Point3f.h”

Point3f::Point3f():x(0),y(0),z(0)
{
}

Point3f::Point3f(float _x, float _y, float _z) :x(_x), y(_y), z(_z)
{
}

int Point3f::SetParam(float _x, float _y, float _z)
{
x = _x;
y = _y;
z = _z;
return 0;
}

include “readstlfile.h”

//ReadSTLFile::ReadSTLFile()
//{

//}
//#pragma once

include

include

include”Point3f.h”

include

include

include”ReadSTLFile.h”

include

include

using namespace std;

bool ReadSTLFile::ReadFile(const char *cfilename)
{
FILE * pFile;
long lSize;
char* buffer;
size_t result;
qDebug()<<”cfilename”<

include”stdio.h”

include

include “SPA.h”

//#include “stdafx.h”

define PI 3.1415926535897932384626433832795028841971

define SUN_RADIUS 0.26667

define L_COUNT 6

define B_COUNT 2

define R_COUNT 5

define Y_COUNT 63

define L_MAX_SUBCOUNT 64

define B_MAX_SUBCOUNT 5

define R_MAX_SUBCOUNT 40

enum {TERM_A, TERM_B, TERM_C, TERM_COUNT};
enum {TERM_X0, TERM_X1, TERM_X2, TERM_X3, TERM_X4, TERM_X_COUNT};
enum {TERM_PSI_A, TERM_PSI_B, TERM_EPS_C, TERM_EPS_D, TERM_PE_COUNT};
enum {JD_MINUS, JD_ZERO, JD_PLUS, JD_COUNT};
enum {SUN_TRANSIT, SUN_RISE, SUN_SET, SUN_COUNT};

define TERM_Y_COUNT TERM_X_COUNT

const int l_subcount[L_COUNT] = {64,34,20,7,3,1};
const int b_subcount[B_COUNT] = {5,2};
const int r_subcount[R_COUNT] = {40,10,6,2,1};
///
/// Earth Periodic Terms
///
const double L_TERMS[L_COUNT][L_MAX_SUBCOUNT][TERM_COUNT]=
{
{
{175347046.0,0,0},
{3341656.0,4.6692568,6283.07585},
{34894.0,4.6261,12566.1517},
{3497.0,2.7441,5753.3849},
{3418.0,2.8289,3.5231},
{3136.0,3.6277,77713.7715},
{2676.0,4.4181,7860.4194},
{2343.0,6.1352,3930.2097},
{1324.0,0.7425,11506.7698},
{1273.0,2.0371,529.691},
{1199.0,1.1096,1577.3435},
{990,5.233,5884.927},
{902,2.045,26.298},
{857,3.508,398.149},
{780,1.179,5223.694},
{753,2.533,5507.553},
{505,4.583,18849.228},
{492,4.205,775.523},
{357,2.92,0.067},
{317,5.849,11790.629},
{284,1.899,796.298},
{271,0.315,10977.079},
{243,0.345,5486.778},
{206,4.806,2544.314},
{205,1.869,5573.143},
{202,2.458,6069.777},
{156,0.833,213.299},
{132,3.411,2942.463},
{126,1.083,20.775},
{115,0.645,0.98},
{103,0.636,4694.003},
{102,0.976,15720.839},
{102,4.267,7.114},
{99,6.21,2146.17},
{98,0.68,155.42},
{86,5.98,161000.69},
{85,1.3,6275.96},
{85,3.67,71430.7},
{80,1.81,17260.15},
{79,3.04,12036.46},
{75,1.76,5088.63},
{74,3.5,3154.69},
{74,4.68,801.82},
{70,0.83,9437.76},
{62,3.98,8827.39},
{61,1.82,7084.9},
{57,2.78,6286.6},
{56,4.39,14143.5},
{56,3.47,6279.55},
{52,0.19,12139.55},
{52,1.33,1748.02},
{51,0.28,5856.48},
{49,0.49,1194.45},
{41,5.37,8429.24},
{41,2.4,19651.05},
{39,6.17,10447.39},
{37,6.04,10213.29},
{37,2.57,1059.38},
{36,1.71,2352.87},
{36,1.78,6812.77},
{33,0.59,17789.85},
{30,0.44,83996.85},
{30,2.74,1349.87},
{25,3.16,4690.48}
},
{
{628331966747.0,0,0},
{206059.0,2.678235,6283.07585},
{4303.0,2.6351,12566.1517},
{425.0,1.59,3.523},
{119.0,5.796,26.298},
{109.0,2.966,1577.344},
{93,2.59,18849.23},
{72,1.14,529.69},
{68,1.87,398.15},
{67,4.41,5507.55},
{59,2.89,5223.69},
{56,2.17,155.42},
{45,0.4,796.3},
{36,0.47,775.52},
{29,2.65,7.11},
{21,5.34,0.98},
{19,1.85,5486.78},
{19,4.97,213.3},
{17,2.99,6275.96},
{16,0.03,2544.31},
{16,1.43,2146.17},
{15,1.21,10977.08},
{12,2.83,1748.02},
{12,3.26,5088.63},
{12,5.27,1194.45},
{12,2.08,4694},
{11,0.77,553.57},
{10,1.3,6286.6},
{10,4.24,1349.87},
{9,2.7,242.73},
{9,5.64,951.72},
{8,5.3,2352.87},
{6,2.65,9437.76},
{6,4.67,4690.48}
},
{
{52919.0,0,0},
{8720.0,1.0721,6283.0758},
{309.0,0.867,12566.152},
{27,0.05,3.52},
{16,5.19,26.3},
{16,3.68,155.42},
{10,0.76,18849.23},
{9,2.06,77713.77},
{7,0.83,775.52},
{5,4.66,1577.34},
{4,1.03,7.11},
{4,3.44,5573.14},
{3,5.14,796.3},
{3,6.05,5507.55},
{3,1.19,242.73},
{3,6.12,529.69},
{3,0.31,398.15},
{3,2.28,553.57},
{2,4.38,5223.69},
{2,3.75,0.98}
},
{
{289.0,5.844,6283.076},
{35,0,0},
{17,5.49,12566.15},
{3,5.2,155.42},
{1,4.72,3.52},
{1,5.3,18849.23},
{1,5.97,242.73}
},
{
{114.0,3.142,0},
{8,4.13,6283.08},
{1,3.84,12566.15}
},
{
{1,3.14,0}
}
};
const double B_TERMS[B_COUNT][B_MAX_SUBCOUNT][TERM_COUNT]=
{
{
{280.0,3.199,84334.662},
{102.0,5.422,5507.553},
{80,3.88,5223.69},
{44,3.7,2352.87},
{32,4,1577.34}
},
{
{9,3.9,5507.55},
{6,1.73,5223.69}
}
};
const double R_TERMS[R_COUNT][R_MAX_SUBCOUNT][TERM_COUNT]=
{
{
{100013989.0,0,0},
{1670700.0,3.0984635,6283.07585},
{13956.0,3.05525,12566.1517},
{3084.0,5.1985,77713.7715},
{1628.0,1.1739,5753.3849},
{1576.0,2.8469,7860.4194},
{925.0,5.453,11506.77},
{542.0,4.564,3930.21},
{472.0,3.661,5884.927},
{346.0,0.964,5507.553},
{329.0,5.9,5223.694},
{307.0,0.299,5573.143},
{243.0,4.273,11790.629},
{212.0,5.847,1577.344},
{186.0,5.022,10977.079},
{175.0,3.012,18849.228},
{110.0,5.055,5486.778},
{98,0.89,6069.78},
{86,5.69,15720.84},
{86,1.27,161000.69},
{65,0.27,17260.15},
{63,0.92,529.69},
{57,2.01,83996.85},
{56,5.24,71430.7},
{49,3.25,2544.31},
{47,2.58,775.52},
{45,5.54,9437.76},
{43,6.01,6275.96},
{39,5.36,4694},
{38,2.39,8827.39},
{37,0.83,19651.05},
{37,4.9,12139.55},
{36,1.67,12036.46},
{35,1.8

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值