Skip to content

Commit

Permalink
Merge branch 'master' of github.com:James-Oswald/PeirceMyHeart into 3…
Browse files Browse the repository at this point in the history
…6-ellipse-bounding-box
  • Loading branch information
AnushaTiwari5 committed Oct 8, 2023
2 parents 4c0d89b + 05e5d3e commit 7034723
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/EllipseCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export function createEllipse(original: Point, current: Point): Ellipse {
//This inscribed ellipse solution is inspired by the discussion of radius ratios in
//https://stackoverflow.com/a/433426/6342516
const rv: number = Math.floor(distance(center, current));
rx = Math.floor(rv * (dy / dx));
ry = Math.floor(rv * (dx / dy));
ry = Math.floor(rv * (dy / dx));
rx = Math.floor(rv * (dx / dy));
} else {
ry = dx / 2;
rx = dy / 2;
rx = dx / 2;
ry = dy / 2;
}

if (showRectElm.checked) {
Expand All @@ -61,7 +61,7 @@ export function createEllipse(original: Point, current: Point): Ellipse {
}

ctx.beginPath();
ctx.ellipse(center.x, center.y, rx, ry, Math.PI / 2, 0, 2 * Math.PI);
ctx.ellipse(center.x, center.y, rx, ry, 0, 0, 2 * Math.PI);
//I know this is stupid to constantly make a new ellipse but my brain hurts I'm sorry
ctx.stroke();
currentEllipse = new Ellipse(center, rx, ry);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function redrawCut(incomingNode: CutNode) {
incomingNode.ellipse.center.y,
incomingNode.ellipse.radiusX,
incomingNode.ellipse.radiusY,
Math.PI / 2,
0,
0,
2 * Math.PI
);
Expand Down

0 comments on commit 7034723

Please sign in to comment.