Exemple #1
0
    function Vectors($angle, $size, $option = 0)
    {
        $width = 400;
        $height = 250;
        $svg = '<div class="img-question text-center">
					<svg width="' . $width . '" height="' . $height . '">';
        $paddingX = 50;
        $paddingY = 40;
        $length = 170;
        $Ax = $width - $paddingX - $length;
        $Ay = $height - $paddingY;
        $Bx = $Ax + $length;
        $By = $Ay;
        list($Cx, $Cy) = Rotate($Ax, $Ay, $Bx, $By, 120);
        $Dx = $Cx + $length;
        $Dy = $Cy;
        $svg .= DrawText($Ax - 5, $Ay + 30, '$A$', 12);
        $svg .= DrawText($Bx - 5, $By + 30, '$B$', 12);
        $svg .= DrawText($Cx - 5, $Cy - 10, '$C$', 12);
        $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 50);
        $svg .= DrawVector($Ax, $Ay, $Bx, $By, 'black', 10, 2, 10);
        $svg .= DrawVector($Ax, $Ay, $Cx, $Cy, 'black', 10, 2, 10);
        $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 30, '$' . $size . '$', 12);
        $svg .= DrawText(($Ax + $Cx) / 2 - 23, ($Ay + $Cy) / 2, '$' . $size . '$', 12);
        $svg .= DrawText($Ax + 20, $Ay - 15, '$' . $angle . '°$', 12);
        if ($option) {
            $svg .= DrawVector($Cx, $Cy, $Bx, $By, 'black', 10, 2, 10);
            $svg .= DrawText(($Bx + $Cx) / 2 + 40, ($By + $Cy) / 2 - 10, '$\\overrightarrow{AB}-\\overrightarrow{AC}$', 12, 'black');
        }
        $svg .= '</svg></div>';
        return $svg;
    }
    function Triangle($sides = [], $nodes = [], $colors = [])
    {
        $width = 400;
        $height = 250;
        $paddingX = 50;
        $paddingY = 50;
        $svg = '<div class="img-question text-center">
					<svg width="' . $width . '" height="' . $height . '">';
        $Ax = $paddingX;
        $Ay = $height - $paddingY;
        $Bx = $width - $paddingX;
        $By = $height - $paddingY;
        list($Cx, $Cy) = Triangle($Ax, $Ay, $Bx, $By, 35, 55);
        $svg .= DrawLine($Ax, $Ay, $Bx, $By);
        $svg .= DrawLine($Ax, $Ay, $Cx, $Cy);
        $svg .= DrawLine($Cx, $Cy, $Bx, $By);
        $svg .= DrawText($Ax, $Ay + 25, '$A$', 15);
        $svg .= DrawText($Bx, $By + 25, '$B$', 15);
        $svg .= DrawText($Cx, $Cy - 10, '$C$', 15);
        $svg .= DrawText($Ax + 40, $Ay - 7, '$\\alpha$', 15);
        $svg .= DrawText($Bx - 30, $By - 10, '$\\beta$', 15);
        $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 65);
        $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, 55);
        list($P1x, $P1y) = LinePoint($Cx, $Cy, $Ax, $Ay, 25);
        list($P2x, $P2y) = LinePoint($Cx, $Cy, $Bx, $By, 25);
        list($P3x, $P3y) = Translate($P1x, $P1y, 25, $Cx, $Cy, $Bx, $By);
        $svg .= DrawLine($P1x, $P1y, $P3x, $P3y);
        $svg .= DrawLine($P2x, $P2y, $P3x, $P3y);
        foreach ($sides as $key => $side) {
            switch ($side) {
                case 'AC':
                case 'CA':
                    $svg .= DrawLine($Ax, $Ay, $Cx, $Cy, $colors[$key], 2);
                    $svg .= DrawText(($Ax + $Cx) / 2 - 20, ($Ay + $Cy) / 2, '$\\textcolor{' . $colors[$key] . '}{' . $nodes[$key] . '}$', 15);
                    break;
                case 'AB':
                case 'BA':
                    $svg .= DrawLine($Ax, $Ay, $Bx, $By, $colors[$key], 2);
                    $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 25, '$\\textcolor{' . $colors[$key] . '}{' . $nodes[$key] . '}$', 15);
                    break;
                case 'BC':
                case 'CB':
                    $svg .= DrawLine($Bx, $By, $Cx, $Cy, $colors[$key], 2);
                    $svg .= DrawText(($Bx + $Cx) / 2 + 20, ($By + $Cy) / 2, '$\\textcolor{' . $colors[$key] . '}{' . $nodes[$key] . '}$', 15);
                    break;
            }
        }
        $svg .= '</svg></div>';
        return $svg;
    }
    function Trapez($bottom, $top, $side, $progress = 0)
    {
        $width = 350;
        $height = 250;
        $paddingX_top = 110;
        $paddingX_bottom = 20;
        $paddingY = 50;
        $radius = 40;
        $Ax = $paddingX_bottom;
        $Ay = $height - $paddingY;
        $Bx = $width - $paddingX_bottom;
        $By = $height - $paddingY;
        $Cx = $width - $paddingX_top;
        $Cy = $paddingY;
        $Dx = $paddingX_top;
        $Dy = $paddingY;
        $Ex = $paddingX_top;
        $Ey = $height - $paddingY;
        $Fx = $width - $paddingX_top;
        $Fy = $height - $paddingY;
        $svg = '<div class="img-question text-center">
				<svg width="' . $width . '" height="' . $height . '">';
        // Sides
        $svg .= DrawLine($Ax, $Ay, $Bx, $By, 'black', 2);
        $svg .= DrawLine($Bx, $By, $Cx, $Cy, 'black', 2);
        $svg .= DrawLine($Cx, $Cy, $Dx, $Dy, 'black', 2);
        $svg .= DrawLine($Dx, $Dy, $Ax, $Ay, 'black', 2);
        // Nodes
        $svg .= DrawText($Ax - 13, $Ay, '$A$', 12);
        $svg .= DrawText($Bx + 13, $By, '$B$', 12);
        $svg .= DrawText($Cx + 13, $Cy, '$C$', 12);
        $svg .= DrawText($Dx - 13, $Dy, '$D$', 12);
        // Arcs
        $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, $radius);
        $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, $radius);
        $svg .= DrawArc($Cx, $Cy, $Dx, $Dy, $Bx, $By, $radius);
        $svg .= DrawArc($Dx, $Dy, $Ax, $Ay, $Cx, $Cy, $radius);
        // Lengths
        $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $bottom . '$', 12);
        $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
        $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
        $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        $svg .= '</svg></div>';
        return $svg;
    }
 /**
  *
  *
  */
 public function drawArc($x, $y, $r, $sd, $ed, $property = array())
 {
     $width = $this->getWidth();
     $height = $this->getHeight();
     $borderColor = NewPixelWand(isset($property['borderColor']) ? $property['borderColor'] : 'black');
     $fillColor = NewPixelWand(isset($property['fillColor']) ? $property['fillColor'] : 'none');
     $none = NewPixelWand('none');
     $picWand = NewMagickWand();
     MagickNewImage($picWand, $width, $height, $none);
     $drawWand = NewDrawingWand();
     DrawSetStrokeWidth($drawWand, $property['borderWidth']);
     DrawSetStrokeColor($drawWand, $borderColor);
     DrawSetFillColor($drawWand, $fillColor);
     $x *= 2;
     $y *= 2;
     $r *= 2;
     $sx = $x - $r;
     $sy = $y - $r;
     $ex = $x + $r;
     $ey = $y + $r;
     DrawArc($drawWand, $sx, $sy, $ex, $ey, $sd, $ed);
     MagickDrawImage($picWand, $drawWand);
     return MagickCompositeImage(self::$resource, $picWand, MW_OverCompositeOp, $sx, $sy);
 }
