導航:首頁 > 源碼編譯 > 圖形學有序邊表演算法

圖形學有序邊表演算法

發布時間:2022-06-01 19:02:55

❶ 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)下的案例,應該就會了

閱讀全文

與圖形學有序邊表演算法相關的資料

熱點內容
單片機最小系統電路設計流程圖 瀏覽:663
steam源碼 瀏覽:29
關於對數的運演算法則及公式 瀏覽:775
明星談如何緩解壓力 瀏覽:141
androidlistview隱藏列 瀏覽:396
plc跑馬燈編程 瀏覽:816
ios開發之網路編程 瀏覽:421
處理照片視頻哪個app好 瀏覽:386
logback壓縮 瀏覽:888
冰箱壓縮機可以用氣割嗎 瀏覽:531
菜鳥如何加密商品信息 瀏覽:315
程序員那麼可愛小說結局 瀏覽:866
zenity命令 瀏覽:570
監禁風暴哪個app有 瀏覽:871
程序員的愛心是什麼 瀏覽:595
java中對字元串排序 瀏覽:296
單片機用數模轉換生成三角波 瀏覽:640
外網怎麼登陸伺服器地址 瀏覽:140
什麼人要懂編譯原理 瀏覽:154
源碼改單 瀏覽:719