##### Ninja Library - Collision Function

# njDistanceP2PL

Returns the distance between a point and a line

### FORMAT

`

  Float njDistanceP2PL( *p, *pl, *cp )
  NJS_POINT3 *p
  NJS_PLANE *pl
  NJS_POINT3 *cp

`

### PARAMETER

  `*p` | Point data
  `*pl` | Line data
  `*cp` | Coordinates of the base of the perpendicular from the point p to the line l

### RETURN

  Distance between a point and a line

### DESCRIPTION

  Returns the distance between a point and a line. When parameter cp is not NULL, the coordinates of the base of the perpendicular from the point p to the line l are returned in cp.

### EXAMPLE

      NJS_POINT3 p, cp;
      NJS_PLANE pl;
      p.x = 100.f;
      p.y = 100.f;
      p.z = 100.f;
      pl.px = 0.f;
      pl.py = 0.f;
      pl.pz = 0.f;
      pl.vx = 0.f;
      pl.vy = 0.f;
      pl.vz = 1.f;
      njDistanceP2PL(&p, &pl, &cp);
      % Result %
      Return : 100.000000
      cp (100, 100, 0)

njDistanceP2PL

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999