Content deleted Content added
m decapitalise, replaced: == External Links == → == External links == |
No edit summary |
||
Line 5:
== Algorithm ==
Conceptually
# Sort each polygon by depth
# Place each polygon from the furthest polygon to the closest polygon
===
=== Time
The painter's algorithm's time-complexity is heavily dependent on the sorting algorithm used to order the polygons. Assuming the use of the most optimal sorting algorithm, painter's algorithm has a worst-case complexity of ''[[Big O notation|O]]''(''n'' log ''n + m*n''), where ''n'' is the number of polygons and ''m'' is the number of pixels to be filled.
=== Space
The painter's algorithm's worst-case space-complexity is ''O''(''n+m''), where ''n'' is the number of polygons and ''m'' is the number of pixels to be filled.
Line 26:
There are two primary technical requisites that favor the use of the painter’s algorithm.
=== Basic
The
=== Memory
In the early 70s, when the painter’s algorithm was developed, physical memory was relatively small.<ref>{{Cite journal|last1=Freiser|first1=M.|last2=Marcus|first2=P.|date=June 1969|title=A survey of some physical limitations on computer elements|url=https://ieeexplore.ieee.org/document/1066403|journal=IEEE Transactions on Magnetics|volume=5|issue=2|pages=82–90|doi=10.1109/TMAG.1969.1066403|bibcode=1969ITM.....5...82F|issn=1941-0069}}</ref> This required programs to manage memory as efficiently as possible to conduct large tasks without crashing. The painter’s algorithm prioritizes the efficient use of memory but at the expense of higher processing power since all parts of all images must be rendered.<ref name=":1" />[[File:Painters problem.svg|thumb|right|Overlapping polygons can cause the algorithm to fail|285x285px]]
== Limitations ==
Line 36:
In the case of cyclic overlap, as shown in the figure to the right, Polygons A, B, and C overlap each other in such a way that it is impossible to determine which polygon is above the others. In this case, the offending polygons must be cut to allow sorting.<ref name=":0" />
=== Piercing
The case of piercing polygons arises when one polygon intersects another. Similar to cyclic overlap, this problem may be resolved by cutting the offending polygons.<ref name=":0" />
Line 73:
== External links ==
* [
▲* [http://www.cs.cmu.edu/afs/cs/project/anim/ph/463.96/pub/www/notes/zbuf.2.pdf Painter’s & Z-Buffer Algorithms and Polygon Rendering]
* https://www.clear.rice.edu/comp360/lectures/old/HiddenSurfText.pdf
* https://www.cs.princeton.edu/courses/archive/spring01/cs598b/papers/greene93.pdf
|