
public class Plane extends Shape
{
	public Vector Normal ; 
	public Point3D P ; 
	
	float t ; 
	private float EPS = 0.00001f ; 
	
	
	public Plane(){} ; 
	
	public Plane ( Vector Normal , Point3D P , Material material )
	{
		this.Normal = Normal ; 
		this.P = P ;  
		this.material = material ; 
	};

	@Override
	public boolean Intersect(Ray ray) 
	{
		ray.normalize();
		Vector v = new Vector ( this.P  , ray.getPos() ) ;
		
		// Check if parallel
		if ( ray.getDir().dot(Normal)  < EPS ) return false ;
		
		t = v.dot( Normal ) / ray.getDir().dot( Normal ) ;
		
		return true ;
		
		/*
		Vector v = new Vector ( this.P  , ray.getPos() ) ;
		t = v.dot( Normal ) / ray.getDir().dot( Normal ) ;
		//System.out.println( t );
		return ( ray.getDir().dot(this.Normal) < EPS ) ; 
		*/	
	};

	@Override
	public Vector getNormal(Point3D p)
	{
		 return this.Normal ; 
	};

	@Override
	public float getInter() 
	{
		return this.t ; 
	};

	@Override
	public Material getMaterial() 
	{
		return this.material;
	};
	
}

@@ -348,27 +348,8 @@
 %0A%09%7B%0A
-%09%09ray.normalize();%0A
 %09%09Ve
@@ -366,33 +366,24 @@
 ew Vector ( 
-this.P  ,
  ray.getPos(
@@ -388,120 +388,100 @@
 s() 
-) ;%0A%09%09%0A%09%09// Check if parallel%0A%09%09if ( ray.getDir().dot(Normal)  %3C EPS ) return false ;%0A%09%09%0A%09%09t = v.dot( Normal ) /
+, this.P  ) ;%0A%09%09ray.normalize();%0A%09%09//v.norm() ; %0A%09%09this.Normal.normalize();%0A%09%09%0A%09%09float den =
  ray
@@ -498,182 +498,125 @@
 dot(
- 
+this.
 Normal
- 
 ) ;
+ 
 %0A%09%09%0A%09%09
-return true ;%0A%09%09%0A%09%09/*%0A%09%09Vector v = new Vector ( this.P  , ray.getPos() ) ;%0A%09%09t = v.dot( Normal ) / ray.getDir().dot( Normal ) ;%0A%09%09//System.out.println( t )
+// Check if crossing the plane%0A%09%09if ( den %3C EPS ) %0A%09%09%7B%0A%09%09%09this.t = v.dot(this.Normal ) / den 
 ;%0A
+%09
 %09%09re
@@ -626,54 +626,48 @@
 n ( 
-ray.getDir().dot(this.Normal) %3C EPS ) ; %0A%09%09*/%09
+this.t %3E= 0 ) ; %0A%09%09%7D%0A%09%09%0A%09%09return false ;
 %0A%09%7D;

Change the ray - plane intersection function