❶ vc++ 计算机图形学相关的算法有哪些
你可以看看网络文库中的这篇《计算机图形学各种算法VC++版本》
❷ 计算机图形学问题
1、直线的生成和2种算法:DDA算法:代码如下
void dda(Graphics g,int x1,int x2,int y1,int y2)
{int k;
float x,y,dx,dy;
k=Math.abs(x2-x1);
if(Math.abs(y2-y1)>k)
k=Math.abs(y2-y1);
dx=(float)(x2-x1)/k;
dy=(float)(y2-y1)/k;
x=(float)x1;
y=(float)y1;
for(int i=0;i<k;i++)
drawLine((int)x+.5f,((int)y+.5f,((int)x+.5f.((int)y+.5f);
x=x+dx;
y=y+dy;
}
}
Breseham算法;
2、填充的定义和2种算法分别是
扫描线种子填充算法和递归算法
3、图像学的定义与运用
定义是研究如何在计算机环境下生成,处理和现实图形的一门学科。具体应用很广泛:像有些公司在制造汽车,飞机等时,会先画出制图,一般都会在计算机上绘制出来;等等吧
❸ 计算机图形学考题
一、单项选择题(本大题共10小题,每小题3分,共30分)提示:在每小题列出的四个备选项中只有一个是符合题目要求的,请将其代码填写在题后的括号内。错选、多选或未选均无分
1)灰度等级为256级,分辨率为1024*1024的显示模式,至少需要的帧缓存容量为___bit。
A、7M B、8M
C、10M D、16M
2) __是在高于显示分辨率的较高分辨率下用点取样方法计算,然后对几个像素的属性进行平均得到较低分辨率下的像素属性。实际上是把显示器看成是比实际更细的网格来增加取样率。
A、提高显示分辨率
B、图像分割
C、过取样(supersampling)
D、区域取样(areasampling)
3)用一个n位的整数表示一个位串,用它控制线型时,可以n个像素为周期进行重复显示。若Patten=11100101,
而i表示画线程序中的第i个像素,则画线程序中的SETPIXEL(X,Y,COLOR)可改写为__
A、if(pattern[i%4])setixel(x,y,color);
B、if(pattern[i%6])setixel(x,y,color);
C、if(pattern[i%8])setixel(x,y,color);
D、if(pattern[i%12])setixel(x,y,color);
4、点P的齐次坐标为(8,6,2),其对应的空间坐标为__ __。
A、(8,6,2) B、(8,6)
C、(4,3,1) D、(4,3)
5)在多边形的逐边裁剪法中,对于某条多边形的边(方向为从端点S到端点P)与某条裁剪线(窗口的某一边)的比较结果共有以下四种情况,分别需输出一些顶点.请问哪种情况下输出的顶点是错误的_____。
A:S和P均在可见的一侧,则输出S和P.
B:S和P均在不可见的一侧,则不输出顶点.
C:S在可见一侧,P在不可见一侧,则输出线段SP与裁剪线的交点.
D:S在不可见的一侧,P在可见的一侧,则输出线段SP与裁剪线的交点和P.
6)扫描线多边形填充算法中,对于扫描线同各边的交点的处理具有特殊性。穿过某两条边的共享顶点的扫描线与这两条边的交点数只能计为___交点:
A、0 个 B、1个
C、2个 D、3个
7、如果观察方向(视线方向)为Z轴负向,观察向量可设为V=(0,0,-1),则对场景中的图形表平面可判定其可见性。令某平面的法向量为N=(A,B,C)。当___时,该平面可判定为后向面(Back-Face)即是观察时不可见的面。
A、C<=0 B、C>=0
C、A>=0 D、B<=0
8、多边形面的平面方程为:Ax+By+Cz+D=0。投影后,若扫描线上起始点的深度值为,
则该面的扫描线上所有后继点的深度值计算公式为__ _
A)z(x+1,y)=z(x,y)+A/C
B)z(x+1,y)=z(x,y)-A/C
C)z(x+1,y)=z(x,y)+C/A
D)z(x+1,y)=z(x,y)-C/A
9)当观察光照下的光滑物体表面时,在某个方向上看到高光或强光,这个现象称为__ _
A、漫反射 B、镜面反射 C、环境光 D、折射
10)、绘制样条曲线时,如果控制点中的任一个发生了变动,则整条曲线都将受到影响的是_ __曲线:
A、自然三次样条
B、Hermite插值样条
C、Cardinal样条
D、Korchanek-Bartels样条
二、判断题(本大题共5小题,每小题2分,共10分)提示:正确打,错误打,并分别简述理由。
1、 处理器的主要任务是将应用程序给出的图形定义数字化为一组像素强度值,并存放在帧缓存中,这个数字化过程称为扫描转换。
2、绕多边形的边界,计算相邻边界向量的叉乘可识别出该多边形是凸还是凹多边形。如果叉乘结果全部为正则为凹多边形;若有正有负,则为凸多边形。
3、使用查色表可以提供合理的能够同时显示的颜色数,而无须大容量的帧缓冲器。这时,帧缓冲器中存放的是真正的颜色编码。
4、某种颜色,在GRB颜色模型下坐标值(1,0.7,0.8),在CMY颜色模型下也是(1,0.7,0.8)
5、透视投影变换后,图形中的不平行于观察平面的各组平行线的延长线,能够汇聚成最多3个灭点。
三.计算推导题目(本大题共2小题,每小题10分,共20分)。
1.给定四点P1(0,0,0),P2(1,1,1),P3(2,-1,-1),P4(3,0,0)。用其作为特征多边形来构造一条三次贝塞尔曲线段,请写出该曲线的参数化表达式,并计算参数为1、2/3时曲线上点的值。
2.用Liang-Barsky线段裁剪方法,使用窗口(0,0)(2,2)裁剪以下线段,要求写出计算步骤和裁剪结果。
a)线段A(1,-2)B(1,2)
四.变换题(本大题共3小题,每小题10分,共30分)。提示:用列向量表示,注意矩阵乘的顺序。用齐次坐标表示变换矩阵。不要求计算出最后结果,但是每个矩阵要表示出来。
1.二维空间中,图形绕点(-1,-2),顺时针旋转50度的变换矩阵。
2.在XOY二维平面坐标系中有点P(4,1)和点O’(3,4)。现以O’P作为Y’轴正向建立新坐标系X’O’Y’(都是右手坐标系),请写出图形由XOY到X’O’Y’的坐标变换矩阵。
3.设投影参考点为(0,0,d),投影面为xoy平面,请推导投影变换矩阵。
五、编程及分析题(本大题共1小题,每题10分,共10分),
1. 请根据中点圆生成算法思想,对圆x2+y2=R2,推出第一象限中从y=0到y=x这段弧的生成算法。要求推导出主要的计算公式,并写出算法(描述性算法)。提示这一段上,y的变换率比x大。
这个行不,要答案找我
❹ 计算机图形学ET表怎么写
你要问的是计算机图形学ET表怎么用吧。ET表是基于桶排序的方式建立的,有多少扫描线就有多少个桶,每一个桶对应一个链表,每一个链表中的边的下端端点的纵坐标是相同的。
在多边形的扫描转换算法中,我们首先需要建立一个全局的边表,它包含多边形的所有边,并且这些边按照它们各自y坐标较小值排序。
❺ 高分!!!急~~~~一道计算机图形学算法的问题。。
#include <conio.h>
#include <stdio.h>
#include <graphics.h>
void MidBresenhamLine(int x0,int y0,int x1,int y1,int color);
int main(void)
{
int GraphDriver;
int GraphMode;
GraphDriver = DETECT;
initgraph(&GraphDriver, &GraphMode, "");
MidBresenhamLine(10, 10, 300, 300, 12);
getch();
closegraph();
return 0;
}
void MidBresenhamLine(int x0,int y0,int x1,int y1,int color)
{
int dx,dy,d,UpIncre,DownIncre,x,y;
if(x0>x1)
{
x=x1;x1=x0;x0=x;
y=y1;y1=y0;y0=y;
}
x=x0;y=y0;
dx=x1-x0;
dy=y1-y0;
d=dx-2*dy;
UpIncre=2*dx-2*dy;
DownIncre=-2*dy;
while(x<=x1)
{
putpixel(x,y,color);
x++;
if(d<0)
{
y++;
d+=UpIncre;
}
else
d+=DownIncre;
}
}
❻ 计算机图形学 活性边表填充算法的一道题求详细解答
ET表是记录每个顶点 AET表是每条线 比如y=4,5,6,7,8
❼ 计算机图形学所涉及的算法有哪些
图论吗?数据结构书上有啊,比如迪杰斯特拉算法,普里姆算法,弗洛伊德算法等等
❽ 计算机图形学的weiler-atherton算法代码
CS 535
WEILER-ATHERTON
PROBLEM
Implement Weiler-Atherton. You should draw each polygon in a different color and fill the clip areas generated with a third color.
NOTES:
The Weiler-Atherton algorithm is the most general of the clipping algorithms. We have two 2D polygons (may be convex or concave and they both may have holes). The polygon to be clipped is called the SUBJECT polygon and the polygon defining the clipping area is called the CLIP polygon. To make the algorithm work easier (in the data structures, etc.) we usually assume that the exterior vertices are given clockwise and the hole vertices are given counterclockwise. In clipping we usually want to find the parts of the subject polygon that are inside the clip polygon. However, this algorithm can be used in modeling to find the "union", "intersection", and "difference" of the polygons.
The data structures are several circular linked lists of vertices which are also linked together and the clipping is done by traversing these. The lists could be doubly linked. This enables the traversal in either direction at any node in the list. Starting at a particular node and traversing in one direction will proce the interior polygon(s) while starting at a different node and traversing can proce the outside. Note that procing the exterior does need the doubly linking and care must be taken in performing the traversal.
STEP 1:
The first phase of the building of the data structures occurs when we input the edges and put them in two linked lists - the SUBJ list and the CLIP list. The vertices are place in order from input (thus clockwise). There are separate lists for the exterior and for each hole. Thus, the initial build is a standard queue insert (input a vertex - insert it at end of list). Note that this creates a list in which a standard list traversal is equivalent to "walking around" the polygon edge visiting the vertices in order.
STEP 2:
The second phase of the list building is computing and inserting the INTERSECTION points. If we have a SUBJECT polygon edge (SVi to SVi+1) that intersects a CLIP polygon edge (CVj to CVj+1) at a point INTER. Note that the edges form straight lines that may intersect, we are assuming that the line segments SVi to SVi+1 intersects the line segment CVj to CVj+1. The intersection point INTER is then inserted on BOTH of the linked lists - SUBJ and CLIP. It is inserted BETWEEN SVi and SVi+1 on the SUBJ list and CVj and CVj+1 on the CLIP list. The idea is still that traversing the list using a standard list traversal we would encounter the points in their geometric order. Note that there may be several intersection points between any given pair of vertices and they must be inserted in the correct order in the lists. This is done by using the t and u values computed in the vector line intersection subprogram. Each intersection point thus has TWO nodes - one on each list (SUBJ and CLIP). We link these two entries together which provides a way of getting from one list to the other.
STEP 2.5:
Any straight line divides the plane into two half-planes. Thus each polygon edge (extended to a line) will divide the plane into two half-planes. Because we listed the vertices clockwise, we consider the half-plane to the right as containing the interior of the polygon. Thus the right half-plane is called the interior half-plane. If we consider ourselves as "walking along" a polygon edge, then we can categorize each of the INTERSECTION points as "entering" or "exiting". This is usually done from the SUBJ polygon's point of view. Thus, as we walk along the SUBJ polygon edge SVi to SVi+1 and we encounter intersection point INTER, we can ask the question - am I "entering" the CLIP polygon or am I "exiting" the CLIP polygon? The second part of computing the intersection point is to classify them as "entering" or "exiting". We create one or two lists - one for entering intersections and one for exiting intersections.
STEP3:
Once the lists are built the basic idea to do the clipping is as follows
Pick an entry from the ENTERING list - it will be an intersection point (and delete it)
Locate that point on the SUBJ list
Traverse the current (SUBJ) list until you find the next intersection point - it should be an exiting or entering point. Output each vertex encountered to some data structure, say POLY
Follow the link from the current (SUBJ) list to the other (CLIP) list and
Continue the traversal until you find the next intersection (Note: delete each entering intersection from the ENTERING list - not the linked lists. By deleting it we will get the distinct intersecting polygons and not plicate a polygon multiple times).
Terminate the traversal when you get to an intersection that is the SAME as the initial one that you removed from the ENTERING list. At this point POLY will have one of the clip regions and can be output.
REPEAT the construction and output of POLY until the ENTERING list is empty.
Remark: For the exterior, try starting with an EXITING point. Start the traversal on the SUBJ list (same direction as the Interior). At what point do you need to use the double link and to traverse in the opposite direction? (Hint: look at the CLIP polygon list).
IMPLEMENTATION:
In the below data structures we place all of the vertices and intersection points in a 1D array and use the subscript instead of the actual coordinates.
const int MAXVERT = 500;
const int MAXPOLYV = 50;
const int MAXH = 10;
struct Point2D
{float x,y;
};
typedef Point2D Vertices[MAXVERT];
enum VerType = {Polygon, Intersection};
typedef struct ClipListRec * ClipPtr;
struct ClipListRec
{ int Vindex;
ClipPtr next;
VerType Kind;
float t;
ClipPtr otherList;
}
struct Polygon
{ int nVertex;
int vert[MAXPOLYV];
ClipPtr list;
}
struct GenPolygon
{ Polygon exterior;
int numHoles;
Polygon Holes[MAXH];
}
GenPolygon Sub,Clip;
int entering[MAXVERT],exiting[MAXVERT];
Vertices V;
int numVertex = 0; // size of the array of verticies
int clipPoly[MAXVERT]; // a clip polygon
int readPoint();
{ cin >> inX; cin >> inY;
if (numVertex < MAXVERT)
{ V[numVertex].x = inX;
V[numVertex].y = inY;
idNo = numVertex;
numVertex++;
}
else
idNo = -1;
return idNo;
}
void readPolygon (GenPolygon p)
{ cin >> p.exterior.nVertex;
for (i = 0; i < p.exterior.nVertex; i++)
{ newId = readPoint();
if (newId < 0)
error
else
{ insertAtRear (p.exterior.list,newId);
p.exterior.vert[i] = newId;
}
}
// now do the holes basically the same way
. . .
}
// the "main" program loop would then be (pseudocode)
while (!EMPTY(entering))
{ nextInter = delete (entering);
SEARCH (SubjectPolygon,nextInter,ptr1);
AddToOutputList (ptr1->. . .)
StartPoint = ptr1->. . .
ptr1 = prt1->next;
while (ptr1->. . . != StartPoint)
{ AddToOutputList (ptr1->. . .);
if (ptr1-> . . == INTERSECTION)
ptr1 = prt1->otherList->next;
else
ptr1 = ptr1->next;
}
FixListForOutput();
DrawPolygon();
EmptyOutputList();
}
❾ 求计算机图形学的中点画抛物线详细算法,已经每一步实现的功能,最好能说一下思想。谢谢!
抛物线是指平面内到一个定点F(焦点)和一条定直线l(准线)距离相等的点的轨迹。它有许多表示方法,例如参数表示,标准方程表示等等。 它在几何光学和力学中有重要的用处。 抛物线也是圆锥曲线的一种,即圆锥面与平行于某条母线的平面相截而得的曲线。二次函数的图像就是一条抛物线,它是一个轴对称图形。抛物线与对称轴的交点叫做抛物线的顶点。抛物线即把物体抛掷出去,落在远处地面,这物体在空中经过的曲线。
平面内,到定点与定直线的距离相等的点的轨迹叫做抛物线。其中定点叫抛物线的焦点,定直线叫抛物线的准线。当抛物线的顶点为原点时,抛物线有以下特征:
①原点在抛物线上;
②对称轴为坐标轴;
③准线与对称轴垂直,垂足与焦点分别对称于原点,它们与原点的距离都等于一次项系数的绝对值的1/4。
对称轴为x轴时,方程右端为±2px,方程的左端为y^2;对称轴为y轴时,方程的右端为±2py,方程的左端为x^2;开口方向与x轴(或y轴)的正半轴相同时,焦点在x轴(y轴)的正半轴上,方程的右端取正号;开口方向与x(或y轴)的负半轴相同时,焦点在x轴(或y轴)的负半轴上,方程的右端取负号。
抛物线的弦是连接抛物线上任意两点的线段。
抛物线的焦弦是经过抛物线焦点的弦。
抛物线的直径是抛物线一组平行弦中点的轨迹。这条直径也叫这组平行弦的共轭直径。
希望我能帮助你解疑释惑。
❿ 求计算机图形学大神!在线等!!!
去看看DX下面这个文件夹(Microsoft DirectX SDK \Samples\C++\Direct3D\Tutorials)下的案例,应该就会了