Skip to content

Commit

Permalink
Circle center does not depend on radius with zero through points (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
cqnykamp authored Nov 11, 2024
1 parent f153bc3 commit 62ab001
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
35 changes: 21 additions & 14 deletions packages/doenetml-worker/src/components/Circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,12 +1692,14 @@ export default class Circle extends Curve {
};

if (stateValues.havePrescribedRadius) {
// still used numericalRadius, rather than numericalPrescribedRadius
// as numericalRadius becomes zero if have negative numericalPrescribedRadius
globalDependencies.numericalRadius = {
dependencyType: "stateVariable",
variableName: "numericalRadius",
};
if (stateValues.numThroughPoints > 0) {
// still used numericalRadius, rather than numericalPrescribedRadius
// as numericalRadius becomes zero if have negative numericalPrescribedRadius
globalDependencies.numericalRadius = {
dependencyType: "stateVariable",
variableName: "numericalRadius",
};
}
} else if (stateValues.numThroughPoints == 1) {
// if didn't have prescribed radius but just one point
// we treat the radius calculated above as prescribed
Expand Down Expand Up @@ -2521,14 +2523,19 @@ export default class Circle extends Curve {
// we call prescribedRadius as radius
// as we will treat the same as calculated radius
// for case with one through point
globalDependencies.radius = {
dependencyType: "stateVariable",
variableName: "prescribedRadius",
};
globalDependencies.haveNonNumericalPrescribedRadius = {
dependencyType: "stateVariable",
variableName: "haveNonNumericalPrescribedRadius",
};
if (stateValues.numThroughPoints > 0) {
globalDependencies.radius = {
dependencyType: "stateVariable",
variableName: "prescribedRadius",
};
globalDependencies.haveNonNumericalPrescribedRadius =
{
dependencyType: "stateVariable",
variableName:
"haveNonNumericalPrescribedRadius",
};
}

if (stateValues.numThroughPoints > 1) {
globalDependencies.haveNonNumericalThroughPoints = {
dependencyType: "stateVariable",
Expand Down
4 changes: 1 addition & 3 deletions packages/doenetml-worker/src/test/tagSpecific/circle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1649,9 +1649,7 @@ describe("Circle tag tests", async () => {
});
});

// Will un-skip this once all other circle tests are passing and we change dependencies of center
// to not depend on radius when there are no through points
it.todo("circle where radius depends on unspecified center", async () => {
it("circle where radius depends on unspecified center", async () => {
let core = await createTestCore({
doenetML: `
<graph>
Expand Down

0 comments on commit 62ab001

Please sign in to comment.