MCPcopy Create free account
hub / github.com/fogleman/primitive / rasterizeTriangleTop

Function rasterizeTriangleTop

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

Source from the content-addressed store, hash-verified

153}
154
155func rasterizeTriangleTop(x1, y1, x2, y2, x3, y3 int, buf []Scanline) []Scanline {
156 s1 := float64(x3-x1) / float64(y3-y1)
157 s2 := float64(x3-x2) / float64(y3-y2)
158 ax := float64(x3)
159 bx := float64(x3)
160 for y := y3; y > y1; y-- {
161 ax -= s1
162 bx -= s2
163 a := int(ax)
164 b := int(bx)
165 if a > b {
166 a, b = b, a
167 }
168 buf = append(buf, Scanline{y, a, b, 0xffff})
169 }
170 return buf
171}

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…