Java examples for java.lang:Math Vector
Checks to see if 2 vectors are Approximately parallel
import java.awt.geom.Point2D; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Stack; import java.util.Vector; import javax.vecmath.Vector2d; public class Main{ /**/*w w w . ja v a 2 s . co m*/ * Checks to see if 2 vectors are <b>Approximately</b> parallel * * @param firstVector * The first Vector2D * @param secondVector * The second Vector2D * @return Returns a boolean stating wether or not the Vectors are close to parallel */ public static boolean areParallel(Vector2d firstVector, Vector2d secondVector) { double angleBetween = firstVector.angle(secondVector); return angleBetween < .00001 || angleBetween > Math.PI - .00001; } }