# Class: HCoordinate

## jsts.algorithm.HCoordinate

#### new HCoordinate()

Represents a homogeneous coordinate in a 2-D coordinate space. In JTS HCoordinates are used as a clean way of computing intersections between line segments. Will call correct init* function depending on argument.
Source:

### Methods

#### (static) intersection(p1, p2, q1, q2) → {jsts.geom.Coordinate}

Computes the (approximate) intersection point between two line segments using homogeneous coordinates.

Note that this algorithm is not numerically stable; i.e. it can produce intersection points which lie outside the envelope of the line segments themselves. In order to increase the precision of the calculation input points should be normalized before passing them to this routine.

##### Parameters:
Name Type Description
`p1` jsts.geom.Coordinate first coordinate for the first line.
`p2` jsts.geom.Coordinate second coordinate for the first line.
`q1` jsts.geom.Coordinate first coordinate for the second line.
`q2` jsts.geom.Coordinate second coordinate for the second line.
Source:
##### Returns:
The coordinate of the intersection.
Type
jsts.geom.Coordinate

#### getCoordinate() → {jst.geom.Coordinate}

Gets a coordinate represented by this HCoordinate
Source:
##### Returns:
The coordinate.
Type
jst.geom.Coordinate

Gets x/w
Source:
x/w.
Type
Number

Gets y/w
Source:
y/w.
Type
Number

#### initFrom1Coordinate(p)

Initializes a new HCoordinate from 1 Coordinate
##### Parameters:
Name Type Description
`p` jsts.geom.Coordinate the coordinate.
Source:

#### initFrom2Coordinates(p1, p2)

Constructs a homogeneous coordinate which is the intersection of the lines define by the homogenous coordinates represented by two Coordinates.
##### Parameters:
Name Type Description
`p1` jsts.geom.Coordinate the first coordinate.
`p2` jsts.geom.Coordinate the second coordinate.
Source:

#### initFrom2HCoordinates(p1, p2)

Initializes from 2 HCoordinates
##### Parameters:
Name Type Description
`p1` jsts.algorithm.HCoordinate the first HCoordinate.
`p2` jsts.algorithm.HCoordinate the second HCoordinate.
Source:

#### initFrom4Coordinates(p1, p2, q1, q2)

Initializes from 4 Coordinates
##### Parameters:
Name Type Description
`p1` jsts.geom.Coordinate the first coordinate.
`p2` jsts.geom.Coordinate the second coordinate.
`q1` jsts.geom.Coordinate the first coordinate.
`q2` jsts.geom.Coordinate the second coordinate.
Source:

#### initFromXY(x, y)

Initializes from x,y
##### Parameters:
Name Type Description
`x` Number the x-value.
`y` Number the y-value.
Source:

#### initFromXYW(x, y, w)

Initializes from x,y,w
##### Parameters:
Name Type Description
`x` Number the x-value.
`y` Number the y-value.
`w` Number the w-value.
Source: