网站大量收购独家精品文档,联系QQ:2885784924

编程作业第1题.doc

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
编程作业第1题

#ifndef CONST_H #define CONST_H #define USENUM 6 #define PX 110 #define PY 110 #endif #include stdio.h #include stdlib.h #include base.h #include matrix.h int main() { Point* points[10]; int i=0; double *M=NULL, *P=NULL, *Z=NULL, *X=NULL; double *MT=NULL, *RES=NULL; for(; i10; i++) { points[i] = (Point*)malloc(sizeof(Point)); } points[0]-x=102; points[0]-y=110; points[0]-z=15; points[1]-x=109; points[1]-y=113; points[1]-z=18; points[2]-x=105; points[2]-y=115; points[2]-z=19; points[3]-x=103; points[3]-y=103; points[3]-z=17; points[4]-x=108; points[4]-y=105; points[4]-z=21; points[5]-x=105; points[5]-y=108; points[5]-z=15; points[6]-x=115; points[6]-y=104; points[6]-z=20; points[7]-x=118; points[7]-y=108; points[7]-z=15; points[8]-x=116; points[8]-y=113; points[8]-z=17; points[9]-x=113; points[9]-y=118; points[9]-z=22; init(points, 10); selectP(points, 10, 6); M = getM(points, 6); P = getP(points, 6); Z = getZ(points, 6); MT = MatrixInver(M, 6, 6); RES = MatrixMultiple(MT, 6, 6, P, 6, 6); RES = MatrixMultiple(RES, 6, 6, M, 6, 6); RES = MatrixOpp(RES, 6, 6); RES = MatrixMultiple(RES, 6, 6, MT, 6, 6); RES = MatrixMultiple(RES, 6, 6, P, 6, 6); RES = MatrixMultiple(RES, 6, 6, Z, 6, 1); printf(Result is %f\n, RES[5]); return 0; } #include stdio.h #include stdlib.h #include base.h int init (Point *(*sample), const int size) { int i=0; const Point targetP = {PX, PY, 0, 0}; while (i size) { sample[i]-dis = getDis(sample[i], targetP); i++; } i = 0; while (i size) { sample[i]-x = sample[i]-x - PX; sample[i]-y = sample[i]-y - PY; i++; } return 0; } int selectP (Point *(*sample), const int size, const int useNum) { int i=0, j=0; Point *temp; for(; isize-1; i++) { for(j=i+1; jsize; j++) { if(sample[i]-dis sample[j]-dis) { temp = sample[i]; sample[i] = sample[j]; sample[j] = temp; } } } return 0; } double* getM (const Point *(*p), const int useNum) { double *M = NULL; int i=0; M = (do

文档评论(0)

ktj823 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档