public PlaSegmentFloat segment_projection(PlaSegmentFloat p_line_segment){
  if (point_b.scalar_product(point_a,p_line_segment.point_a) < 0) {
    return null;
  }
  if (point_a.scalar_product(point_b,p_line_segment.point_b) < 0) {
    return null;
  }
  PlaPointFloat projected_a;
  if (point_a.scalar_product(point_b,p_line_segment.point_a) < 0) {
    projected_a=point_a;
  }
 else {
    projected_a=perpendicular_projection(p_line_segment.point_a);
    if (projected_a.is_NaN())     return null;
    if (Math.abs(projected_a.v_x) >= PlaLimits.CRIT_INT || Math.abs(projected_a.v_y) >= PlaLimits.CRIT_INT)     return null;
  }
  PlaPointFloat projected_b;
  if (point_b.scalar_product(point_a,p_line_segment.point_b) < 0) {
    projected_b=point_b;
  }
 else {
    projected_b=perpendicular_projection(p_line_segment.point_b);
  }
  if (projected_b.is_NaN())   return null;
  if (Math.abs(projected_b.v_x) >= PlaLimits.CRIT_INT || Math.abs(projected_b.v_y) >= PlaLimits.CRIT_INT)   return null;
  return new PlaSegmentFloat(projected_a,projected_b);
}

public PlaSegmentFloat segment_projection ( PlaSegmentFloat p_line_segment ) { if ( point_b . scalar_product ( point_a , p_line_segment . point_a ) < 0 ) { return null ; } if ( point_a . scalar_product ( point_b , p_line_segment . point_b ) < 0 ) { return null ; } PlaPointFloat projected_a ; if ( point_a . scalar_product ( point_b , p_line_segment . point_a ) < 0 ) { projected_a = point_a ; } else { projected_a = perpendicular_projection ( p_line_segment . point_a ) ; if ( projected_a . is_NaN ( ) ) return null ; if ( Math . abs ( projected_a . v_x ) >= PlaLimits . CRIT_INT || Math . abs ( projected_a . v_y ) >= PlaLimits . CRIT_INT ) return null ; } PlaPointFloat projected_b ; if ( point_b . scalar_product ( point_a , p_line_segment . point_b ) < 0 ) { projected_b = point_b ; } else { projected_b = perpendicular_projection ( p_line_segment . point_b ) ; } if ( projected_b . is_NaN ( ) ) return null ; if ( Math . abs ( projected_b . v_x ) >= PlaLimits . CRIT_INT || Math . abs ( projected_b . v_y ) >= PlaLimits . CRIT_INT ) return null ; return new PlaSegmentFloat ( projected_a , projected_b ) ; }
returns the perpendicular projection of p_line_segment onto this oriented line segment , returns null , if the projection is empty .
