From 51c18847aef062bd954feb67394e20b5d8426d67 Mon Sep 17 00:00:00 2001 From: Kinvert Date: Thu, 3 Apr 2025 18:51:21 -0400 Subject: [PATCH] Fix Cart-Pole Render Angle --- cart-pole/ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cart-pole/ui.js b/cart-pole/ui.js index 8b13e818f..c87e99ff8 100644 --- a/cart-pole/ui.js +++ b/cart-pole/ui.js @@ -169,7 +169,7 @@ function renderCartPole(cartPole, canvas) { // Draw the pole. const angle = cartPole.theta + Math.PI / 2; const poleTopX = - halfW + scale * (cartPole.x + Math.cos(angle) * cartPole.length); + halfW + scale * (cartPole.x - Math.cos(angle) * cartPole.length); const poleTopY = railY - scale * (cartPole.cartHeight / 2 + Math.sin(angle) * cartPole.length); context.beginPath();