## de.grogra.vecmath.geom Class Line

```java.lang.Object
de.grogra.vecmath.geom.Line
```

`public class Lineextends java.lang.Object`

This class represents the geometry of a line.

Author:
Ole Kniemeyer

Field Summary
` Vector3d` `direction`
Specifies the direction of the line.
` float` `directionDensity`
The probability density of direction for this ray.
` double` `end`
The line ends at `origin + end * direction`.
` Tuple3d` `origin`
Origin of the line.
` float` `originDensity`
The probability density of origin for this ray.
` boolean` `reflected`

` Color3f` `spectrum`
The spectrum of the ray.
` double` `start`
The line starts at `origin + start * direction`.
` boolean` `valid`

` float` `x`

` float` `y`

Constructor Summary
`Line()`

```Line(Tuple3d origin, Vector3d direction, double start, double end)```

Method Summary
` Line` `deepCopy()`

` double` `distance(Tuple3d point)`
Computes the distance between `point` and this line.
` double` `distanceSquared(Tuple3d point)`
Computes the square of the distance between `point` and this line.
` double` `length()`
Returns the length of this line.
` double` `lengthSquared()`
Returns the square of the length of this line.
` void` ```setLineAttributes(double start, double end)```

` java.lang.String` `toString()`

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

Field Detail

### direction

`public Vector3d direction`
Specifies the direction of the line. This vector is not necessarily normalized.

### directionDensity

`public float directionDensity`
The probability density of direction for this ray. This field is set by `Shader.generateRandomRays` and `Light.generateRandomRays`. If pω+ is the probability density that has been used for generating the random ray direction (measured with respect to projected solid angle ω+, i.e., dω+ = cos θ dω), then this field is set to pω+(`direction`). It is not defined for rays emanating from a directional light source. It may be `Float.POSITIVE_INFINITY` as a result of `Shader.generateRandomRays`, namely for ideal specular reflection or transmission.

### end

`public double end`
The line ends at `origin + end * direction`. The condition `start <= end` has to be satisfied.

### origin

`public Tuple3d origin`
Origin of the line.

### originDensity

`public float originDensity`
The probability density of origin for this ray. This field is set by `Light.generateRandomRays`. If px is the probability density that has been used for generating the random ray origin, then this field is set to px(`origin`). It is not defined for rays emanating from a point light source.

### reflected

`public boolean reflected`

### spectrum

`public Color3f spectrum`
The spectrum of the ray. Depending on context, this may represent the ray's spectral radiant power or other properties.

### start

`public double start`
The line starts at `origin + start * direction`.

### valid

`public boolean valid`

### x

`public float x`

### y

`public float y`
Constructor Detail

### Line

`public Line()`

### Line

```public Line(Tuple3d origin,
Vector3d direction,
double start,
double end)```
Method Detail

### deepCopy

`public Line deepCopy()`

### distance

`public double distance(Tuple3d point)`
Computes the distance between `point` and this line. The distance is defined to be the distance between `point` and the closest point of this line.

Parameters:
`point` - a point
Returns:
distance to `point`

### distanceSquared

`public double distanceSquared(Tuple3d point)`
Computes the square of the distance between `point` and this line. The distance is defined to be the distance between `point` and the closest point of this line.

Parameters:
`point` - a point
Returns:
squared distance to `point`

### length

`public double length()`
Returns the length of this line.

Returns:
length of this line

### lengthSquared

`public double lengthSquared()`
Returns the square of the length of this line.

Returns:
squared length of this line

### setLineAttributes

```public void setLineAttributes(double start,
double end)```

### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `java.lang.Object`