MCPcopy Index your code
hub / github.com/fogleman/primitive / rasterizeTriangleBottom

Function rasterizeTriangleBottom

primitive/triangle.go:137–153  ·  view source on GitHub ↗
(x1, y1, x2, y2, x3, y3 int, buf []Scanline)

Source from the content-addressed store, hash-verified

135}
136
137func rasterizeTriangleBottom(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline {
138 s1 := float64(x2-x1) / float64(y2-y1)
139 s2 := float64(x3-x1) / float64(y3-y1)
140 ax := float64(x1)
141 bx := float64(x1)
142 for y := y1; y <= y2; y++ {
143 a := int(ax)
144 b := int(bx)
145 ax += s1
146 bx += s2
147 if a > b {
148 a, b = b, a
149 }
150 buf = append(buf, Scanline{y, a, b, 0xffff})
151 }
152 return buf
153}
154
155func rasterizeTriangleTop(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline {
156 s1 := float64(x3-x1) / float64(y3-y1)

Callers 1

rasterizeTriangleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…