• Nenhum resultado encontrado

Scanline Fill Algorithm

N/A
N/A
Protected

Academic year: 2023

Share "Scanline Fill Algorithm"

Copied!
5
0
0

Texto

(1)

Scanline Fill Algorithm

− Intersect scanline with polygon edges

− Fill between pairs of intersections

− Basic algorithm:

For y = ymin to ymax

1) intersect scanline y with each edge 2) sort interesections by increasing x [p0,p1,p2,p3]

3) fill pairwise (p0 −> p1, p2−> p3, ....)

p0 p1 p2 p3

ymin ymax

(2)

However, we need to handle some special cases and improve the performance

Special handling:

a) Make sure we only fill the interior pixels Define interior:

For a given pair of intersectin points (Xi, Y), (Xj, Y)

−> Fill ceiling(Xi) to floor(Xj)

important when we have polygons adjacent to each other

b) Intersection has an integer X coordinate −> if Xi is integer, we define it to be interior −> if Xj is integer, we define it to be exterior (so don’t fill)

(3)

Special handling (cont’d)

c) Intersection is an edge end point

ymin ymax

p0 p1 p2

Intersection points: (p0, p1, p2) ???

−> (p0,p1,p1,p2) so we can still fill pairwise

−> In fact, if we compute the intersection of the scanline with edge e1 and e2 separately, we will get the intersection point p1 twice.

Keep both of the p1.

e1 e2 scanline

(4)

Special handling (cont’d)

c) Intersection is an edge end point (cont’d)

However, in this case we don’t want to count p1 twice (p0,p1,p1,p2,p3), otherwise we will fill pixels between p1 and p2, which is wrong

p0 p1 p2 p3e1 e2

(5)

Special handling (cont’d)

c) Intersection is an edge end point (cont’d) Rule:

If the intersection is the ymin of the edge’s endpoint, count it. Otherwise, don’t.

ymin ymax

p0 p1 p2

e1 e2

scanline Yes, count

p1 for both e1 and e2

p0 p1 p2 p3e1 e2

No, don’t count p1 for the edge e2

Referências

Documentos relacionados

The DVD cutoff point that best represents DUS accuracy to assess AVF maturity for hemodialysis is located at the point of intersection of the accuracy, sensitivity and

A Cultura Organizacional tradições, 22,5% 27,5% 30% práticas e costumes adotados no TJPB – Comarca de Campina Grande, favorece a execução das minhas atividades na instituição O

Valley fold the bottom point up so that the intersection of the edge of the paper and the angle bisector from Step 1 lays on the crease line from Step 2.. Rotate the

Depois do término do mestrado, não dei continuidade ao estudo, mas gostaria muito de fazê-lo, pois alguns entrevistados naquela época diziam acreditar que as calçadas

The full characterisation of strong normalisation ( M is strong normalising if and only if M is typeable) is a property that is shown for various intersection systems for the

After having got the picture of the complex behaviour exhibited by this cellular automata in the transition region, let us focus our attention onto two other questions: (1) how does

Ressalta-se então, a importância de haver clareza quanto ao significado da EPS para que, desse modo, seja possível um melhor desenvolvimento de ações voltadas a

Among the causes of pain, intersection syndrome is highlighted, corresponding to an inflammatory process affecting the tendons of the second compartment of the forearm