Generates a vector that forms an angle of 90 degrees with the given vector. - Java java.lang

Java examples for java.lang:Math Vector

Description

Generates a vector that forms an angle of 90 degrees with the given vector.

Demo Code


//package com.java2s;

import java.awt.geom.Point2D;

public class Main {
    /**//w w w  .  j a v a  2  s.  c o  m
     * Generates a vector that forms an angle of {@code 90} degrees with the given
     * vector.
     * 
     * @param a The given vector.
     * @return The orthogonal vector of the left side.
     */
    public static Point2D getOrthoLeft(final Point2D a) {
        return new Point2D.Double(-a.getY(), a.getX());
    }
}

Related Tutorials