Adds two points. - Java java.lang

Java examples for java.lang:Math Geometry

Description

Adds two points.

Demo Code


//package com.java2s;

import java.awt.geom.Point2D;

public class Main {
    /**/*from  w w  w .ja  v a  2 s  . c o  m*/
     * Adds two points.
     * 
     * @param a The first point.
     * @param b The second point.
     * @return The resulting point.
     */
    public static Point2D addVec(final Point2D a, final Point2D b) {
        return new Point2D.Double(a.getX() + b.getX(), a.getY() + b.getY());
    }
}

Related Tutorials