Search this API

## y.geom Class AffineLine

```java.lang.Object y.geom.AffineLine
```

`public class AffineLineextends java.lang.Object`

This class represents a line in the 2D-dimensional affine space. The line is defined by the equation ax + by + c = 0 Constructor Summary
```AffineLine(YPoint p1, YPoint p2)```
Creates an affine line which is defined by two points.
```AffineLine(YPoint p1, YVector v)```
Creates an affine line which is defined by a point and a vector.

Method Summary
` double` `getA()`
Returns a from ax+by+c = 0
` double` `getB()`
Returns b from ax+by+c = 0
` double` `getC()`
Returns c from ax+by+c = 0
`static YPoint` ```getCrossing(AffineLine l1, AffineLine l2)```
Returns the crossing of two lines.
` YPoint` `getXProjection(YPoint p)`
Projects an point on the line in direction of the X-axis.
` YPoint` `getYProjection(YPoint p)`
Projects an point on the line in direction of the Y-axis.
` java.lang.String` `toString()`
Returns the equation of the line as String

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

Constructor Detail

### AffineLine

```public AffineLine(YPoint p1,
YVector v)```
Creates an affine line which is defined by a point and a vector.

### AffineLine

```public AffineLine(YPoint p1,
YPoint p2)```
Creates an affine line which is defined by two points.

Method Detail

### getA

`public double getA()`
Returns a from ax+by+c = 0

### getB

`public double getB()`
Returns b from ax+by+c = 0

### getC

`public double getC()`
Returns c from ax+by+c = 0

### toString

`public java.lang.String toString()`
Returns the equation of the line as String

Overrides:
`toString` in class `java.lang.Object`

### getXProjection

`public YPoint getXProjection(YPoint p)`
Projects an point on the line in direction of the X-axis.

### getYProjection

`public YPoint getYProjection(YPoint p)`
Projects an point on the line in direction of the Y-axis.

### getCrossing

```public static YPoint getCrossing(AffineLine l1,
AffineLine l2)```
Returns the crossing of two lines. If the lines are parallel, `null` is returned.