Here you can find the source of dot(@Nonnull Point2D pA, @Nonnull Point2D pB)
Parameter | Description |
---|---|
pA | the first point |
pB | the second point |
@CheckReturnValue public static double dot(@Nonnull Point2D pA, @Nonnull Point2D pB)
//package com.java2s; //License from project: Open Source License import java.awt.geom.Point2D; import javax.annotation.CheckReturnValue; import javax.annotation.Nonnull; public class Main { /**/*from w w w . j a va2 s. c o m*/ * dot product of two points (vectors) * * @param pA the first point * @param pB the second point * @return the dot product of the two points note: Arccos(x) (inverse * cosine) of dot product is the angle between the vectors */ @CheckReturnValue public static double dot(@Nonnull Point2D pA, @Nonnull Point2D pB) { return (pA.getX() * pB.getX() + pA.getY() * pB.getY()); } }