//-------------------------------------------------------------------- // 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). public void SetTriangle(double x1, double y1, double x2, double y2, double x3, double y3) { _coord_0.x = _x[0] = x1; _coord_0.y = _y[0] = y1; _coord_1.x = _x[1] = x2; _coord_1.y = _y[1] = y2; _coord_2.x = _x[2] = x3; _coord_2.y = _y[2] = y3; _cmd[0] = VertexCmd.MoveTo; _cmd[1] = VertexCmd.LineTo; _cmd[2] = VertexCmd.LineTo; _cmd[3] = VertexCmd.NoMore; if (DilationValue != 0.0) { AggMath.DilateTriangle(_coord_0.x, _coord_0.y, _coord_1.x, _coord_1.y, _coord_2.x, _coord_2.y, _x, _y, DilationValue); AggMath.CalcIntersect(_x[4], _y[4], _x[5], _y[5], _x[0], _y[0], _x[1], _y[1], out _coord_0.x, out _coord_0.y); AggMath.CalcIntersect(_x[0], _y[0], _x[1], _y[1], _x[2], _y[2], _x[3], _y[3], out _coord_1.x, out _coord_1.y); AggMath.CalcIntersect(_x[2], _y[2], _x[3], _y[3], _x[4], _y[4], _x[5], _y[5], out _coord_2.x, out _coord_2.y); _cmd[3] = VertexCmd.LineTo; _cmd[4] = VertexCmd.LineTo; _cmd[5] = VertexCmd.LineTo; _cmd[6] = VertexCmd.NoMore; } }
//-------------------------------------------------------------------- // 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). public void SetTriangle(double x1, double y1, double x2, double y2, double x3, double y3, double d) { m_coord_0.x = m_x[0] = x1; m_coord_0.y = m_y[0] = y1; m_coord_1.x = m_x[1] = x2; m_coord_1.y = m_y[1] = y2; m_coord_2.x = m_x[2] = x3; m_coord_2.y = m_y[2] = y3; m_cmd[0] = VertexCmd.MoveTo; m_cmd[1] = VertexCmd.LineTo; m_cmd[2] = VertexCmd.LineTo; m_cmd[3] = VertexCmd.NoMore; if (d != 0.0) { AggMath.DilateTriangle(m_coord_0.x, m_coord_0.y, m_coord_1.x, m_coord_1.y, m_coord_2.x, m_coord_2.y, m_x, m_y, d); AggMath.CalcIntersect(m_x[4], m_y[4], m_x[5], m_y[5], m_x[0], m_y[0], m_x[1], m_y[1], out m_coord_0.x, out m_coord_0.y); AggMath.CalcIntersect(m_x[0], m_y[0], m_x[1], m_y[1], m_x[2], m_y[2], m_x[3], m_y[3], out m_coord_1.x, out m_coord_1.y); AggMath.CalcIntersect(m_x[2], m_y[2], m_x[3], m_y[3], m_x[4], m_y[4], m_x[5], m_y[5], out m_coord_2.x, out m_coord_2.y); m_cmd[3] = VertexCmd.LineTo; m_cmd[4] = VertexCmd.LineTo; m_cmd[5] = VertexCmd.LineTo; m_cmd[6] = VertexCmd.NoMore; } }