| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1620 人关注过本帖
标题:有错误,如何解决呢
取消只看楼主 加入收藏
chenchen0318
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2015-9-16
收藏
得分:0 
/*  chen.cpp   Copyright (c) 2015 by T.  */
/*                                     */
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <opencsg.h>
#include <math.h>
//#include <windows.h>
//#include <memory.h>
#include "myShape.h"
#include "displaylistPrimitive.h"
#define KEY_ESC 27
#define PI 3.1415
#define N 4

//#pragma comment(lib,"C:\\OpenGL包\\opengl32.lib")
//#pragma comment(lib,"C:\\OpenGL包\\glu32.lib")
//#pragma comment(lib,"C:\\OpenGL包\\glaux.lib")
//#pragma comment(lib,"C:\\OpenGL包\\glut.lib")
//#pragma comment(lib,"C:\\OpenGL包\\glut32.lib")
//#pragma comment(lib,"C:\\OpenGL包\\OpenCSG.lib")

//#pragma comment(lib,"C:\\OpenGL包\\glew32.lib")



typedef struct  {
    float x;
    float y;
    float z;
    float shita;
    float alpha;
} US_POS;

typedef struct  {
    float x;
    float y;
    float z;
} SH_POS;

const int shoe_point = 25433;
const int us_point_left = 4;
const int us_point_right = 4;
char *file_left="3.txt";
char *file_right="4.txt";
float theta = 0.0;
float dis=200.0, tws=0.0, ele=0.0, azi=0.0;
FILE *fp_left;
FILE *fp_right;
FILE *fp_us_left;
FILE *fp_us_right;
FILE *fp;
FILE *input_0;
//FILE *input_1;
//FILE *input_2;
//FILE *input_3;
//FILE *input_4;
//FILE *input_5;
FILE *input_right;
//float x[25433],y[25433],z[25433];
SH_POS sh_left[25433];
SH_POS sh_right[25433];
US_POS us_left[us_point_left];
US_POS us_right[us_point_right];
US_POS in_us_left[us_point_left];
US_POS in_us_right[us_point_right];
SH_POS sh_left4cm[88];
SH_POS sh_right4cm[97];
SH_POS full_sh_left4cm[10000];
SH_POS full_sh_right4cm[10000];
double left_us_matrix[us_point_left][4][4];
double right_us_matrix[us_point_right][4][4];
double left_gl_matrix[us_point_left][16];
double right_gl_matrix[us_point_right][16];
int us_flag_left=1;
int us_flag_right=1;
int camera_flag = 0;
float lx=0.0, ly=-170.0, lz=0.0;
float dx=0.0, dy=0.0, dz=0.0;
float sx=0.0, sy=0.0, sz=1.0;
float left_sh_angle=0.0;
float left_sh_height=0.0;
//US_POS right_sh_pos={51.5, 51.5, 0.0, 0.0, 0.0};
US_POS left_sh_pos={0.0, 0.0, 0.0, 0.0, 0.0};
US_POS right_sh_pos={10.0, 0.0, 0.0,-90.0, 0.0};
char ss[10];
int mot_flag=0;
int stop_mot=0;
int roop_flag=0;
int solid_flag=1;
float S1,S2;
SH_POS cone_point[18772];
//double length;
int left_count_4cm = 0;
int right_count_4cm = 0;
int p_us_left=0;
int p_us_right=0;

std::vector<OpenCSG::Primitive*> primitives;

void polarview(float distance, float twist, float elevation, float azimuth);
void CreateDisplayList(void);
void SetLight( GLenum light );
void SetMaterial( GLfloat R, GLfloat G, GLfloat B , GLfloat Alpha);
void display(void);
void idle(void);
void myKbd( unsigned char key, int x, int y );
void myInit (char *progname);
void camera_pos_reset();
void shoe_pos_reset();
void DrawString( char *string, GLfloat x, GLfloat y );
void Motion(void);
void Cone(void);
void matrixmultiply(double a[N][N],double b[N][N],double c[N][N]);
void transmatrix(double a[N][N],US_POS us,double c[4]);
void para2matrix(double x, double y, double z, double shita, double c[4][4], int para);
void inverseMatrix(double a[N][N], double inv_a[N][N]);
double msr_length(US_POS point1, SH_POS point2);

void polarview(float distance, float twist, float elevation, float azimuth){
    glTranslatef(0.0, 0.0, -distance);
    glRotatef(-twist, 0.0, 0.0, 1.0);
    glRotatef(-elevation, 1.0, 0.0, 0.0);
    glRotatef(-azimuth, 0.0, 1.0, 0.0);
}



void CreateDisplayList()
{
        GLuint id1 = glGenLists(1);
        glNewList(id1, GL_COMPILE);
            glPushMatrix();
                ////glColor3f(0.0, 0.0, 1.0);
                glTranslatef(4.5,7.0,4.0);
                glRotatef(-30.0, 0.0,0.0,1.0);
                //mySolidCylinder(0.5, 0.7,10);
                glRotatef(90.0, 1.0,0.0,0.0);
                glTranslatef(0.0,0.0,-141.0);
                glutSolidCone(51.3,141.0,10,10);
                //glutSolidCone(51.3,141,20,10);
            glPopMatrix();
        glEndList();

        GLuint id2 = glGenLists(1);
        glNewList(id2, GL_COMPILE);
        glPushMatrix();
        glTranslatef(51.5,51.5,51.5);
        glutSolidCube(103.0);
        glPopMatrix();
        glEndList();

        primitives.push_back(new OpenCSG::DisplayListPrimitive(id1, OpenCSG::Intersection, 1));
        primitives.push_back(new OpenCSG::DisplayListPrimitive(id2, OpenCSG::Subtraction, 1));

}
2015-09-18 12:25
chenchen0318
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2015-9-16
收藏
得分:0 
那应该就没有定义过!接下来我应该怎么定义是正确呢?谢谢你!
2015-09-18 12:31
chenchen0318
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2015-9-16
收藏
得分:0 
谢谢TonyDeng!我自己试着写一下,有问题我再提出来!
2015-09-18 12:44
chenchen0318
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2015-9-16
收藏
得分:0 
@TonyDeng  你好 这个primitive函数我没看出来它是具体要实现什么功能的,想问你怎么编程啊?
2015-09-18 13:37
chenchen0318
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2015-9-16
收藏
得分:0 
还是不行啊?我要疯了,谁能远程控制我的电脑给我看看啊?
2015-09-18 20:36
快速回复:有错误,如何解决呢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024987 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved