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

Circle center does not depend on radius with zero through points #254

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading