亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 3d.c

?? frasr200的win 版本源碼(18.21),使用make文件,使用的vc版本較低,在我的環境下編譯有問題! 很不錯的分形程序代碼!
?? C
字號:
/*
A word about the 3D library. Even though this library supports
three dimensions, the matrices are 4x4 for the following reason.
With normal 3 dimensional vectors, translation is an ADDITION,
and rotation is a MULTIPLICATION. A vector {x,y,z} is represented
as a 4-tuple {x,y,z,1}. It is then possible to define a 4x4
matrix such that multiplying the vector by the matrix translates
the vector. This allows combinations of translation and rotation
to be obtained in a single matrix by multiplying a translation
matrix and a rotation matrix together. Note that in the code,
vectors have three components; since the fourth component is
always 1, that value is not included in the vector variable to
save space, but the routines make use of the fourth component
(see vec_mult()). Similarly, the fourth column of EVERY matrix is
always
	 0
	 0
	 0
	 1
but currently the C version of a matrix includes this even though
it could be left out of the data structure and assumed in the
routines. Vectors are ROW vectors, and are always multiplied with
matrices FROM THE LEFT (e.g. vector*matrix). Also note the order
of indices of a matrix is matrix[row][column], and in usual C
fashion, numbering starts with 0.

TRANSLATION MATRIX =  1     0	  0	0
		      0     1	  0	0
		      0     0	  1	0
		      Tx    Ty	  Tz	1

SCALE MATRIX =	      Sx    0	  0	0
		      0     Sy	  0	0
		      0     0	  Sz	0
		      0     0	  0	1

Rotation about x axis i degrees:
ROTX(i) =		1     0     0	  0
		      0   cosi  sini    0
		      0  -sini  cosi    0
		      0     0	  0	1

Rotation about y axis i degrees:
ROTY(i) =	      cosi	0  -sini    0
		      0     1	  0	0
		    sini    0   cosi    0
		      0     0	  0	1

Rotation about z axis i degrees:
ROTZ(i) =	      cosi  sini	0     0
		   -sini  cosi    0     0
		      0     0	  1	0
		      0     0	  0	1

		      --  Tim Wegner  April 22, 1989
*/

#include <stdio.h>
#include <float.h>
#include <string.h>
#include "fractint.h"
#include "prototyp.h"
extern int overflow;
extern int bad_value;

/* initialize a matrix and set to identity matrix
   (all 0's, 1's on diagonal) */
void identity(MATRIX m)
{
   int i,j;
   for(i=0;i<CMAX;i++)
   for(j=0;j<RMAX;j++)
      if(i==j)
	 m[j][i] = 1.0;
      else
	  m[j][i] = 0.0;
}

/* Multiply two matrices */
void mat_mul(MATRIX mat1, MATRIX mat2, MATRIX mat3)
{
     /* result stored in MATRIX new to avoid problems
	in case parameter mat3 == mat2 or mat 1 */
     MATRIX new;
     int i,j;
     for(i=0;i<4;i++)
     for(j=0;j<4;j++)
	new[j][i] =  mat1[j][0]*mat2[0][i]+
		     mat1[j][1]*mat2[1][i]+
		     mat1[j][2]*mat2[2][i]+
		     mat1[j][3]*mat2[3][i];
     memcpy(mat3,new,sizeof(new));
}

/* multiply a matrix by a scalar */
void scale (double sx, double sy, double sz, MATRIX m)
{
   MATRIX scale;
   identity(scale);
   scale[0][0] = sx;
   scale[1][1] = sy;
   scale[2][2] = sz;
   mat_mul(m,scale,m);
}

/* rotate about X axis	*/
void xrot (double theta, MATRIX m)
{
   MATRIX rot;
   double sintheta,costheta;
   sintheta = sin(theta);
   costheta = cos(theta);
   identity(rot);
   rot[1][1] = costheta;
   rot[1][2] = -sintheta;
   rot[2][1] = sintheta;
   rot[2][2] = costheta;
   mat_mul(m,rot,m);
}

