get Vector from Point2D - Java 2D Graphics

Java examples for 2D Graphics:Point

Description

get Vector from Point2D

Demo Code


//package com.java2s;
import java.awt.geom.Point2D;

public class Main {
    /**//from   ww  w.  j  a va  2s. c o  m
     * @param source
     * @param listener
     * @return
     */
    public static Point2D getVector(Point2D source, Point2D listener) {
        return new Point2D.Double(source.getX() - listener.getX(),
                source.getY() - listener.getY());
    }
}

Related Tutorials