Multiplies a point with a scalar. - Java java.lang

Java examples for java.lang:Math Geometry

Description

Multiplies a point with a scalar.

Demo Code


//package com.java2s;

import java.awt.geom.Point2D;

public class Main {
    /**//from  w  w w. j a v  a2  s . c  om
     * Multiplies a point with a scalar.
     * 
     * @param a The point.
     * @param scalar The scalar.
     * @return the scaled version.
     */
    public static Point2D mulVec(final Point2D a, final double scalar) {
        return new Point2D.Double(a.getX() * scalar, a.getY() * scalar);
    }
}

Related Tutorials