Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore(TS): migrate Intersection #8121

Merged
merged 27 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d4bcf4e
Update point.class.ts
ShaMan123 Aug 4, 2022
5a19804
import point
ShaMan123 Aug 4, 2022
20d3e77
migrate
ShaMan123 Aug 4, 2022
59a6107
iports
ShaMan123 Aug 4, 2022
8f492ae
rename
ShaMan123 Aug 4, 2022
7c17d24
Update intersection.class.ts
ShaMan123 Aug 4, 2022
7cec891
rename
ShaMan123 Aug 5, 2022
3b5f60d
Merge branch 'master' into ts-intersection
ShaMan123 Aug 5, 2022
7aa20fa
intersectLineLine
ShaMan123 Aug 5, 2022
91fb5eb
fix(): polygon line coincident
ShaMan123 Aug 5, 2022
d3ac3f3
Update intersection.js
ShaMan123 Aug 5, 2022
578717e
fixed!
ShaMan123 Aug 5, 2022
5574cb2
more work
ShaMan123 Aug 5, 2022
4ff2483
fix intersectLinePolygon
ShaMan123 Aug 5, 2022
46182f2
move unique points logic to appendPoint
ShaMan123 Aug 5, 2022
6c1120c
Update intersection.class.ts
ShaMan123 Aug 5, 2022
3a3e902
Update intersection.class.ts
ShaMan123 Aug 5, 2022
627c73d
dep(): `appendPoint` `appendPoints` => `append`
ShaMan123 Aug 5, 2022
26fb94a
fix polygon coincident edge case
ShaMan123 Aug 8, 2022
89f13c4
Update intersection.js
ShaMan123 Aug 8, 2022
e94d62e
JSDOC
ShaMan123 Aug 17, 2022
1df3ec2
Update object_geometry.mixin.ts
ShaMan123 Aug 17, 2022
ecdb285
Update intersection.class.ts
ShaMan123 Aug 17, 2022
dd5ce7d
Merge branch 'master' into ts-intersection
ShaMan123 Aug 17, 2022
4fb0413
Merge branch 'master' into ts-intersection
ShaMan123 Aug 24, 2022
b1a8bef
Merge branch 'master' into ts-intersection
ShaMan123 Aug 25, 2022
e1fa4a8
Merge branch 'master' into ts-intersection
ShaMan123 Aug 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 32 additions & 20 deletions src/intersection.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export class Intersection {
* @param {Point} a2
* @param {Point} b1
* @param {Point} b2
* @param {boolean} [aIinfinite=true] check intersection by passing `false`
* @param {boolean} [bIinfinite=true] check intersection by passing `false`
* @param {boolean} [aIinfinite=true] check segment intersection by passing `false`
* @param {boolean} [bIinfinite=true] check segment intersection by passing `false`
* @return {Intersection}
*/
static intersectLineLine(a1, a2, b1, b2, aIinfinite = true, bIinfinite = true) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added option for infinite line check

Expand Down Expand Up @@ -95,13 +95,13 @@ export class Intersection {
}

/**
* Checks if a segment intersects another
* Checks if a segment intersects a line
* @see {@link intersectLineLine} for line intersection
* @static
* @param {Point} s1
* @param {Point} s2
* @param {Point} l1
* @param {Point} l2
* @param {Point} s1 boundary point of segment
* @param {Point} s2 other boundary point of segment
* @param {Point} l1 point on line
* @param {Point} l2 other point on line
* @return {Intersection}
*/
static intersectSegmentLine(s1, s2, l1, l2) {
Expand All @@ -112,10 +112,10 @@ export class Intersection {
* Checks if a segment intersects another
* @see {@link intersectLineLine} for line intersection
* @static
* @param {Point} a1
* @param {Point} a2
* @param {Point} b1
* @param {Point} b2
* @param {Point} a1 boundary point of segment
* @param {Point} a2 other boundary point of segment
* @param {Point} b1 boundary point of segment
* @param {Point} b2 other boundary point of segment
* @return {Intersection}
*/
static intersectSegmentSegment(a1, a2, b1, b2) {
Expand All @@ -124,10 +124,14 @@ export class Intersection {

/**
* Checks if line intersects polygon
*
* @todo account for stroke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @static
* @param {Point} a1
* @param {Point} a2
* @param {Point[]} points
* @see {@link intersectSegmentPolygon} for segment intersection
* @param {Point} a1 point on line
* @param {Point} a2 other point on line
* @param {Point[]} points polygon points
* @param {boolean} [infinite=true] check segment intersection by passing `false`
* @return {Intersection}
*/
Expand All @@ -154,10 +158,14 @@ export class Intersection {

/**
* Checks if segment intersects polygon
*
* @todo account for stroke
*
* @static
* @param {Point} a1
* @param {Point} a2
* @param {Point[]} points
* @see {@link intersectLinePolygon} for line intersection
* @param {Point} a1 boundary point of segment
* @param {Point} a2 other boundary point of segment
* @param {Point[]} points polygon points
* @return {Intersection}
*/
static intersectSegmentPolygon(a1, a2, points) {
Expand All @@ -166,6 +174,9 @@ export class Intersection {

/**
* Checks if polygon intersects another polygon
*
* @todo account for stroke
*
* @static
* @param {Point[]} points1
* @param {Point[]} points2
Expand Down Expand Up @@ -202,9 +213,10 @@ export class Intersection {
/**
* Checks if polygon intersects rectangle
* @static
* @param {Point[]} points
* @param {Point} r1
* @param {Point} r2
* @see {@link intersectPolygonPolygon} for polygon intersection
* @param {Point[]} points polygon points
* @param {Point} r1 top left point of rect
* @param {Point} r2 bottom right point of rect
* @return {Intersection}
*/
static intersectPolygonRectangle(points, r1, r2) {
Expand Down
1 change: 1 addition & 0 deletions src/mixins/object_geometry.mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ import { Point } from '../point.class';
);

return intersection.status === 'Intersection'
|| intersection.status === 'Coincident'
|| other.isContainedWithinObject(this, absolute, calculate)
|| this.isContainedWithinObject(other, absolute, calculate);
},
Expand Down