public char	SegPlaneInt( tPointi T, tPointi q, tPointi r, tPointd p, int m)
{
    tPointd N; 
    int D0 = 0;
    tPointi rq;
    double num, denom, t;
    int i;
    
    N  = new tPointd();
    rq  = new tPointi();
    
    m = PlaneCoeff( T, N, D0 );
    
    System.out.println("m= "+m+"; plane=( "+N.p[X]+" , "+N.p[Y]+" , "+N.p[Z]+" , "+D+" )");
    num = D - Dot( q, N );
    SubVec( r, q, rq );
    denom = Dot( rq, N );
    
    System.out.println("SegPlaneInt: num="+num+" , denom= "+denom );

    if ( denom == 0.0 ) {  /* Segment is parallel to plane. */
       if ( num == 0.0 )   /* q is on plane. */
           return 'p';
       else
           return '0';
    }
    else
       t = num / denom;
    System.out.println("SegPlaneInt: t= "+ t );

    System.out.println("p in seg plane int is: p=()");
    for( i = 0; i < DIM; i++ )
      {
	p.p[i] = q.p[i] + t * ( r.p[i] - q.p[i] );
	System.out.println(p.p[i]);
      }
    
    
    if ( (0.0 < t) && (t < 1.0) )
      return '1';
    else if ( num == 0.0 )   /* t == 0 */
      return 'q';
    else if ( num == denom ) /* t == 1 */
      return 'r';
    else return '0';
}