Java Geometry Algorithm dot(@Nonnull Point2D pA, @Nonnull Point2D pB)

Here you can find the source of dot(@Nonnull Point2D pA, @Nonnull Point2D pB)

Description

dot product of two points (vectors)

License

Open Source License

Parameter

Parameter Description
pA the first point
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

Declaration

@CheckReturnValue
public static double dot(@Nonnull Point2D pA, @Nonnull Point2D pB) 

Method Source Code

//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());
    }
}

Related

  1. curvedLineHit(Point point, Point startPoint, Point endPoint, Point controlPoint1, Point controlPoint2, float padding)
  2. derivativeOfCubicBezier(Point2D p0, Point2D p1, Point2D p2, Point2D p3, double t)
  3. deriveLocation(Point origin, double radius)
  4. determineConnectionPoint(Point wayPoint, Polygon polygon)
  5. directVincenty(Point2D.Double point, double brng, double distance)
  6. dot(final Point2D a, final Point2D b)
  7. dot(Point a, Point b, Point c)
  8. dotNorm(final Point2D a, final Point2D b)
  9. drag(Robot robot, Point startPoint, Point endPoint, int button)