# Determine if a point/ball is above a line

This post is the second installment from my previous post (How to detect a collision between a circle and a line).  In this post I will show how to determine if a circle or point is above a line. If you know anything about a dot product of two vectors then you probably could come up with the ‘if’ statement yourself. Without going in to too deep of details about dot products, it is basically means if two vectors point the same direction then their dot product will be greater then zero.

Here is the code:

boolean overLine(pt C, pt A, pt B){
vec AC = new vec(A, C);
vec AB = new vec(A,B);
vec BC = new vec (B,C);
vec BA = new vec (B, A);
if ((dot(AC,AB) > 0 )  && (dot(BP,BA) > 0) ) return true;
return false;
}

// dot product code
float dot(vec U, vec V) {
return U.x*V.x+U.y*V.y;
};

Here is a crude drawing I made for what is happening:

Posted by in Coding

Tags: ,

Has everything you want to know about grave yards. Plus has many celebrites and world leaders graves. Pssst it is my other site