-
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.
- Loading branch information
Showing
7 changed files
with
76 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import Unitary from './unitary.js'; | ||
const __imageCaches = []; | ||
const errorCatcher = e => { | ||
console.log(e); | ||
|
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,72 +1,3 @@ | ||
"use strict"; | ||
import Unitary from './unitary.js'; | ||
import Canvas from './canvas.js'; | ||
|
||
import UnitaryObject from './classes/unitaryobject.js'; | ||
import ContouredObject from './classes/contouredobject.js'; | ||
|
||
import BezierCurve from './classes/beziercurve.js'; | ||
import Circle from './classes/circle.js'; | ||
import CircularSector from './classes/circularsector.js'; | ||
import Curve from './classes/curve.js'; | ||
import Doughnut from './classes/doughnut.js'; | ||
import Ellipse from './classes/ellipse.js'; | ||
import Graph from './classes/graph.js'; | ||
import Group from './classes/group.js'; | ||
import Image_ from './classes/image.js'; | ||
import Line from './classes/line.js'; | ||
import Point from './classes/point.js'; | ||
import Polygon from './classes/polygon.js'; | ||
import Quadrilateral from './classes/quadrilateral.js'; | ||
import Rect from './classes/rect.js'; | ||
import Segment from './classes/segment.js'; | ||
import Text_ from './classes/text.js'; | ||
import Triangle from './classes/triangle.js'; | ||
import {BaseVector, Vector, Vector3D} from './classes/vector.js'; | ||
import {version as VERSION} from '../package.json'; | ||
|
||
export default { | ||
distance: (A, B) => { | ||
let res; | ||
if (A instanceof Point && B instanceof Point) { | ||
return Math.sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y)); | ||
} | ||
if (A instanceof Point && B instanceof Line) { | ||
res = B.a * A.x + B.b * A.y + B.c; | ||
if (res < 0) { | ||
res *= -1; | ||
} | ||
res /= Math.sqrt(B.a * B.a + B.b * B.b); | ||
return res; | ||
} | ||
if (A instanceof Line && B instanceof Point) { | ||
return distance(B, A); | ||
} | ||
}, | ||
Canvas, | ||
UnitaryObject, | ||
ContouredObject, | ||
BaseVector, | ||
BezierCurve, | ||
Circle, | ||
CircularSector, | ||
Curve, | ||
Doughnut, | ||
Donut: Doughnut, | ||
Ellipse, | ||
Graph, | ||
Group, | ||
Image: Image_, | ||
Line, | ||
Point, | ||
Polygon, | ||
Quadrilateral, | ||
Rect, | ||
Segment, | ||
Text: Text_, | ||
Triangle, | ||
Vector3D, | ||
Vector, | ||
XAxis: new Line(new Point(0, 0), new Point(1, 0)), | ||
YAxis: new Line(new Point(0, 0), new Point(0, 1)), | ||
VERSION | ||
}; | ||
export default Object.assign({}, Unitary, {Canvas}); |
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 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 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,69 @@ | ||
"use strict"; | ||
import UnitaryObject from './classes/unitaryobject.js'; | ||
import ContouredObject from './classes/contouredobject.js'; | ||
|
||
import BezierCurve from './classes/beziercurve.js'; | ||
import Circle from './classes/circle.js'; | ||
import CircularSector from './classes/circularsector.js'; | ||
import Curve from './classes/curve.js'; | ||
import Doughnut from './classes/doughnut.js'; | ||
import Ellipse from './classes/ellipse.js'; | ||
import Graph from './classes/graph.js'; | ||
import Group from './classes/group.js'; | ||
import Image_ from './classes/image.js'; | ||
import Line from './classes/line.js'; | ||
import Point from './classes/point.js'; | ||
import Polygon from './classes/polygon.js'; | ||
import Quadrilateral from './classes/quadrilateral.js'; | ||
import Rect from './classes/rect.js'; | ||
import Segment from './classes/segment.js'; | ||
import Text_ from './classes/text.js'; | ||
import Triangle from './classes/triangle.js'; | ||
import {BaseVector, Vector, Vector3D} from './classes/vector.js'; | ||
import {version as VERSION} from '../package.json'; | ||
|
||
export default { | ||
distance: (A, B) => { | ||
let res; | ||
if (A instanceof Point && B instanceof Point) { | ||
return Math.sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y)); | ||
} | ||
if (A instanceof Point && B instanceof Line) { | ||
res = B.a * A.x + B.b * A.y + B.c; | ||
if (res < 0) { | ||
res *= -1; | ||
} | ||
res /= Math.sqrt(B.a * B.a + B.b * B.b); | ||
return res; | ||
} | ||
if (A instanceof Line && B instanceof Point) { | ||
return distance(B, A); | ||
} | ||
}, | ||
UnitaryObject, | ||
ContouredObject, | ||
BaseVector, | ||
BezierCurve, | ||
Circle, | ||
CircularSector, | ||
Curve, | ||
Doughnut, | ||
Donut: Doughnut, | ||
Ellipse, | ||
Graph, | ||
Group, | ||
Image: Image_, | ||
Line, | ||
Point, | ||
Polygon, | ||
Quadrilateral, | ||
Rect, | ||
Segment, | ||
Text: Text_, | ||
Triangle, | ||
Vector3D, | ||
Vector, | ||
XAxis: new Line(new Point(0, 0), new Point(1, 0)), | ||
YAxis: new Line(new Point(0, 0), new Point(0, 1)), | ||
VERSION | ||
}; |