Check if a point is inside , outside or on a Hyperbola | Java program for the above approach ; Function to check if the point ( x , y ) lies inside , on or outside the given hyperbola ; Stores the value of the equation ; Generate output based on value of p ; Driver Code
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static void checkpoint ( int h , int k , int x , int y , int a , int b ) { int p = ( int ) ( Math . pow ( ( x - h ) , 2 ) / Math . pow ( a , 2 ) ) - ( int ) ( Math . pow ( ( y - k ) , 2 ) / Math . pow ( b , 2 ) ) ; if ( p > 1 ) { System . out . println ( " Outside " ) ; } else if ( p == 1 ) { System . out . println ( " On ▁ the ▁ Hyperbola " ) ; } else { System . out . println ( " Inside " ) ; } } public static void main ( String [ ] args ) { int h = 0 , k = 0 , x = 2 ; int y = 1 , a = 4 , b = 5 ; checkpoint ( h , k , x , y , a , b ) ; } }