##### Ninja Library - Collision Function

# njDistanceL2PL

Returns the distance between a line and a plane

### FORMAT

`

  Float njDisatnceL2L( *l, *pl, *cp )
  NJS_LINE *l
  NJS_PLANE *pl
  NJS_POINT3 *cp

`

### PARAMETER

  `*l` | Line data
  `*pl` | Plane data
  `*cp` | Intersection of a line and a plane (if not parallel)

### RETURN

  Distance between a line and a plane

### DESCRIPTION

  Returns the distance between a line and a plane. When parameter cp is not NULL, the coordinates of the point of intersection between the line and the plane are calculated and stored in cp (when the line and plane are not parallel). When the line and plane are parallel, the coordinates of the point of intersection between a perpendicular from the start of the line to the plane is stored.

### EXAMPLE

      NJS_LINE  l;
      NJS_PLANE pl;
      NJS_POINT3 cp;
      l.px = 2.f;
      l.py = -1.f;
      l.pz = 3.f;
      l.vx = 4.f;
      l.vy = -1.f;
      l.vz = 1.f;
      pl.px = 0.f;
      pl.py = 0.f;
      pl.pz = 0.f;
      pl.vx = 1.f;
      pl.vy = -4.f;
      pl.vz = 1.f;
      njDistanceL2PL(&l, &pl, &cp);
      % Result %
      Return : 0.000000
      cp (-2, 0, 2)

njDistanceL2PL

COPYRIGHT © SEGA ENTERPRISES, LTD., 1998,1999