-------------------------------------------------------------------- Sets the triangle and dilates it if needed. The trick here is to calculate beveled joins in the vertices of the triangle and render it as a 6-vertex polygon. It's necessary to achieve numerical stability. However, the coordinates to interpolate colors are calculated as miter joins (calc_intersection).
| 72 | // However, the coordinates to interpolate colors are calculated |
| 73 | // as miter joins (calc_intersection). |
| 74 | void triangle(double x1, double y1, |
| 75 | double x2, double y2, |
| 76 | double x3, double y3, |
| 77 | double d) |
| 78 | { |
| 79 | m_coord[0].x = m_x[0] = x1; |
| 80 | m_coord[0].y = m_y[0] = y1; |
| 81 | m_coord[1].x = m_x[1] = x2; |
| 82 | m_coord[1].y = m_y[1] = y2; |
| 83 | m_coord[2].x = m_x[2] = x3; |
| 84 | m_coord[2].y = m_y[2] = y3; |
| 85 | m_cmd[0] = path_cmd_move_to; |
| 86 | m_cmd[1] = path_cmd_line_to; |
| 87 | m_cmd[2] = path_cmd_line_to; |
| 88 | m_cmd[3] = path_cmd_stop; |
| 89 | |
| 90 | if(d != 0.0) |
| 91 | { |
| 92 | dilate_triangle(m_coord[0].x, m_coord[0].y, |
| 93 | m_coord[1].x, m_coord[1].y, |
| 94 | m_coord[2].x, m_coord[2].y, |
| 95 | m_x, m_y, d); |
| 96 | |
| 97 | calc_intersection(m_x[4], m_y[4], m_x[5], m_y[5], |
| 98 | m_x[0], m_y[0], m_x[1], m_y[1], |
| 99 | &m_coord[0].x, &m_coord[0].y); |
| 100 | |
| 101 | calc_intersection(m_x[0], m_y[0], m_x[1], m_y[1], |
| 102 | m_x[2], m_y[2], m_x[3], m_y[3], |
| 103 | &m_coord[1].x, &m_coord[1].y); |
| 104 | |
| 105 | calc_intersection(m_x[2], m_y[2], m_x[3], m_y[3], |
| 106 | m_x[4], m_y[4], m_x[5], m_y[5], |
| 107 | &m_coord[2].x, &m_coord[2].y); |
| 108 | m_cmd[3] = path_cmd_line_to; |
| 109 | m_cmd[4] = path_cmd_line_to; |
| 110 | m_cmd[5] = path_cmd_line_to; |
| 111 | m_cmd[6] = path_cmd_stop; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | //-------------------------------------------------------------------- |
| 116 | // Vertex Source Interface to feed the coordinates to the rasterizer |
nothing calls this directly
no test coverage detected