## smithers.java3d Class Line3D

```java.lang.Object smithers.java3d.Line3D
```

`public class Line3Dextends java.lang.Object`

Represents a line in 3-dimensional space.

Constructor Summary
`Line3D()`
Constructs the x-axis.
```Line3D(float[] base, float[] vec)```
Constructs a line through the given point in the given direction.
```Line3D(float dx, float dy, float dz)```
Constructs a line through the origin in the given direction.
```Line3D(float x0, float y0, float z0, float dx, float dy, float dz)```
Constructs a line through the given point in the given direction.

Method Summary
` float` `distance(float[] p)`
Calculates the shortest distance from this line to the given point.
` float[]` `getBase()`
Get a point on the line.
` float[]` `getHead()`
Get another point on this line.
` float[]` `getVector()`
Get the direction in which the line points.
` float[]` ```intersectPlane(float[] p, float[] n)```
Calculates the point of intersection of this line with a plane.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Line3D

`public Line3D()`
Constructs the x-axis.

### Line3D

```public Line3D(float dx,
float dy,
float dz)```
Constructs a line through the origin in the given direction. This could also be thought of as a line through the origin and the specified point.

Parameters:
`dx` - the relative change in x
`dy` - the relative change in y
`dz` - the relative change in z

### Line3D

```public Line3D(float x0,
float y0,
float z0,
float dx,
float dy,
float dz)```
Constructs a line through the given point in the given direction.

Parameters:
`x0` - the x coordinate of the starting point
`y0` - the y coordinate of the starting point
`z0` - the z coordinate of the starting point
`dx` - the relative change in x
`dy` - the relative change in y
`dz` - the relative change in z

### Line3D

```public Line3D(float[] base,
float[] vec)```
Constructs a line through the given point in the given direction.

Parameters:
`base` - the starting point
`vec` - the direction vector
Method Detail

### getBase

`public float[] getBase()`
Get a point on the line.

Returns:
a point on the line

### getVector

`public float[] getVector()`
Get the direction in which the line points.

Returns:
a vector parallel to this line

`public float[] getHead()`
Get another point on this line. The point returned is a point on the line disinct from the one returned by `getBase()`.

Returns:
a point on this line, distinct from `getBase()`

### distance

`public float distance(float[] p)`
Calculates the shortest distance from this line to the given point.

Parameters:
`p` - the point
Returns:
the distance

### intersectPlane

```public float[] intersectPlane(float[] p,
float[] n)```
Calculates the point of intersection of this line with a plane. The plane is taken through the given point and normal to the given vector.

Parameters:
`p` - a point on the plane
`n` - the normal to the plane
Returns:
the point of intersection