xyh

熊赟晖

Msn:
Mail: yhxiong@scut.edu.cn
Website:
Description: XiongYunhui is a PH.D. student at School of Computer Science & Engineering of SCUT. His research insterests are Computer Graphics, Shape Analysis and Quad-remeshing.

Posts by 熊赟晖:

  void add_vertices(builder &B)
  {/*
   参数域的范围,及参数域上的采样大小为n*m.曲面方程为S=S(u,v)

   * * * * * * * * * * * * * * * * * * * * * * * * * * * * v2
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * ^
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * v1
                                                                                            (n*m)

   u1<—————————————————>u2
   */

   int n=m_SurfParam->m_matlab_grids_n; //参数域上的行数
   int m=m_SurfParam->m_matlab_grids_m;//参数域上的列数
   double ndouble=n*1.0,mdouble=m*1.0;  //传入到matlab中需要转换成double型.

   mxArray *nsize=mxCreateDoubleMatrix(1, 1, mxREAL);
   mxArray *msize=mxCreateDoubleMatrix(1, 1, mxREAL);
   memcpy((char *) mxGetPr(nsize), (char *) &ndouble, sizeof(double));
   memcpy((char *) mxGetPr(msize), (char *) &mdouble, sizeof(double));
   engPutVariable(Matlab_ep, “n”, nsize);//matlab中的变量n记录行数
   engPutVariable(Matlab_ep, “m”, msize);//matlab中的变量m记录列数

   mxArray *u1=mxCreateDoubleMatrix(1, 1, mxREAL);
   mxArray *u2=mxCreateDoubleMatrix(1, 1, mxREAL);
   memcpy((char *) mxGetPr(u1), (char *) &m_SurfParam->m_matlab_u1, sizeof(double));
   memcpy((char *) mxGetPr(u2), (char *) &m_SurfParam->m_matlab_u2, sizeof(double));
   engPutVariable(Matlab_ep, “u1″, u1);//设定u的最小值
   engPutVariable(Matlab_ep, “u2″, u2);//设定u的最大值

   mxArray *v1=mxCreateDoubleMatrix(1, 1, mxREAL);
   mxArray *v2=mxCreateDoubleMatrix(1, 1, mxREAL);
   memcpy((char *) mxGetPr(v1), (char *) &m_SurfParam->m_matlab_v1, sizeof(double));
   memcpy((char *) mxGetPr(v2), (char *) &m_SurfParam->m_matlab_v2, sizeof(double));
   engPutVariable(Matlab_ep, “v1″, v1);//设定v的最小值
   engPutVariable(Matlab_ep, “v2″, v2);//设定v的最大值

   int matlab_ok=false;
   matlab_ok=engEvalString(Matlab_ep, “ustep=(u2-u1)/n;vstep=(v2-v1)/m;ui=[u1:ustep:u2];vi=[v1:vstep:v2];[u,v]=meshgrid(ui,vi);”);//建立参数域上的采样点,将来用于生成网格曲面上的顶点.

   CString command;

//m_SurfParam->m_matlab_x中记录了x=x(u,v)的信息,如x=u^2+v^2

//m_SurfParam->m_matlab_y中记录了y=y(u,v)的信息,如y=u^2-v^2.
//m_SurfParam->m_matlab_z中记录了z=z(u,v)的信息,如z=u+v

command=”xsym=sym(‘”+m_SurfParam->m_matlab_x+”‘);”+”ysym=sym(‘”+m_SurfParam->m_matlab_y+”‘);”+”zsym=sym(‘”+m_SurfParam->m_matlab_z+”‘);”;//用参数来表示曲面顶点(x,y,z),也就是定义光滑曲面.
   matlab_ok=engEvalString(Matlab_ep, command);

   matlab_ok=engEvalString(Matlab_ep, “r=[xsym ysym zsym];ru=diff(r,’u',1);rv=diff(r,’v',1);ruu=diff(r,’u',2);rvv=diff(r,’v',2);ruv=diff(ru,’v',1);”);//计算1阶和2阶导数.
   matlab_ok=engEvalString(Matlab_ep, “n=cross(ru,rv);n=n/sqrt(dot(n,n));E=dot(ru,ru);F=dot(ru,rv);G=dot(rv,rv);L=dot(ruu,n);M=dot(ruv,n);N=dot(rvv,n);”);//计算第1型和第2型的一些数据.
 matlab_ok=engEvalString(Matlab_ep, “H=(L*G-2*M*F+N*E)/(2*(E*G-F^2));K=(L*N-M.^2)/(E*G-F^2);//开始计算平均曲率H和高斯曲率K.

[fH_num,fH_den]=numden(H);[fK_num,fK_den]=numden(K);fH=inline(H);fK=inline(K);h=eval(char(fH));k=eval(char(fK));hnum=eval(char(inline(fH_num)));knum=eval(char(inline(fK_num)));”);

   matlab_ok=engEvalString(Matlab_ep, “xf=inline(xsym);yf=inline(ysym);zf=inline(zsym);”);//计算曲面上各顶点的3维数据.
   if(m_SurfParam->bRandQuadSample)//对参数域上的采样点进行随机扰动.
     matlab_ok=engEvalString(Matlab_ep, “x=eval(char(xf));y=eval(char(yf));x=x+(rand(size(x))-0.5)*ustep/4;y=y+(rand(size(y))-0.5)*ustep/4;z=eval(char(zf));”);
   else matlab_ok=engEvalString(Matlab_ep, “x=eval(char(xf));y=eval(char(yf));z=eval(char(zf));”);
   if (m_SurfParam->m_showInMaltab)
   {//在matalb中显示光滑曲面.
    matlab_ok=engEvalString(Matlab_ep, “surf(x,y,z,h);axis image;”);
   }
   
   mxArray *x=NULL,*y=NULL,*z=NULL,*h=NULL,*k=NULL,*hnum=NULL,*knum=NULL;
   x = engGetVariable(Matlab_ep, “x”);//获取模型上顶点的x值
   y = engGetVariable(Matlab_ep, “y”);//获取模型上顶点的y值
   z = engGetVariable(Matlab_ep, “z”);//获取模型上顶点的z值
   k = engGetVariable(Matlab_ep, “k”);//获取模型上顶点的高斯曲率
   h = engGetVariable(Matlab_ep, “h”);//获取模型上顶点的平均曲率
   hnum = engGetVariable(Matlab_ep, “hnum”);//取平均曲率的分子部分,考虑到分母为0,的时候分子也为0,则平均曲率为0
   knum = engGetVariable(Matlab_ep, “knum”);//取平均曲率的分子部分,考虑到分母为0,的时候分子也为0,则平均曲率为0

   double *xreal = mxGetPr(x);
   double *yreal = mxGetPr(y);
   double *zreal = mxGetPr(z);
   double *hreal = mxGetPr(h);//平均曲率
   double *hnumreal = mxGetPr(hnum);//获取平均曲率的分子部分,如果为0,则平均曲率为0.
   double *kreal=NULL;//高斯曲率
   double *knumreal=NULL;//获取高斯曲率的分子部分,如果为0,则高斯曲率为0.
   if(k!=NULL) {
    kreal = mxGetPr(k);//获取高斯曲率
    knumreal= mxGetPr(knum);//获取高斯曲率的分子部分,如果为0,则高斯曲率为0.
   }

   indexMap=new int [(n+1)*(m+1)];//开始构造光滑曲面上顶点的3维数据,及相应的平均曲率&高斯曲率值.
   Point *np=new Point [(n+1)*(m+1)];
   for (int i=0;i<=n;i++)
   {
    for (int j=0;j<=m;j++)
    {
     int index=i*(m+1)+j;
     np[index]=Point(xreal[index],yreal[index],zreal[index]);
     indexMap[index]=index;
    }
   }

   int newPointIndex=0;

   for (int i=0;i<=n;i++)
   {
    for (int j=0;j<=m;j++)
    {
     int index=i*(m+1)+j;
 
      {
      //增加一个新顶点到顶点树中.
      indexMap[index]=newPointIndex;
      Vertex_handle vh=B.add_vertex(np[indexMap[index]]);
      vh->tag(newPointIndex++);
      if (fabs(hnumreal[index])<EPSILON)
      {//如果平均曲率中的分子部分为0,则平均曲率为0.
       vh->m_mean_curvature_exact=0;
      }else vh->m_mean_curvature_exact=hreal[index];
      if(k!=NULL)
       if (fabs(knumreal[index])<EPSILON)
       {//如果高斯曲率中的分子部分为0,则高斯曲率为0.
        vh->m_gauss_curvature_exact=0;
       }else vh->m_gauss_curvature_exact=kreal[index];
     }
    }
   }
   delete [] np;//释放占用的一些内存.

   mxDestroyArray(nsize);mxDestroyArray(msize);
   mxDestroyArray(x);mxDestroyArray(y);mxDestroyArray(z);
   mxDestroyArray(u1);mxDestroyArray(u2);
   mxDestroyArray(v1);mxDestroyArray(v2);
  }

16 Mar 10:10
xyh
Study Notes | 199 views | 1 Comment

一、专门收集了国际上每年计算机类会议的网址

1: Wiki网站专门收集了国际上每年计算机类会议的call for paper,http://www.wikicfp.com/

2:http://www.meeting.edu.cn/

二,模型库

1:http://www.cgrealm.org/

大家有其它合适的网址也可以加入。

三,历年siggraphs文章

http://kesen.realtimerendering.com/

Copyright © 2010 · All Rights Reserved · Produced by Panny · Powered by WordPress ·