[关闭]
@darkproject 2019-10-25T06:16:50.000000Z 字数 2566 阅读 989

智商恢复

恢复

被虐的最惨的一次吧,当时并不知道TA考察点。图形渲染知识基础一定要扎实,不是计算几何选手,很少做几何题。


1.判断点在多边形内部 (编程题)
2.不用分支语句推导三角波函数(编程题)ps:给一个三角波函数图像,输入x得到y。
3.GPU instance中,渲染大量草用什么方式存储草的颜色位置比较好,说明原因
-constant buffer -structured computebuffer -Texture2D
4.双线性过滤 4x各向异性过滤 邻近点过滤和三次插值,双三次插值,线性插值优化过后的采样次数
5.给你场景物体的顺序和混合因子让你计算最后颜色缓存的rgba
6.hsv的概念,rgb转hsv的公式
7.美术给模型做细分和GPU曲面细分的适用场合和优缺点
8.正交投影下计算良好效果边缘光的方法
9.描述一下沙漠的地貌特征和形成原因
10.色相差(Chromatic aberration)的表现和实现方法
11.IEEE754标准单精度浮点数能表示多少个数
12.perlin噪声用于随机生成地形的主要2个参数分别是什么

hdu 2199(浮点二分&牛顿迭代)

给予高次方程的解,求是否有满足在0到100的变量x。fabs(y)<=1e10。浮点二分x判断注意浮点二分的写法。牛顿迭代逼近x1=x-f/f`

  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4. #include <algorithm>
  5. #define eps 1e-6
  6. using namespace std;
  7. double f(double x)
  8. {
  9. return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;
  10. }
  11. int main()
  12. {
  13. int t;
  14. cin>>t;
  15. while(t--)
  16. {
  17. double y;
  18. cin>>y;
  19. if(f(100)<y||f(0)>y)
  20. cout<<"No solution!"<<endl;
  21. else{
  22. double l=0.0;
  23. double r=100.0;
  24. double mid=(l+r)/2;
  25. while(fabs(f(mid)-y)>eps)
  26. {
  27. //cout<<mid<<endl;
  28. if(f(mid)>y) r=mid-1;
  29. else l=mid+1;
  30. mid=(l+r)/2;
  31. }
  32. printf("%.4f\n",mid);
  33. }
  34. }
  35. return 0;
  36. }
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4. #include <algorithm>
  5. #define eps 1e-6
  6. using namespace std;
  7. double f(double x)
  8. {
  9. return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;
  10. }
  11. double fx(double x)
  12. {
  13. return 32*x*x*x+21*x*x+4*x+3;
  14. }
  15. int main()
  16. {
  17. int t;
  18. cin>>t;
  19. while(t--)
  20. {
  21. double y;
  22. cin>>y;
  23. double x1=1;
  24. double x;
  25. if(f(100)<y||f(0)>y)
  26. printf("No solution!\n");
  27. else{
  28. do{
  29. x=x1;
  30. x1=x-(f(x)-y)/fx(x);
  31. }while(fabs(x1-x)>eps);
  32. printf("%.4f\n",x);
  33. }
  34. }
  35. return 0;
  36. }

hdu1756(射线法判断点在多边形内部)

射线法计算点向右射线与多边形边界相交的次数,如果为奇数则在内部,偶数则不在内部。需要注意是否严格要求内部否则要丢弃点在边界上的情况。如果射线相交为完整的边,不考虑。1.判断是否在边界上结合叉积和点积判断,叉积为0代表共线,但不一定在2点之间线段上,点积小于0,确认在2点线段之间。2.if(p1.y!=p2.y&&q.y<=max(p1.y,p2.y)&&q.y>min(p1.y,p2.y))--第一项防止相交为完整边,第二三确认有相交的情况,其中<=考虑相交为多边形端点情况。3.x=p1.x+(q.y-p1.y)/k(p1,p2);公式kx+b求出射线与边界相交点的x值,判断是否在边界的左边。射线法复杂度O(n)

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. using namespace std;
  5. #define eps 1e-8
  6. const int maxn =105;
  7. int n,m;
  8. struct point{
  9. double x,y;
  10. point(double x=0,double y=0):x(x),y(y){}
  11. }p[maxn];
  12. point operator -(point a,point b){
  13. return point(a.x-b.x,a.y-b.y);
  14. }
  15. double cross(point a,point b)
  16. {
  17. return a.x*b.y-a.y*b.x;
  18. }
  19. double dot(point a,point b)
  20. {
  21. return a.x*b.x+a.y*b.y;
  22. }
  23. bool Online(point p1,point p2,point p)
  24. {
  25. if(fabs(cross(p1-p,p2-p))<eps&&dot(p1-p,p2-p)<0)
  26. return true;
  27. return false;
  28. }
  29. double k(point p1,point p2)
  30. {
  31. return (p1.y-p2.y)/(p1.x-p2.x);
  32. }
  33. int main()
  34. {
  35. while(cin>>n)
  36. {
  37. for(int i=0;i<n;i++)
  38. cin>>p[i].x>>p[i].y;
  39. cin>>m;
  40. while(m--)
  41. {
  42. bool flag=false;
  43. point q;
  44. cin>>q.x>>q.y;
  45. for(int i=0;i<n;i++)
  46. {
  47. point p1=p[i];
  48. point p2=p[(i+1)%n];
  49. if(Online(p1,p2,q)){
  50. flag=true;
  51. break;
  52. }
  53. if(p1.y!=p2.y&&q.y<=max(p1.y,p2.y)&&q.y>min(p1.y,p2.y))
  54. {
  55. double x=p1.x+(q.y-p1.y)/k(p1,p2);
  56. if(q.x<x) flag=!flag;
  57. }
  58. }
  59. if(flag) cout<<"Yes"<<endl;
  60. else cout<<"No"<<endl;
  61. }
  62. }
  63. return 0;
  64. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注