Contents
- 1 How can I draw a triangle using rasterization?
- 2 Which is the best algorithm to draw a triangle?
- 3 Do you change the Y-iteration direction of the algorithm?
- 4 What are the rasterization rules for Direct3D 10?
- 5 Where can I find Lecture 5 for rasterization?
- 6 How to make a 3D graphics engine with triangles?
How can I draw a triangle using rasterization?
First calculate invslope for each leg. Then just iterate from top (y 1) to bottom (y 2) and add invslope1 and invslope2 to temporary variables – this gives the endpoints of a straight line. No the triangle can easily be drawn by plotting horizontal lines – see the pseudocode of fillBottomTriangle ().
Which is the best algorithm to draw a triangle?
Draw the line V 1 V 2 using the bresenham algorithm, but stop if the algorithm moves one pixel in y-direction. Draw also the line V 1 V 3 using the bresenham algorithm, and stop if the algorithm moves one pixel in y-direction. At this point we are on the same y-coordinate for line V 1 V 2 as well as for line V 1 V 3.
Do you change the Y-iteration direction of the algorithm?
It makes sense to change the y-iteration direction so that vertice v 3 serves as common starting point and iteration goes from bottom to top; the actual algorithm is basically the same as for the flat bottom case:
Is there a way to vectorize a table in NumPy?
Typically ‘vectorizing’ in numpy requires stepping back a bit from the problem and imagining in terms of operations on a table or 2d array of values. (this question would have gotten more attention on SO).
How is the top left rule used in rasterization?
The top-left rule ensures that adjacent triangles are drawn once. This illustration shows examples of pixels that are drawn because they either lie inside a triangle or follow the top-left rule. The light and dark gray covering of the pixels show them as groups of the pixels to indicate which triangle they are inside.
What are the rasterization rules for Direct3D 10?
Direct3D 10 adopts as a guideline the method shown in the following illustration. This method was derived empirically, exhibiting a number of visual properties deemed desirable.
Where can I find Lecture 5 for rasterization?
Rasterization 1 (Triangles) Lecture 5: http://www.cs.ucsb.edu/~lingqi/teaching/games101.html GAMES101 Lingqi Yan, UC Santa Barbara Announcements •Homework 0 — 188 submissions -No worries if you did not submit •Homework 1 will be released today -Containing basic and advanced requirements (graded separately)
How to make a 3D graphics engine with triangles?
We are going to rely heavily on the LineSegment class to create our Triangle and Quad classes, so make sure to refamiliarize yourself with it before moving on. Putting together a Triangle class for the engine is fairly simple, especially since the LineSegment class is where all of our rasterization is actually going to take place.
How to calculate the bounding box of a triangle?
The main idea is as follows: At first determine the bounding box of the triangle. Afterwards test for each point in the box if it lies inside the triangle – if yes just plot the pixel. Yeah… it’s really so easy!