📄 vrutil.h
字号:
/* * $Id: util.h,v 1.4 1998/12/05 06:02:32 yjlee Exp $ * * Copyright (c) 1998 by Lee yongjae, dept. of Computer Science, * Seoul National University, Korea. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of the copyright holder * not be used in advertising or publicity pertaining to distribution * of the software without specific, written prior permission. * * This software is provided "as is" without express or implied warranty. * */#ifndef _ISO_UTIL_H_#define _ISO_UTIL_H_//#include <sys/time.h>#include <string.h>/* * Time checking tool *///double get_milisec_dist(struct timeval t1, struct timeval t2);/* * min, max macro */#ifndef __IPLMISC_H__#define MIN(a,b) (((a) <= (b))? (a) : (b))#define MAX(a,b) (((a) >= (b))? (a) : (b))#endif/* * Vector operations */#define V3NUL { 0, 0, 0 }#define V3ONE { 1, 1, 1 }double v3nrm(double v[3]);float v3nrmf(float v[3]);#define v3dot(r, v) (r)[0]*(v)[0]+(r)[1]*(v)[1]+(r)[2]*(v)[2]/* * Vector/Matrix Operation */void m4v4mul(double r[4], double m[4][4], double v[4]);void m4v3mul(double r[3], double m[4][4], double v[3]);void m4v4mulf(float r[4], float m[4][4], float v[4]);void m4v3mulf(float r[3], float m[4][4], float v[3]);#define MAX_DIM 1.0e+5#define MAX_T 1.0e+5#define BASE_EPS_T 0.1#define SBLK 8#define SBLK_STEP 8#define DEFAULT_DENSITY 0#define OPACITY_THRESHOLD 0.99//#define AMBIENT_FACTOR 0.05//#define DIFFUSE_FACTOR 0.95//#define SPECULAR_FACTOR 0.3#define SSD_AMBIENT_FACTOR 0.1#define SSD_DIFFUSE_FACTOR 0.8#define SSD_SPECULAR_FACTOR 0.2#define ALLOCATION_GAP1 (32 * 256)#define ALLOCATION_GAP2 (32 * 384)#define BACKGROUND_R 0.0#define BACKGROUND_G 0.0#define BACKGROUND_B 0.0typedef unsigned short VOXEL_T;#define VOXEL_MIN 0#define VOXEL_MAX 4095#define GET_SAMPLE(t) \ GetTLSample(m_afRayOrigin[0] + m_afRayDirection[0] * (t), m_afRayOrigin[1] + m_afRayDirection[1] * (t), m_afRayOrigin[2] + m_afRayDirection[2] * (t))#define GET_ENDO_SAMPLE(t) \ GetTLSample(m_afRayOrigin[0] + afRayDirection[0] * (t), m_afRayOrigin[1] + afRayDirection[1] * (t), m_afRayOrigin[2] + afRayDirection[2] * (t))#define GET_SAMPLE_NAV(t) \ GetTLSample(m_afRayOriginNav[0] + m_afRayDirectionNav[0] * (t), m_afRayOriginNav[1] + m_afRayDirectionNav[1] * (t), m_afRayOriginNav[2] + m_afRayDirectionNav[2] * (t))#define GET_SAMPLE_OBJECT(t, iObjNo) \ GetTLSample(iObjNo, m_afRayOrigin[0] + m_afRayDirection[0] * (t), m_afRayOrigin[1] + m_afRayDirection[1] * (t), m_afRayOrigin[2] + m_afRayDirection[2] * (t))#define GET_SAMPLE_THREAD(t) \ GetTLSample(afOrigin[0] + m_afRayDirection[0] * (t), afOrigin[1] + m_afRayDirection[1] * (t), afOrigin[2] + m_afRayDirection[2] * (t))typedef struct _rgb { unsigned char r, g, b;} rgb;typedef struct _IsoRenderInfo { VOXEL_T iso_value; float iso_opacity; float iso_r; float iso_g; float iso_b;} IsoRenderInfo;//#include "ploutoscommon.h"typedef struct _IsoSSDRenderInfo { VOXEL_T iso_value[2]; double iso_opacity; double iso_r; double iso_g; double iso_b; unsigned char* pbyMinMax; unsigned char* pbyMask; int bFillHole; int BBox[6];} IsoSSDRenderInfo;#define ISVOXELINVOLUME(x, y, z) (((x)>=0) && ((x)<m_iVolX-1) && ((y)>=0) && ((y)<m_iVolY-1) && ((z)>=0) && ((z) < m_iVolZ-1))#define IS_VOXEL_IN_CROP(x, y, z) (((x)>=m_aiCropRange[0]) && ((x)<m_aiCropRange[1]) && ((y)>=m_aiCropRange[2]) && ((y)<m_aiCropRange[3]) && ((z)>=m_aiCropRange[4]) && ((z) < m_aiCropRange[5]))#define IS_VOXEL_IN_INTERPOLATED_VOLUME(x, y, z) (((x)>=m_afCropRange[0]) && ((x) < m_afCropRange[1]) && ((y)>=m_afCropRange[2]) && ((y)<m_afCropRange[3]) && ((z)>=m_afCropRange[4]) && ((z) < m_afCropRange[5]))#define IS_VOXEL_IN_CROPVR(x, y, z) (((x)>=(m_afCropMin[0])) && ((x) < (m_afCropMax[0])) && ((y)>=(m_afCropMin[1])) && ((y)<(m_afCropMax[1])) && ((z)>=(m_afCropMin[2])) && ((z) < (m_afCropMax[2])))#endif /* _UTIL_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -