public static double dotProductWithAddition ( double [ ] pointA1 , double [ ] pointA2 , double [ ] pointB ) { assert ( pointA1 . length == pointA2 . length && pointA1 . length == pointB . length ) ; double product = 0.0 ; for ( int i = 0 ; i < pointA1 . length ; i ++ ) { product += ( pointA1 [ i ] + pointA2 [ i ] ) * pointB [ i ] ; } return product ; }
Calculates the dot product of the addition of the first and the second point with the third point .