Как нарисовать стрелку?


import org.junit.*;
import static org.junit.Assert.*;
import org.bytedeco.javacv.*;
import org.bytedeco.javacpp.*;
import java.io.*;
import java.util.Locale;
import static org.bytedeco.javacpp.opencv_core.*;
import static org.bytedeco.javacpp.opencv_imgproc.*;
import static org.bytedeco.javacpp.opencv_calib3d.*;
import static org.bytedeco.javacpp.opencv_objdetect.*;
import static org.bytedeco.javacpp.opencv_highgui.*;

public class Arrow {
    private static final int worldSize[] = { 1200, 800 };

    @Test
    public void drawArrow() throws Exception
    {
        IplImage canvas = IplImage.create(worldSize[0], worldSize[1], IPL_DEPTH_8U, 3);
        cvZero(canvas);

        CvPoint pt1 = cvPoint(canvas.width() / 3, canvas.height() / 3), pt2 = cvPoint(canvas.width() / 2, canvas.height() / 2);

        cvLine(canvas, pt1, pt2, CV_RGB(255, 255, 255), 1, CV_AA, 0);

        double Vx = pt2.x() - pt1.x();
        double Vy = pt2.y() - pt1.y();
        double V = Math.sqrt(Vx*Vx + Vy*Vy);
        Vx = Vx/V;
        Vy = Vy/V;

        double nx = Vy;
        double ny = -Vx;

        double h = 50;
        double x3 = pt2.x() - h*Vx;
        double y3 = pt2.y() - h*Vy;

        double w = 50;
        double x4 = x3 + w*nx;
        double y4 = y3 + w*ny;
        double x5 = x3 - w*nx;
        double y5 = y3 - w*ny;

        cvLine(canvas, cvPoint((int) (x4), (int) (y4)), cvPoint((int) (x5), (int) (y5)), CV_RGB(255, 0, 0), 1, 8, 0);
        cvLine(canvas, pt2, cvPoint((int) (x4), (int) (y4)), CV_RGB(0, 255, 0), 1, CV_AA, 0);
        cvLine(canvas, pt2, cvPoint((int) (x5), (int) (y5)), CV_RGB(0, 0, 255), 1, CV_AA, 0);

        if (canvas != null) {
            cvSaveImage("arrow.png", canvas);
            cvReleaseImage(canvas);
        }
    }
}