forked from Petah/2d-visibility
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: change interface to consume a single polygon with holes
- Loading branch information
1 parent
2762ea9
commit eebbb75
Showing
13 changed files
with
115 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
export { loadMap } from './load-map'; | ||
export { calculateVisibility } from './visibility'; | ||
export { Rectangle } from './rectangle'; | ||
export { Segment } from './segment'; | ||
export { Point } from './point'; | ||
export { Point, EndPoint, Segment, type PolygonWithHoles } from './types'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export class Point { | ||
constructor(public x: number, public y: number) {} | ||
} | ||
|
||
export class EndPoint extends Point { | ||
public beginsSegment?: any; | ||
public segment?: any; | ||
public angle?: any; | ||
|
||
constructor(public x: number, public y: number) { | ||
super(x, y); | ||
} | ||
} | ||
|
||
export class Segment { | ||
public p1: EndPoint; | ||
public p2: EndPoint; | ||
public d: number = 0; | ||
|
||
constructor(x1: number, y1: number, x2: number, y2: number) { | ||
this.p1 = new EndPoint(x1, y1); | ||
this.p2 = new EndPoint(x2, y2); | ||
this.p1.segment = this; | ||
this.p2.segment = this; | ||
} | ||
} | ||
|
||
export type Vector2 = [number, number]; | ||
|
||
export type PolygonWithHoles = Vector2[][]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters