What's the best way to fill in a triangle?
What's the best way to fill in a triangle?
I just figured out how to do it. My book was talking about rasterization of polygons. Though it does some complicated stuff with vectors and matricies. I didn't figure out how to do it the way the book said, but the chapter/section on culling did lead me to a question. Which in turn, led me to an idea of filling a triangle by sweeping a line. Unfortunately, my design only works if the 2nd point is to the left of the 3rd (By the nature of the For loops).
So are there better ways, and ways that don't leave holes at the edges?
And what is the deffinition of rasterization. The book says everything about rasterization except the definition.
So are there better ways, and ways that don't leave holes at the edges?
And what is the deffinition of rasterization. The book says everything about rasterization except the definition.
For any grievances posted above, I blame whoever is in charge . . .
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
You did not mention what programming language, but QBasic can use PAINT. It requires an enclosed shape of one border color only.
PAINT(x, y), fillcolor, bordercolor
You also have to place the PAINT coordinates x and y inside of the shape.
Ted
PAINT(x, y), fillcolor, bordercolor
You also have to place the PAINT coordinates x and y inside of the shape.
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Rasterization or rasterisation is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (pixels or dots) for output on a video display or printer.
and you should get good info on this too..
http://en.wikipedia.org/wiki/Rasterisation
because i think this is what you are looking for..
and you should get good info on this too..
http://en.wikipedia.org/wiki/Rasterisation
because i think this is what you are looking for..
- Codemss
- Veteran
- Posts: 124
- Joined: Sun Jun 24, 2007 6:49 am
- Location: Utrecht, The Netherlands
- Contact:
Well, I thibk it has something to do with interpolation and flat bottom and flat top triangles. Check out this article:
http://www.petesqbsite.com/sections/tut ... apter3.htm
If you scroll a bit down, to: 'III. Different Polygon fillers', there is MUCH info on how to make polygon fillers. Solid, but also with interpolating colours, and even environment mapped polygons.
Also look on Petesqbsite > tutorials > Graphics, then look at some of the 3d series (the link I sended you is that from Relsoft).
http://www.petesqbsite.com/sections/tut ... apter3.htm
If you scroll a bit down, to: 'III. Different Polygon fillers', there is MUCH info on how to make polygon fillers. Solid, but also with interpolating colours, and even environment mapped polygons.
Also look on Petesqbsite > tutorials > Graphics, then look at some of the 3d series (the link I sended you is that from Relsoft).
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL