import vtk.vtkImplicitBoolean;
import vtk.*;


public class HexagoneImplicitFunction {

	public HexagoneImplicitFunction() {

	}
	
	public vtkImplicitFunction getFunction(int op) {

        vtkImplicitBoolean func = new vtkImplicitBoolean();
        vtkPlane p = new vtkPlane();
        p.SetOrigin( 0, 0, _halfheight + delta );
        p.SetNormal( 0, 0, 1 );
        func.AddFunction( p );

        p = new vtkPlane();
        p.SetOrigin( 0, 0, - _halfheight - delta );
        p.SetNormal( 0, 0, -1 );
        func.AddFunction( p );
        func.SetOperationType( 1 );

        p = new vtkPlane();
        p.SetOrigin( _pas, 0, 0);
        p.SetNormal( Math.cos(Math.PI/3), Math.sin(Math.PI/3), 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );
        vtkGeneralTransform t = new vtkGeneralTransform();
        t.Translate( 0, -2 * _pas, 0 );
        p.SetNormal( -Math.cos(Math.PI/3), -Math.sin(Math.PI/3), 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );

        p = new vtkPlane();
        p.SetOrigin( 0, _pas, 0);
        p.SetNormal( 0, 1, 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );
        t = new vtkGeneralTransform();
        t.Translate( 0, -2 * _pas, 0 );
        p.SetNormal( 0, -1, 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );

        p = new vtkPlane();
        p.SetOrigin( _pas, 0, 0);
        p.SetNormal( Math.cos(Math.PI/3), -Math.sin(Math.PI/3), 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );
        t = new vtkGeneralTransform();
        t.Translate( 0, -2 * _pas, 0 );
        p.SetNormal( -Math.cos(Math.PI/3), Math.sin(Math.PI/3), 0 );
        func.AddFunction( p );
        func.SetOperationType( 1 );

        vtkImplicitBoolean nf = new vtkImplicitBoolean();
        nf.AddFunction( func );
        nf.SetOperationType( 1 );

        t = new vtkGeneralTransform();
        t.SetInput( _trans );
        t.Inverse();
        nf.SetTransform( t );

        return nf;
	}

	
}
