⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 useful.h

📁 marchingcube源代码
💻 H
字号:



#ifndef __USEFUL_H_#define __USEFUL_H_//#include "fstream.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "math.h"//#include "tk.h"//My defines#define PI 3.14159265358979323846#define limit(a,b,c) ((a>b) ? a : ((b>c) ? c : b))//clamp b to a<b<c
//typedef enum {TRUE = 1 , FALSE =0} BOOL;
typedef int MH_BOOL;
#define MH_TRUE 1;
#define MH_FALSE 0;
//#define toBOOL(a) (a ? TRUE : FALSE)typedef unsigned char BYTE;//class Point3Dtypedef struct Point3DList{	double x, y, z;	struct Point3DList *next;} Point3D;	//MyGL primitives://================void MyGLTranslate(Point3D *Location);void MyGLRotate(double teta, Point3D *Axe);void MyGLRestorLocation();void MyGLRelocate(Point3D *Location, Point3D *Direction, Point3D *Up);void MyGLNormal(Point3D *APoint);void MyGLVertex(Point3D *APoint);void MyGLColor();void MyGLBegin(int type);void MyGLEnd();//Point3D class//===============Point3D *new_Point3D(Point3D *APoint3D);Point3D Point3D_Point3D(Point3D *APoint3D);Point3D Point3D_Point3D3(double Ax, double Ay, double Az);void Point3D_reset1(Point3D *This, Point3D *A);void Point3D_reset3(Point3D *This, double ax, double ay, double az);void Point3D_reset(Point3D *This);void Point3D_Invert(Point3D *This);MH_BOOL/*bool*/ Point3D_IsNull(Point3D *This);double Point3D_GetNorm(Point3D *This);double Point3D_Normalize(Point3D *This);double Point3D_Normalize1(Point3D *This, double Value);Point3D Point3D_VecProd (Point3D *This, Point3D *A);double Point3D_Angle (Point3D *This, Point3D A);void Point3D_XRotate (Point3D *This, double teta);void Point3D_YRotate (Point3D *This, double teta);void Point3D_ZRotate (Point3D *This, double teta);/*void Point3D_Rotate(Point3D *This, Point3D K);*/Point3D Point3D_div (Point3D *This, double factor);double Point3D_ScalProd (Point3D *This, Point3D *A);Point3D Point3D_mult (Point3D *This, double factor);Point3D Point3D_sub (Point3D *This, Point3D *A);Point3D Point3D_add (Point3D *This, Point3D *A);void Point3D_addeq (Point3D *This, Point3D *A);void Point3D_multeq (Point3D *This, double factor);void Point3D_subeq (Point3D *This, Point3D *A);void Point3D_diveq (Point3D *This, double denom);double Point3D_sin(Point3D A, Point3D B);double Point3D_cos(Point3D A, Point3D B);void Point3D_read(Point3D *This, FILE *infile);void Point3D_write(Point3D *This, FILE *outfile);//CLASS Triangle//member vars:typedef struct TriangleStruct{	int a, b, c;	struct TriangleStruct *next;} Triangle;//CLASS Triangle//member functions:Triangle *new_Triangle3(int Aa, int Ab, int Ac);Triangle *new_Triangle(Triangle *ATriangle);Triangle Triangle_Triangle();Triangle Triangle_Triangle3(int Aa, int Ab, int Ac);Triangle Triangle_Triangle1(Triangle *ATriangle);void Triangle_write (Triangle *This, FILE *outfile);//CLASS TriangleList//member variables:typedef struct{	Triangle *Head;	Triangle *Tail;} TriangleList;//CLASS TriangleList//member functions:TriangleList TriangleList_TriangleList();void TriangleList_Add(TriangleList *This, Triangle *ATriangle);void TriangleList_Concat(TriangleList *This, TriangleList *ATriangleList);//CLASS Edge//member variables:typedef struct{	int corner1, corner2; //edge defined by two corners} Edge;//CLASS Edge//member functions:Edge Edge_Edge();Edge Edge_Edge2(int Acorner1, int Acorner2);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -