소스 검색

Clean up name rendering

Kirk Trombley 3 년 전
부모
커밋
7110db9a05
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      nearest.js

+ 3 - 3
nearest.js

@@ -148,7 +148,7 @@ const renderQVec = (q, node, sub) => {
 const renderVec = math => `\\vec{${math.charAt(0)}}${math.substr(1)}`;
 const renderNorm = vec => `\\frac{${vec}}{\\left|\\left|${vec}\\right|\\right|}`;
 const metricText = [
-  "\\text{RMS}_{P} ~ \\arg\\min_{P}\\left[X\\left(P\\right) - 2\\vec{q}\\cdot \\vec{Y}\\left(P\\right)\\right]",
+  "\\text{RMS}_{P}\\left(q\\right) ~ \\arg\\min_{P}\\left[X\\left(P\\right) - 2\\vec{q}\\cdot \\vec{Y}\\left(P\\right)\\right]",
   `\\angle \\left(\\vec{q}, \\vec{Y}\\left(P\\right)\\right) ~ \\arg\\max_{P}\\left[\\cos\\left(\\angle \\left(\\vec{q}, \\vec{Y}\\left(P\\right)\\right)\\right)\\right]`,
   "\\angle \\left(\\vec{q}_{\\perp}, \\vec{Y}\\left(P\\right)_{\\perp} \\right), \\vec{v}_{\\perp} = \\text{oproj}_{\\left\\{\\vec{J}, \\vec{L}\\right\\}}{\\vec{v}}",
 ];
@@ -158,7 +158,7 @@ const updateObjective = () => {
     const { includeX, normQY, closeCoeff } = state;
     const xTerm = includeX ? "X\\left(P\\right)" : "";
     const qyMod = normQY ? c => renderNorm(renderVec(c)) : renderVec;
-    tex = `\\arg\\min_{P}\\left[${xTerm}-${closeCoeff === 1 ? "" : closeCoeff}${qyMod("q")}\\cdot ${qyMod("Y\\left(P\\right)")}\\right]`;
+    tex = `\\arg\\${includeX ? "min" : "max"}_{P}\\left[${xTerm}${includeX ? "-" : ""}${closeCoeff === 1 ? "" : closeCoeff}${qyMod("q")}\\cdot ${qyMod("Y\\left(P\\right)")}\\right]`;
   }
   const objFnNode = getObjFnDisplay();
   clearNodeContents(objFnNode);
@@ -196,7 +196,7 @@ const renderPokemon = (data, classes = {}) => {
     chromaAngle = 0, hueAngle = 0,
   } = displayMetrics;
 
-  const titleName = name.charAt(0).toUpperCase() + name.substr(1);
+  const titleName = name.split("-").map(part => part.charAt(0).toUpperCase() + part.substr(1)).join(" ");
   const textHex = getContrastingTextColor(yRGB);
   const rgbVec = yRGB.map(c => c.toFixed()).join(", ");
   const jabVec = yJAB.map(c => c.toFixed(1)).join(", ");