Line
Class Line
An infinite straight line that goes through two points.
Implements GeoShape
Method .at (t: number): Point
Gets the point at a specific offset along the line (opposite of .offset()).
| Name | Type | Default | Description |
|---|---|---|---|
t | number |
Method .contains (p: SimplePoint, tolerance: number): boolean
Checks if a point p lies on this line.
| Name | Type | Default | Description |
|---|---|---|---|
p | SimplePoint | ||
tolerance | number |
Method .distanceSquared (p: Point): number
Squared distance between a point and a line.
| Name | Type | Default | Description |
|---|---|---|---|
p | Point |
Method .equals (other: Line, tolerance: number): boolean
| Name | Type | Default | Description |
|---|---|---|---|
other | Line | ||
tolerance | number |
Method .offset (p: SimplePoint): number
Signed distance along the line (opposite of .at()).
| Name | Type | Default | Description |
|---|---|---|---|
p | SimplePoint |
Method .parallel (p: Point): Line
Finds the line parallel to this one, going through point p.
| Name | Type | Default | Description |
|---|---|---|---|
p | Point |
Method .perpendicular (p: Point): Line
Finds the line perpendicular to this one, going through point p.
| Name | Type | Default | Description |
|---|---|---|---|
p | Point |
Method .project (p: SimplePoint): Point
Projects a point p onto this line.
| Name | Type | Default | Description |
|---|---|---|---|
p | SimplePoint |
Method .rotate (a: number, c: Point): Line
Rotates this line by a given angle (in radians), optionally around point c.
| Name | Type | Default | Description |
|---|---|---|---|
a | number | ||
c | Point | … |
Method .side (p: SimplePoint, tolerance: number): number
Returns which side of this line a point p is on (or 0 on the line).
| Name | Type | Default | Description |
|---|---|---|---|
p | SimplePoint | ||
tolerance | number |
Class Ray
An infinite ray defined by an endpoint and another point on the ray.
Extends Line
Method .contains (p: Point, tolerance: number): boolean
| Name | Type | Default | Description |
|---|---|---|---|
p | Point | ||
tolerance | number |
Method .equals (other: Ray, tolerance: number): boolean
| Name | Type | Default | Description |
|---|---|---|---|
other | Ray | ||
tolerance | number |
Class Segment
A finite line segment defined by its two endpoints.
Extends Line
Method .contains (p: Point, tolerance: number): boolean
| Name | Type | Default | Description |
|---|---|---|---|
p | Point | ||
tolerance | number |
Method .contract (x: number): Segment
Contracts (or expands) a line by a specific ratio.
| Name | Type | Default | Description |
|---|---|---|---|
x | number |
Method .equals (other: Segment, tolerance: number, oriented: boolean): boolean
| Name | Type | Default | Description |
|---|---|---|---|
other | Segment | ||
tolerance | number | ||
oriented | boolean | false |