/* rotate about Y axis	*/
void yrot (double theta, MATRIX m)
{
   MATRIX rot;
   double sintheta,costheta;
   sintheta = sin(theta);
   costheta = cos(theta);
   identity(rot);
   rot[0][0] = costheta;
   rot[0][2] = sintheta;
   rot[2][0] = -sintheta;
   rot[2][2] = costheta;
   mat_mul(m,rot,m);
}

/* rotate about Z axis	*/
void zrot (double theta, MATRIX m)
{
   MATRIX rot;
   double sintheta,costheta;
   sintheta = sin(theta);
   costheta = cos(theta);
   identity(rot);
   rot[0][0] = costheta;
   rot[0][1] = -sintheta;
   rot[1][0] = sintheta;
   rot[1][1] = costheta;
   mat_mul(m,rot,m);
}

/* translate  */
void trans (double tx, double ty, double tz, MATRIX m)
{
   MATRIX trans;
   identity(trans);
   trans[3][0] = tx;
   trans[3][1] = ty;
   trans[3][2] = tz;
   mat_mul(m,trans,m);
}

/* cross product  - useful because cross is perpendicular to v and w */
int cross_product (VECTOR v, VECTOR w, VECTOR cross)
{
   VECTOR tmp;
   tmp[0] =  v[1]*w[2] - w[1]*v[2];
   tmp[1] =  w[0]*v[2] - v[0]*w[2];
   tmp[2] =  v[0]*w[1] - w[0]*v[1];
   cross[0] = tmp[0];
   cross[1] = tmp[1];
   cross[2] = tmp[2];
   return(0);
}

/* cross product integer arguments (not fudged) */
/*** pb, unused
int icross_product (IVECTOR v, IVECTOR w, IVECTOR cross)
{
   IVECTOR tmp;
   tmp[0] =  v[1]*w[2] - w[1]*v[2];
   tmp[1] =  w[0]*v[2] - v[0]*w[2];
   tmp[2] =  v[0]*w[1] - w[0]*v[1];
   cross[0] = tmp[0];
   cross[1] = tmp[1];
   cross[2] = tmp[2];
   return(0);
}
***/

/* normalize a vector to length 1 */
normalize_vector(VECTOR v)
{
    double vlength;
    vlength = dot_product(v,v);

    /* bailout if zero vlength */
    if(vlength < FLT_MIN || vlength > FLT_MAX)
       return(-1);
    vlength = sqrt(vlength);
    if(vlength < FLT_MIN)
       return(-1);

    v[0] /= vlength;
    v[1] /= vlength;
    v[2] /= vlength;
    return(0);
}

/* multiply source vector s by matrix m, result in target t */
/* used to apply transformations to a vector */
int vmult(s,m,t)
VECTOR s,t;
MATRIX m;
{
   VECTOR tmp;
   int i,j;
   for(j=0;j<CMAX-1;j++)
   {
      tmp[j] = 0.0;
      for(i=0;i<RMAX-1;i++)
	 tmp[j] += s[i]*m[i][j];
      /* vector is really four dimensional with last component always 1 */
      tmp[j] += m[3][j];
   }
   /* set target = tmp. Necessary to use tmp in case source = target */
   memcpy(t,tmp,sizeof(tmp));
   return(0);
}

/* multiply vector s by matrix m, result in s */
/* use with a function pointer in line3d.c */
/* must coordinate calling conventions with */
/* mult_vec_iit in general.asm */
void mult_vec_c(s)
VECTOR s;
{
   extern MATRIX m;
   VECTOR tmp;
   int i,j;
   for(j=0;j<CMAX-1;j++)
   {
      tmp[j] = 0.0;
      for(i=0;i<RMAX-1;i++)
	 tmp[j] += s[i]*m[i][j];
      /* vector is really four dimensional with last component always 1 */
      tmp[j] += m[3][j];
   }
   /* set target = tmp. Necessary to use tmp in case source = target */
   memcpy(s,tmp,sizeof(tmp));
}

/* perspective projection of vector v with respect to viewpont vector view */
perspective(VECTOR v)
{
   extern VECTOR view;
   double denom;
   denom = view[2] - v[2];

   if(denom >= 0.0)
   {
      v[0] = bad_value;   /* clipping will catch these values */
      v[1] = bad_value;   /* so they won't plot values BEHIND viewer */
      v[2] = bad_value;
      return(-1);
   }
   v[0] = (v[0]*view[2] - view[0]*v[2])/denom;
   v[1] = (v[1]*view[2] - view[1]*v[2])/denom;

   /* calculation of z if needed later */
   /* v[2] =  v[2]/denom;*/
   return(0);
}

/* long version of vmult and perspective combined for speed */
longvmultpersp(s, m, t0, t, lview, bitshift)
LVECTOR s;	 /* source vector */
LMATRIX m;	 /* transformation matrix */
LVECTOR t0;	 /* after transformation, before persp */
LVECTOR t;	 /* target vector */
LVECTOR lview;	 /* perspective viewer coordinates */
int bitshift;	 /* fixed point conversion bitshift */
{
   LVECTOR tmp;
   int i,j, k;
   overflow = 0;
   k = CMAX-1;			/* shorten the math if non-perspective and non-illum */
   if (lview[2] == 0 && t0[0] == 0) k--;

   for(j=0;j<k;j++)
   {
      tmp[j] = 0;
      for(i=0;i<RMAX-1;i++)
	 tmp[j] += multiply(s[i],m[i][j],bitshift);
      /* vector is really four dimensional with last component always 1 */
      tmp[j] += m[3][j];
   }
   if(t0[0]) /* first component of  t0 used as flag */
   {
      /* faster than for loop, if less general */
      t0[0] = tmp[0];
      t0[1] = tmp[1];
      t0[2] = tmp[2];
   }
   if (lview[2] != 0)		/* perspective 3D */
   {

      LVECTOR tmpview;
      long denom;

      denom = lview[2] - tmp[2];
      if (denom >= 0)		/* bail out if point is "behind" us */
      {
	   t[0] = bad_value;
	   t[0] = t[0]<<bitshift;
	   t[1] = t[0];
	   t[2] = t[0];
	   return(-1);
      }

      /* doing math in this order helps prevent overflow */
      tmpview[0] = divide(lview[0],denom,bitshift);
      tmpview[1] = divide(lview[1],denom,bitshift);
      tmpview[2] = divide(lview[2],denom,bitshift);

      tmp[0] = multiply(tmp[0], tmpview[2], bitshift) -
	       multiply(tmpview[0], tmp[2], bitshift);

      tmp[1] = multiply(tmp[1], tmpview[2], bitshift) -
	       multiply(tmpview[1], tmp[2], bitshift);

      /* z coordinate if needed 	  */
      /* tmp[2] = divide(lview[2],denom);  */
   }

   /* set target = tmp. Necessary to use tmp in case source = target */
   /* faster than for loop, if less general */
   t[0] = tmp[0];
   t[1] = tmp[1];
   t[2] = tmp[2];
   return(overflow);
}

/* Long version of perspective. Because of use of fixed point math, there
   is danger of overflow and underflow */
longpersp(LVECTOR lv, LVECTOR lview, int bitshift)
{
   LVECTOR tmpview;
   long denom;
   overflow = 0;
   denom = lview[2] - lv[2];
   if (denom >= 0)		/* bail out if point is "behind" us */
   {
	lv[0] = bad_value;
	lv[0] = lv[0]<<bitshift;
	lv[1] = lv[0];
	lv[2] = lv[0];
	return(-1);
   }

   /* doing math in this order helps prevent overflow */
   tmpview[0] = divide(lview[0],denom,bitshift);
   tmpview[1] = divide(lview[1],denom,bitshift);
   tmpview[2] = divide(lview[2],denom,bitshift);

   lv[0] = multiply(lv[0], tmpview[2], bitshift) -
	   multiply(tmpview[0], lv[2], bitshift);

   lv[1] = multiply(lv[1], tmpview[2], bitshift) -
	   multiply(tmpview[1], lv[2], bitshift);

   /* z coordinate if needed	       */
   /* lv[2] = divide(lview[2],denom);  */
   return(overflow);
}

int longvmult(LVECTOR s,LMATRIX m,LVECTOR t,int bitshift)
{
   LVECTOR tmp;
   int i,j, k;
   overflow = 0;
   k = CMAX-1;

   for(j=0;j<k;j++)
   {
      tmp[j] = 0;
      for(i=0;i<RMAX-1;i++)
	 tmp[j] += multiply(s[i],m[i][j],bitshift);
      /* vector is really four dimensional with last component always 1 */
      tmp[j] += m[3][j];
   }

   /* set target = tmp. Necessary to use tmp in case source = target */
   /* faster than for loop, if less general */
   t[0] = tmp[0];
   t[1] = tmp[1];
   t[2] = tmp[2];
   return(overflow);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品女同一区二区三区| 欧美一区午夜精品| 国产91在线看| 成人做爰69片免费看网站| 成人黄色小视频| 在线亚洲高清视频| 欧美日韩免费观看一区三区| 美女一区二区在线观看| 日本欧美一区二区三区| 91麻豆6部合集magnet| 91成人免费在线视频| 欧美伦理电影网| 欧美一区二区免费观在线| 日韩三级在线观看| 久久午夜免费电影| 亚洲乱码国产乱码精品精小说 | 成人动漫中文字幕| 欧美亚洲高清一区二区三区不卡| 在线播放亚洲一区| 久久亚洲捆绑美女| 亚洲成人动漫精品| 成人网在线播放| 欧美图区在线视频| 久久久www免费人成精品| 亚洲美女屁股眼交| 日韩黄色小视频| 国产成人av一区二区三区在线| 色欧美88888久久久久久影院| 欧美一区二区三区不卡| 国产精品沙发午睡系列990531| 一区二区国产盗摄色噜噜| 狠狠色狠狠色综合| 欧美日韩精品专区| 中文字幕av在线一区二区三区| 偷拍亚洲欧洲综合| 99视频精品全部免费在线| 日韩亚洲电影在线| 一区二区三区欧美久久| 国产精品性做久久久久久| 欧美曰成人黄网| 国产精品午夜久久| 久久成人综合网| 欧美精品一二三四| 一区二区中文视频| 夜夜嗨av一区二区三区网页| 日本伊人色综合网| 91麻豆国产精品久久| 国产亚洲精品aa| 51精品秘密在线观看| xvideos.蜜桃一区二区| 亚洲一区视频在线| 91麻豆国产在线观看| 久久综合一区二区| 奇米亚洲午夜久久精品| 欧美日韩一区二区三区视频| 日韩伦理av电影| 成人精品视频一区二区三区尤物| 精品国产一区久久| 麻豆精品蜜桃视频网站| 欧美精三区欧美精三区| 亚洲欧美另类图片小说| av午夜一区麻豆| 国产日韩欧美一区二区三区综合| 一区二区三区在线观看欧美| 99热99精品| 中文字幕一区二区不卡| 不卡一区二区中文字幕| 国产色综合一区| 国产精品 欧美精品| 久久久亚洲精华液精华液精华液| 久久国产精品区| 久久伊99综合婷婷久久伊| 久久成人免费电影| 久久婷婷成人综合色| 国产露脸91国语对白| 久久精品在这里| 一区二区三区日韩在线观看| 欧美日产国产精品| 天天色综合成人网| 91精品黄色片免费大全| 国产自产视频一区二区三区| 久久久久久免费网| 不卡av在线免费观看| 亚洲免费电影在线| 欧美色视频在线观看| 日本va欧美va精品发布| 2020日本不卡一区二区视频| 国产69精品久久久久777| 国产精品久久久久毛片软件| 91成人免费电影| 日韩国产在线观看一区| 日韩精品一区二区三区视频| 粉嫩嫩av羞羞动漫久久久| 国产精品久久99| 欧美精品一卡二卡| 亚洲国产日韩a在线播放性色| 91精品国产综合久久久久久漫画 | 日本韩国一区二区三区| 一区二区三区**美女毛片| 欧美高清你懂得| 国产麻豆精品theporn| 精品美女在线播放| 国产精品资源站在线| 久久精品人人做人人爽97| 91日韩精品一区| 国产精品无遮挡| 51精品秘密在线观看| 成人亚洲一区二区一| 亚洲一区二区三区在线播放| 欧美一级欧美三级| 91小视频免费看| 久久精品免费观看| 亚洲色欲色欲www在线观看| 91精品国产色综合久久不卡电影 | 国产成人精品免费一区二区| 一区二区三区蜜桃网| 久久久国产午夜精品| 色噜噜狠狠色综合欧洲selulu| 麻豆国产欧美日韩综合精品二区 | 精品久久五月天| 色网站国产精品| 国产一区视频导航| 视频在线在亚洲| 中文字幕一区二区三区不卡在线| 日韩一二三四区| 日本精品视频一区二区| 国产精品1区2区3区在线观看| 亚洲午夜激情网站| 中文字幕亚洲区| 精品精品国产高清一毛片一天堂| 色噜噜狠狠成人网p站| 国产一区二区剧情av在线| 亚洲成人av中文| 中文一区二区在线观看| 在线播放亚洲一区| 欧美二区在线观看| 日本丰满少妇一区二区三区| 成年人国产精品| 成人性视频免费网站| 国产麻豆精品视频| 精品一区二区综合| 中文字幕人成不卡一区| 欧美sm美女调教| 91久久国产最好的精华液| 中文字幕日韩av资源站| 久久久午夜精品理论片中文字幕| 久久久激情视频| 欧美日韩高清在线播放| 欧美精品一二三四| 欧美一区二区三区不卡| 欧美精品第1页| 欧美精三区欧美精三区| 欧美日韩成人综合| 欧美日韩在线观看一区二区| 一本久久a久久精品亚洲| 不卡在线视频中文字幕| 91麻豆免费看| 91黄视频在线观看| 欧美日韩一级大片网址| 欧美日韩二区三区| 欧美一区二区三区四区在线观看 | 亚洲精品高清视频在线观看| 亚洲精品你懂的| 久久综合一区二区| 精品99久久久久久| 国产精品久久久久久久久免费丝袜| av在线播放不卡| 色悠久久久久综合欧美99| av在线播放成人| 久久精品国产免费看久久精品| 亚洲国产综合在线| 天堂在线亚洲视频| 三级一区在线视频先锋| 精品一区二区在线视频| 狠狠色丁香久久婷婷综合_中| 色综合视频在线观看| 中文字幕欧美区| 国产自产高清不卡| 欧美va亚洲va| 免费高清视频精品| 欧美色网一区二区| 亚洲精品成人天堂一二三| 成人av网站在线| 中文一区在线播放| 丁香网亚洲国际| 久久精品一区四区| 国产成人精品网址| 国产欧美精品区一区二区三区| 极品尤物av久久免费看| 精品盗摄一区二区三区| 欧美aⅴ一区二区三区视频| 56国语精品自产拍在线观看| 亚洲高清免费视频| 欧美日韩国产大片| 日日夜夜一区二区| 日韩三级av在线播放| 免费观看一级欧美片| 日韩欧美高清一区| 精品亚洲成a人| 久久精品一区蜜桃臀影院|