From 5b391521ff8c9db2f1bea1b05c6963dcfd18204c Mon Sep 17 00:00:00 2001 From: Charles Nykamp Date: Mon, 11 Nov 2024 14:14:53 -0600 Subject: [PATCH] CIrcle center does not depend on radius with zero through points --- .../doenetml-worker/src/components/Circle.js | 35 +++++++++++-------- .../src/test/tagSpecific/circle.test.ts | 4 +-- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/doenetml-worker/src/components/Circle.js b/packages/doenetml-worker/src/components/Circle.js index b833f1fd8..26d43a1ee 100644 --- a/packages/doenetml-worker/src/components/Circle.js +++ b/packages/doenetml-worker/src/components/Circle.js @@ -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 @@ -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", diff --git a/packages/doenetml-worker/src/test/tagSpecific/circle.test.ts b/packages/doenetml-worker/src/test/tagSpecific/circle.test.ts index 117b60d16..870f1f9a3 100644 --- a/packages/doenetml-worker/src/test/tagSpecific/circle.test.ts +++ b/packages/doenetml-worker/src/test/tagSpecific/circle.test.ts @@ -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: `