# Namespace: geometry

## geometry

The geometry module, which provides basic geometric figures and operations.

Source:
  - geometry.js, line 35

### Methods

#### (static) circle(c, r)

Create a circle

##### Parameters:

Name | Type | Description
--- | --- | ---
`c` | Point | The center point of the circle.
`r` | number | Point | The radius of the circle or a point on the circle.

Source:
  - geometry.js, line 65

#### (static) cross(p1, p2) → {Number}

Calculate the cross product, where the two points are treated as vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 89

##### Returns:

Type
  Number

#### (static) distance(p1, p2) → {Number}

Calculate the distance between two points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 186

##### Returns:

Type
  Number

#### (static) distanceSquared(p1, p2) → {Number}

Calculate the squared distance between two points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 196

##### Returns:

Type
  Number

#### (static) dot(p1, p2) → {Number}

Calculate the dot product, where the two points are treated as vectors.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 79

##### Returns:

Type
  Number

#### (static) intersectionIsOnRay(p1, r1) → {Boolean}

Test if a point on the extension of a ray is actually on the ray.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`r1` | Line |

Source:
  - geometry.js, line 147

##### Returns:

Type
  Boolean

#### (static) intersectionIsOnSegment(p1, s1) → {Boolean}

Test if a point on the extension of a segment is actually on the segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`s1` | Line |

Source:
  - geometry.js, line 158

##### Returns:

Type
  Boolean

#### (static) line(p1, p2) → {Line}

Create a line, which also represents a ray or a segment. When used as a line, p1 and p2 are two distinct points on the line. When used as a ray, p1 is the starting point and p2 is another point on the ray. When used as a segment, p1 and p2 are the two endpoints of the segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 58

##### Returns:

Type
  Line

#### (static) lineCircleIntersections(l1, c1) → {Array.<Point>}

Calculate the intersections of a line and a circle.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l1` | Line |
`c1` | Circle |

Source:
  - geometry.js, line 115

##### Returns:

Type
  Array.<Point>

#### (static) linesIntersection(l1, l2) → {Point}

Calculate the intersection of two lines.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l1` | Line |
`l2` | Line |

Source:
  - geometry.js, line 99

##### Returns:

Type
  Point

#### (static) midpoint(p1, p2) → {Point}

Calculate the midpoint between two points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`p1` | Point |
`p2` | Point |

Source:
  - geometry.js, line 221

##### Returns:

Type
  Point

#### (static) parallelLineThroughPoint(l1, p1) → {Line}

Calculate the line though p1 and parallel to l1.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l1` | Line |
`p1` | Point |

Source:
  - geometry.js, line 251

##### Returns:

Type
  Line

#### (static) perpendicularBisector(l1) → {Line}

Calculate the perpendicular bisector of a segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l1` | Line |

Source:
  - geometry.js, line 232

##### Returns:

Type
  Line

#### (static) point(x, y) → {Point}

Create a point

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | number | The x-coordinate of the point.
`y` | number | The y-coordinate of the point.

Source:
  - geometry.js, line 47

##### Returns:

Type
  Point

#### (static) segmentLength(seg) → {Number}

Calculate the length of a line segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`seg` | Line |

Source:
  - geometry.js, line 167

##### Returns:

Type
  Number

#### (static) segmentLengthSquared(seg) → {Number}

Calculate the squared length of a line segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`seg` | Line |

Source:
  - geometry.js, line 176

##### Returns:

Type
  Number

#### (static) segmentMidpoint(l1) → {Point}

Calculate the midpoint of a segment.

##### Parameters:

Name | Type | Description
--- | --- | ---
`l1` | Line |

Source:
  - geometry.js, line 208

##### Returns:

Type
  Point