资源简介

使用qwtPlot3D实现三维曲线、轨迹绘制的例子,使用qt基于c++开发,可以直接运行,无需额外配置,里面包含了所有需要的库文件和头文件,弄了好久才弄出来的,我没有在网上找到其他的类似的代码,在一些博主和热心人的帮助下,完成了例子,谢谢他们。希望能对大家有用

资源截图

代码片段和文件信息

#include “line3d.h“
using namespace Qwt3D;
Qwt3D::Line3D::Line3D()
{
    rgba.a = 1;
    rgba.b = 0.3;
    rgba.r = 0.6;
    rgba.g = 1;
}
Qwt3D::Line3D::Line3D(double thickbool smooth)
{
    lineThick = thick;
    smooth_  = smooth;
    rgba.a = 1;
    rgba.b = 0.3;
    rgba.r = 0.6;
    rgba.g = 1;
}


void Qwt3D::Line3D::configure(double thick bool smooth)
{
    lineThick = thick;
    smooth_  = smooth;
}


void Qwt3D::Line3D::drawBegin()
{
    setDeviceLineWidth(lineThick);
    oldstate_ = glIsEnabled(GL_LINE_SMOOTH);
    if (smooth_)
    glEnable(GL_LINE_SMOOTH);
    else
    glDisable(GL_LINE_SMOOTH);
    //glPointSize(10);
    glBegin( GL_LINE_STRIP);

}


void Qwt3D::Line3D::drawEnd()
{
    glEnd();


    if (oldstate_)
    glEnable(GL_LINE_SMOOTH);
    else
    glDisable(GL_LINE_SMOOTH);
}


void Qwt3D::Line3D::draw(Qwt3D::Triple const& pos)
{


    glColor4d(rgba.rrgba.grgba.brgba.a);


    glVertex3d(pos.xpos.ypos.z);

}


void Qwt3D::Line3D::draw()
{
    for (int i = 0; i < lineData.size(); i ++)
    {
         draw(lineData[i]);
    }
}

void Qwt3D::Line3D::rdraw()
{
    for (int i = lineData.size()-1; i >0; i--)
    {
         draw(lineData[i]);
    }
}


void Qwt3D::Line3D::add(Qwt3D::Triple const & t)
{
    lineData.push_back(t);
}


void Qwt3D::Line3D::setLineColor(RGBA color)
{
    this->rgba = color;
}
//void Qwt3D::Line3D::getColor(int pointIndex)
//{

//}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-05-19 10:57  qwtplot3D\
     目录           0  2019-05-19 10:57  qwtplot3D\qwtplot3D\
     文件        1351  2019-03-26 16:07  qwtplot3D\qwtplot3D\ILD.pro
     目录           0  2019-05-19 10:57  qwtplot3D\qwtplot3D\include\
     文件        6863  2007-05-20 17:51  qwtplot3D\qwtplot3D\include\gl2ps.h
     文件         756  2016-11-18 18:03  qwtplot3D\qwtplot3D\include\mylineplot3d.h
     文件        1509  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_autoptr.h
     文件        1440  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_autoscaler.h
     文件        5895  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_axis.h
     文件        2188  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_color.h
     文件        2450  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_colorlegend.h
     文件        3760  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_coordsys.h
     文件        1216  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_drawable.h
     文件        2177  2016-11-04 17:30  qwtplot3D\qwtplot3D\include\qwt3d_enrichment.h
     文件        3434  2019-03-20 16:37  qwtplot3D\qwtplot3D\include\qwt3d_enrichment_std.h
     文件        1671  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_function.h
     文件        1601  2007-05-20 17:51  qwtplot3D\qwtplot3D\include\qwt3d_global.h
     文件         398  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_graphplot.h
     文件         943  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_gridmapping.h
     文件         517  2005-07-19 17:40  qwtplot3D\qwtplot3D\include\qwt3d_helper.h
     文件        3864  2005-09-05 16:27  qwtplot3D\qwtplot3D\include\qwt3d_io.h
     文件        2767  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_io_gl2ps.h
     文件         874  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_io_reader.h
     文件        2357  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_label.h
     文件         497  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_mapping.h
     文件         399  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_multiplot.h
     文件        2797  2017-08-31 17:15  qwtplot3D\qwtplot3D\include\qwt3d_openglhelper.h
     文件        1551  2005-07-10 16:54  qwtplot3D\qwtplot3D\include\qwt3d_parametricsurface.h
     文件       13604  2005-08-18 09:49  qwtplot3D\qwtplot3D\include\qwt3d_plot.h
     文件        1944  2005-09-05 16:27  qwtplot3D\qwtplot3D\include\qwt3d_portability.h
     文件        2912  2005-09-05 20:41  qwtplot3D\qwtplot3D\include\qwt3d_scale.h
............此处省略18个文件信息

评论

共有 条评论