Checks for the null vector. - Java java.lang

Java examples for java.lang:Math Vector

Description

Checks for the null vector.

Demo Code


//package com.java2s;

import java.awt.geom.Point2D;

public class Main {
    /**/*w  ww .  j ava 2s  .co m*/
     * Checks for the null vector.
     * 
     * @param from The starting point.
     * @param to The end point.
     * @return Whether the vector {@code from -> to} is the null vector.
     */
    public static boolean isNull(final Point2D from, final Point2D to) {
        return from.getX() == to.getX() && from.getY() == to.getY();
    }
}

Related Tutorials