Here you can find the source of invVec(final Point2D v)
Parameter | Description |
---|---|
v | The vector. |
public static Point2D invVec(final Point2D v)
//package com.java2s; //License from project: Open Source License import java.awt.geom.Point2D; public class Main { /**/*from w w w . j a v a2 s .c om*/ * Generates a vector pointing in the opposite direction. * * @param v The vector. * @return The inverse vector. */ public static Point2D invVec(final Point2D v) { return mulVec(v, -1.0); } /** * Multiplies a point with a scalar. * * @param v Point. * @param s Scalar. * @return The scaled vector. */ public static Point2D mulVec(final Point2D v, final double s) { return new Point2D.Double(v.getX() * s, v.getY() * s); } }