Exemple #5
0
    function Vectors($angle, $size, $option = 0)
    {
        $width = 400;
        $height = 250;
        $svg = '<div class="img-question text-center">
					<svg width="' . $width . '" height="' . $height . '">';
        if ($angle == 60) {
            $paddingX = 50;
            $paddingY = 50;
            $length = 170;
            $Ax = $paddingX;
            $Ay = $height - $paddingY;
            $Bx = $Ax + $length;
            $By = $Ay;
            list($Cx, $Cy) = Rotate($Ax, $Ay, $Bx, $By, 60);
            $Dx = $Cx + $length;
            $Dy = $Cy;
            $svg .= DrawText($Ax - 5, $Ay + 30, '$A$', 12);
            $svg .= DrawText($Bx - 5, $By + 30, '$B$', 12);
            $svg .= DrawText($Cx - 5, $Cy - 10, '$C$', 12);
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 70);
            $svg .= DrawVector($Ax, $Ay, $Bx, $By, 'black', 10, 2, 30);
            $svg .= DrawVector($Ax, $Ay, $Cx, $Cy, 'black', 10, 2, 30);
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 30, '$' . $size . '$', 12);
            $svg .= DrawText(($Ax + $Cx) / 2 - 13, ($Ay + $Cy) / 2, '$' . $size . '$', 12);
            if (!$option) {
                $svg .= DrawText($Ax + 40, $Ay - 15, '$60°$', 12);
            } else {
                $svg .= DrawPath($Bx, $By, $Cx, $Cy, 'black', 2, 'none', 2, 2);
                if ($option == 2) {
                    $svg .= DrawPath($Bx, $By, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                    $svg .= DrawPath($Cx, $Cy, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                    $svg .= DrawVector($Ax, $Ay, $Dx, $Dy, 'black', 10, 2, 30);
                    $svg .= DrawText($Dx - 15, $Dy - 10, '$\\overrightarrow{AB}+\\overrightarrow{AC}$', 12, 'black');
                } else {
                    $svg .= DrawText($Ax + 40, $Ay - 15, '$60°$', 12);
                }
            }
        } elseif ($angle == 90) {
            $paddingX = 50;
            $paddingY = 40;
            $length = 170;
            $Ax = ($width - $length) / 2;
            $Ay = $height - $paddingY;
            $Bx = $Ax + $length;
            $By = $Ay;
            list($Cx, $Cy) = Rotate($Ax, $Ay, $Bx, $By, $angle);
            $Dx = $Cx + $length;
            $Dy = $Cy;
            $svg .= DrawText($Ax - 5, $Ay + 30, '$A$', 12);
            $svg .= DrawText($Bx - 5, $By + 30, '$B$', 12);
            $svg .= DrawText($Cx - 5, $Cy - 10, '$C$', 12);
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 60);
            $svg .= DrawVector($Ax, $Ay, $Bx, $By, 'black', 10, 2, 30);
            $svg .= DrawVector($Ax, $Ay, $Cx, $Cy, 'black', 10, 2, 30);
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 30, '$' . $size . '$', 12);
            $svg .= DrawText(($Ax + $Cx) / 2 - 13, ($Ay + $Cy) / 2, '$' . $size . '$', 12);
            if (!$option) {
                $svg .= DrawText($Ax + 25, $Ay - 15, '$90°$', 12);
            } else {
                $svg .= DrawPath($Bx, $By, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                $svg .= DrawPath($Cx, $Cy, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                if ($option == 2) {
                    $svg .= DrawVector($Ax, $Ay, $Dx, $Dy, 'black', 10, 2, 30);
                    $svg .= DrawText($Dx - 15, $Dy - 10, '$\\overrightarrow{AB}+\\overrightarrow{AC}$', 12, 'black');
                } else {
                    $svg .= DrawText($Ax + 25, $Ay - 15, '$90°$', 12);
                }
            }
        } elseif ($angle == 120) {
            $paddingX = 50;
            $paddingY = 40;
            $length = 170;
            $Ax = $width - $paddingX - $length;
            $Ay = $height - $paddingY;
            $Bx = $Ax + $length;
            $By = $Ay;
            list($Cx, $Cy) = Rotate($Ax, $Ay, $Bx, $By, $angle);
            $Dx = $Cx + $length;
            $Dy = $Cy;
            $svg .= DrawText($Ax - 5, $Ay + 30, '$A$', 12);
            $svg .= DrawText($Bx - 5, $By + 30, '$B$', 12);
            $svg .= DrawText($Cx - 5, $Cy - 10, '$C$', 12);
            $svg .= DrawVector($Ax, $Ay, $Bx, $By, 'black', 10, 2, 30);
            $svg .= DrawVector($Ax, $Ay, $Cx, $Cy, 'black', 10, 2, 30);
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 30, '$' . $size . '$', 12);
            $svg .= DrawText(($Ax + $Cx) / 2 - 13, ($Ay + $Cy) / 2, '$' . $size . '$', 12);
            if (!$option) {
                $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 50);
                $svg .= DrawText($Ax + 20, $Ay - 15, '$120°$', 12);
            } else {
                $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, 50);
                $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, 60);
                $svg .= DrawPath($Bx, $By, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                $svg .= DrawPath($Cx, $Cy, $Dx, $Dy, 'black', 2, 'none', 2, 2);
                $svg .= DrawVector($Ax, $Ay, $Dx, $Dy, 'black', 10, 2, 30);
                $svg .= DrawText($Dx - 15, $Dy - 10, '$\\overrightarrow{AB}+\\overrightarrow{AC}$', 12, 'black');
                $svg .= DrawText($Ax + 30, $Ay - 10, '$60°$', 12);
            }
        }
        $svg .= '</svg></div>';
        return $svg;
    }
    function Trapez($bottom, $top, $side, $progress = 0)
    {
        $width = 350;
        $height = 250;
        $paddingX_top = 110;
        $paddingX_bottom = 20;
        $paddingY = 50;
        $radius = 40;
        $Ax = $paddingX_bottom;
        $Ay = $height - $paddingY;
        $Bx = $width - $paddingX_bottom;
        $By = $height - $paddingY;
        $Cx = $width - $paddingX_top;
        $Cy = $paddingY;
        $Dx = $paddingX_top;
        $Dy = $paddingY;
        $Ex = $paddingX_top;
        $Ey = $height - $paddingY;
        $Fx = $width - $paddingX_top;
        $Fy = $height - $paddingY;
        $svg = '<div class="img-question text-center">
				<svg width="' . $width . '" height="' . $height . '">';
        // Sides
        $svg .= DrawLine($Ax, $Ay, $Bx, $By, 'black', 2);
        $svg .= DrawLine($Bx, $By, $Cx, $Cy, 'black', 2);
        $svg .= DrawLine($Cx, $Cy, $Dx, $Dy, 'black', 2);
        $svg .= DrawLine($Dx, $Dy, $Ax, $Ay, 'black', 2);
        // Nodes
        $svg .= DrawText($Ax - 13, $Ay, '$A$', 12);
        $svg .= DrawText($Bx + 13, $By, '$B$', 12);
        $svg .= DrawText($Cx + 13, $Cy, '$C$', 12);
        $svg .= DrawText($Dx - 13, $Dy, '$D$', 12);
        if ($progress == 0) {
            // Arcs
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, $radius);
            $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, $radius);
            $svg .= DrawArc($Cx, $Cy, $Dx, $Dy, $Bx, $By, $radius);
            $svg .= DrawArc($Dx, $Dy, $Ax, $Ay, $Cx, $Cy, $radius);
            // Lengths
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $bottom . '$', 12);
            $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
            $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
            $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        } elseif ($progress == 1) {
            // Arcs
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, $radius, 0, 0, NULL, 'red');
            $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, $radius, 0, 0, NULL, 'red');
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, $radius + 3, 0, 0, NULL, 'red');
            $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, $radius + 3, 0, 0, NULL, 'red');
            $svg .= DrawArc($Cx, $Cy, $Dx, $Dy, $Bx, $By, $radius, 0, 0, NULL, 'blue');
            $svg .= DrawArc($Dx, $Dy, $Ax, $Ay, $Cx, $Cy, $radius, 0, 0, NULL, 'blue');
            // Lengths
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $bottom . '$', 12);
            $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
            $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
            $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        } elseif ($progress == 2) {
            // Height
            $svg .= DrawPath($Dx, $Dy, $Ex, $Ey, $color1 = 'blue', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawPath($Cx, $Cy, $Fx, $Fy, $color1 = 'blue', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawLine($Ex, $Ey, $Fx, $Fy, 'red', 3);
            $svg .= DrawText($Ex, $Ey + 20, '$E$', 12);
            $svg .= DrawText($Fx, $Fy + 20, '$F$', 12);
            // Lengths
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $top . '$', 12);
            $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
            $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
            $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        } elseif ($progress == 3) {
            // Height
            $svg .= DrawPath($Dx, $Dy, $Ex, $Ey, $color1 = 'black', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawPath($Cx, $Cy, $Fx, $Fy, $color1 = 'blue', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawLine($Ax, $Ay, $Ex, $Ey, 'red', 3);
            $svg .= DrawText($Ex, $Ey + 20, '$E$', 12);
            $svg .= DrawText($Fx, $Fy + 20, '$F$', 12);
            // AE length
            $ae = ($bottom - $top) / 2;
            // Lengths
            $svg .= DrawText(($Ax + $Ex) / 2 - 5, ($Ay + $Ey) / 2 + 17, '$' . round2($ae) . '$', 12, 'red');
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $top . '$', 12);
            $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
            $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
            $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        } elseif ($progress == 4) {
            // Height
            $svg .= DrawPath($Dx, $Dy, $Ex, $Ey, $color1 = 'black', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawPath($Cx, $Cy, $Fx, $Fy, $color1 = 'blue', $width = 1, $color2 = 'white', $dasharray1 = 5, $dasharray2 = 3);
            $svg .= DrawLine($Ax, $Ay, $Ex, $Ey, 'red', 3);
            $svg .= DrawLine($Ax, $Ay, $Dx, $Dy, 'red', 3);
            $svg .= DrawText($Ex, $Ey + 20, '$E$', 12);
            $svg .= DrawText($Fx, $Fy + 20, '$F$', 12);
            // AE length
            $ae = ($bottom - $top) / 2;
            // Arc
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Dx, $Dy, $radius, +10, 0, '$\\color{red}{\\alpha}$', 'red');
            // Lengths
            $svg .= DrawText(($Ax + $Ex) / 2 - 5, ($Ay + $Ey) / 2 + 17, '$' . round2($ae) . '$', 12, 'red');
            $svg .= DrawText(($Ax + $Bx) / 2, ($Ay + $By) / 2 + 17, '$' . $top . '$', 12);
            $svg .= DrawText(($Bx + $Cx) / 2 + 15, ($By + $Cy) / 2 - 5, '$' . round2($side) . '$', 12);
            $svg .= DrawText(($Cx + $Dx) / 2 + 5, ($Cy + $Dy) / 2 - 5, '$' . $top . '$', 12);
            $svg .= DrawText(($Dx + $Ax) / 2 - 15, ($Dy + $Ay) / 2 - 5, '$' . round2($side) . '$', 12);
        }
        $svg .= '</svg></div>';
        return $svg;
    }
    function DrawTriangle($Ca = NULL, $Caa = NULL, $Cb = NULL, $Cbb = NULL, $Cc = NULL, $Ccc = NULL)
    {
        $width = 400;
        $height = 300;
        $color1 = '#F2F2F2';
        $color2 = 'black';
        $padding = 30;
        $arc_length = 70;
        $arc_radius_inner = 40;
        $arc_radius_outer1 = 37;
        $arc_radius_outer2 = 43;
        // Outer points
        $AAx = $padding;
        $AAy = $height - $padding;
        $BBx = $width - $padding;
        $BBy = $height - $padding;
        $CCx = $width * 3 / 4;
        $CCy = $padding;
        // Inner points
        $Ax = $AAx + $arc_length;
        $Ay = $AAy;
        $Bx = $BBx - $arc_length;
        $By = $BBy;
        $ratio = 0.77;
        $Cx = $Ax + ($CCx - $Ax) * $ratio;
        $Cy = $CCy + ($Ay - $CCy) * (1 - $ratio);
        $svg = '<div class="img-question text-center">
					<svg width="' . $width . '" height="' . $height . '">';
        // $svg .= '<rect width="'.$width.'" height="'.$height.'" fill="black" fill-opacity="0.2" />';
        $svg .= DrawLine($Ax, $Ay, $Bx, $By);
        $svg .= DrawLine($Ax, $Ay, $Cx, $Cy);
        $svg .= DrawLine($Bx, $By, $Cx, $Cy);
        // Nodes
        $svg .= DrawText($Ax, $height - 5, '$A$', 15);
        $svg .= DrawText($Bx, $height - 5, '$B$', 15);
        $svg .= DrawText($Cx - 10, $Cy - 5, '$C$', 15);
        // Arc
        if ($Ca) {
            // caption for A inner
            $svg .= DrawArc($Ax, $Ay, $Bx, $By, $Cx, $Cy, $arc_radius_inner, 25, 0, $Ca);
        }
        if ($Caa) {
            // caption for A outer
            $svg .= DrawLine($Ax, $Ay, $AAx, $AAy);
            $svg .= DrawArc($Ax, $Ay, $Cx, $Cy, $AAx, $AAy, $arc_radius_outer1);
            $svg .= DrawArc($Ax, $Ay, $Cx, $Cy, $AAx, $AAy, $arc_radius_outer2, 5, 10, $Caa);
        }
        if ($Cb) {
            // caption for B inner
            $svg .= DrawArc($Bx, $By, $Cx, $Cy, $Ax, $Ay, $arc_radius_inner, 25, 0, $Cb);
        }
        if ($Cbb) {
            // caption for B outer
            $svg .= DrawLine($Bx, $By, $BBx, $BBy);
            $svg .= DrawArc($Bx, $By, $BBx, $BBy, $Cx, $Cy, $arc_radius_outer1);
            $svg .= DrawArc($Bx, $By, $BBx, $BBy, $Cx, $Cy, $arc_radius_outer2, 25, 10, $Cbb);
        }
        if ($Cc) {
            // caption for C inner
            $svg .= DrawArc($Cx, $Cy, $Ax, $Ay, $Bx, $By, $arc_radius_inner, 25, 20, $Cc);
        }
        if ($Ccc) {
            // caption for C outer
            $svg .= DrawLine($Cx, $Cy, $CCx, $CCy);
            $svg .= DrawArc($Cx, $Cy, $Bx, $By, $CCx, $CCy, $arc_radius_outer1);
            $svg .= DrawArc($Cx, $Cy, $Bx, $By, $CCx, $CCy, $arc_radius_outer2, 25, 5, $Ccc);
        }
        $svg .= '</svg></div>';
        return $svg;
    }