1

Hacked-together KaTeX support

This commit is contained in:
Evan Pratten 2024-11-27 18:41:25 -05:00
parent ebde2322d6
commit c04533b327
4 changed files with 37 additions and 40 deletions

View File

@ -19,6 +19,15 @@
<style>{{ page.custom_css }}</style> <style>{{ page.custom_css }}</style>
<!--noformat--> <!--noformat-->
{% endif %} {% endif %}
{% if page.enable_katex %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css"
integrity="sha512-fHwaWebuwA7NSF5Qg/af4UeDx9XqUpYpOGgubo3yWu+b2IQR4UeQwbb42Ti7gVAjNtVoI/I9TEoYeu9omwcC6g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.js"
integrity="sha512-LQNxIMR5rXv7o+b1l8+N1EZMfhG7iFZ9HhnbJkTp4zjNr5Wvst75AqUeFDxeRUa7l5vEDyUiAip//r+EFLLCyA=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
{% endif %}
</head> </head>
<body> <body>
@ -31,7 +40,8 @@
<ul> <ul>
<li> <li>
<a href="mailto:evan@ewpratten.com"> <a href="mailto:evan@ewpratten.com">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" style="height: 1em; width: 1em;"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"
style="height: 1em; width: 1em;">
<path <path
d="M 3 8 L 3 26 L 29 26 L 29 8 Z M 7.3125 10 L 24.6875 10 L 16 15.78125 Z M 5 10.875 L 15.4375 17.84375 L 16 18.1875 L 16.5625 17.84375 L 27 10.875 L 27 24 L 5 24 Z" /> d="M 3 8 L 3 26 L 29 26 L 29 8 Z M 7.3125 10 L 24.6875 10 L 16 15.78125 Z M 5 10.875 L 15.4375 17.84375 L 16 18.1875 L 16.5625 17.84375 L 27 10.875 L 27 24 L 5 24 Z" />
</svg> </svg>
@ -40,7 +50,8 @@
</li> </li>
<li> <li>
<a href="https://linkedin.com/in/ewpratten"> <a href="https://linkedin.com/in/ewpratten">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" style="height: 1em; width: 1em;"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"
style="height: 1em; width: 1em;">
<path <path
d="M 7.5 5 C 6.132813 5 5 6.132813 5 7.5 L 5 24.5 C 5 25.867188 6.132813 27 7.5 27 L 24.5 27 C 25.867188 27 27 25.867188 27 24.5 L 27 7.5 C 27 6.132813 25.867188 5 24.5 5 Z M 7.5 7 L 24.5 7 C 24.785156 7 25 7.214844 25 7.5 L 25 24.5 C 25 24.785156 24.785156 25 24.5 25 L 7.5 25 C 7.214844 25 7 24.785156 7 24.5 L 7 7.5 C 7 7.214844 7.214844 7 7.5 7 Z M 10.4375 8.71875 C 9.488281 8.71875 8.71875 9.488281 8.71875 10.4375 C 8.71875 11.386719 9.488281 12.15625 10.4375 12.15625 C 11.386719 12.15625 12.15625 11.386719 12.15625 10.4375 C 12.15625 9.488281 11.386719 8.71875 10.4375 8.71875 Z M 19.46875 13.28125 C 18.035156 13.28125 17.082031 14.066406 16.6875 14.8125 L 16.625 14.8125 L 16.625 13.5 L 13.8125 13.5 L 13.8125 23 L 16.75 23 L 16.75 18.3125 C 16.75 17.074219 16.996094 15.875 18.53125 15.875 C 20.042969 15.875 20.0625 17.273438 20.0625 18.375 L 20.0625 23 L 23 23 L 23 17.78125 C 23 15.226563 22.457031 13.28125 19.46875 13.28125 Z M 9 13.5 L 9 23 L 11.96875 23 L 11.96875 13.5 Z" /> d="M 7.5 5 C 6.132813 5 5 6.132813 5 7.5 L 5 24.5 C 5 25.867188 6.132813 27 7.5 27 L 24.5 27 C 25.867188 27 27 25.867188 27 24.5 L 27 7.5 C 27 6.132813 25.867188 5 24.5 5 Z M 7.5 7 L 24.5 7 C 24.785156 7 25 7.214844 25 7.5 L 25 24.5 C 25 24.785156 24.785156 25 24.5 25 L 7.5 25 C 7.214844 25 7 24.785156 7 24.5 L 7 7.5 C 7 7.214844 7.214844 7 7.5 7 Z M 10.4375 8.71875 C 9.488281 8.71875 8.71875 9.488281 8.71875 10.4375 C 8.71875 11.386719 9.488281 12.15625 10.4375 12.15625 C 11.386719 12.15625 12.15625 11.386719 12.15625 10.4375 C 12.15625 9.488281 11.386719 8.71875 10.4375 8.71875 Z M 19.46875 13.28125 C 18.035156 13.28125 17.082031 14.066406 16.6875 14.8125 L 16.625 14.8125 L 16.625 13.5 L 13.8125 13.5 L 13.8125 23 L 16.75 23 L 16.75 18.3125 C 16.75 17.074219 16.996094 15.875 18.53125 15.875 C 20.042969 15.875 20.0625 17.273438 20.0625 18.375 L 20.0625 23 L 23 23 L 23 17.78125 C 23 15.226563 22.457031 13.28125 19.46875 13.28125 Z M 9 13.5 L 9 23 L 11.96875 23 L 11.96875 13.5 Z" />
</svg> </svg>
@ -84,6 +95,24 @@
</footer> </footer>
{% include goatcounter.html %} {% include goatcounter.html %}
{% if page.enable_katex %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/auto-render.min.js"
integrity="sha512-iWiuBS5nt6r60fCz26Nd0Zqe0nbk1ZTIQbl3Kv7kYsX+yKMUFHzjaH2+AnM6vp2Xs+gNmaBAVWJjSmuPw76Efg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
delimiters: [
{ left: '$$', right: '$$', display: true },
{ left: '$', right: '$', display: false },
{ left: '\\(', right: '\\)', display: false },
{ left: '\\[', right: '\\]', display: true }
],
throwOnError: false
});
});
</script>
{% endif %}
</body> </body>
</html> </html>

View File

@ -3,18 +3,7 @@ layout: default
title: 'Notes from FRC: Converting joystick data to tank-drive outputs' title: 'Notes from FRC: Converting joystick data to tank-drive outputs'
description: and making a tank-based robot's movements look natural description: and making a tank-based robot's movements look natural
date: 2020-08-03 date: 2020-08-03
tags: enable_katex: true
- frc
- math
- python
aliases:
- /blog/2020/08/03/joystick-to-voltage
- /blog/joystick-to-voltage
extra:
uses:
- katex
excerpt: This post covers the algorithm I devised for converting joystick data to
motor commands at Raider Robotics
--- ---
I am starting a new little series here called "Notes from FRC". The idea is that I am going to write about what I have learned over the past three years of working (almost daily) with robots, and hopefully someone in the future will find them useful. The production source code I based this post around is available [here](https://github.com/frc5024/lib5k/blob/cd8ad407146b514cf857c1d8ac82ac8f3067812b/common_drive/src/main/java/io/github/frc5024/common_drive/calculation/DifferentialDriveCalculation.java). I am starting a new little series here called "Notes from FRC". The idea is that I am going to write about what I have learned over the past three years of working (almost daily) with robots, and hopefully someone in the future will find them useful. The production source code I based this post around is available [here](https://github.com/frc5024/lib5k/blob/cd8ad407146b514cf857c1d8ac82ac8f3067812b/common_drive/src/main/java/io/github/frc5024/common_drive/calculation/DifferentialDriveCalculation.java).

View File

@ -3,18 +3,7 @@ layout: default
title: 'Notes from FRC: Autonomous point-to-point navigation' title: 'Notes from FRC: Autonomous point-to-point navigation'
description: The tale of some very curvy math description: The tale of some very curvy math
date: 2020-08-13 date: 2020-08-13
tags: enable_katex: true
- frc
- math
extra:
excerpt: This post is a continuation on my "Notes from FRC" series. This time, I
cover an extremely simple, yet very effective way to get a tank-drive robot from
A to B autonomously.
uses:
- katex
aliases:
- /blog/2020/08/13/drivetrain-navigation
- /blog/drivetrain-navigation
--- ---
This post is a continuation on my "Notes from FRC" series. If you haven't already, I recommend reading my post on [Converting joystick data to tank-drive outputs](@/blog/2020-08-03-Joystick-to-Voltage.md). Some concepts in this post were introduced there. Like last time, to see the production code behind this post, check [here](https://github.com/frc5024/lib5k/blob/ab90994b2a0c769abfdde9a834133725c3ce3a38/common_drive/src/main/java/io/github/frc5024/common_drive/DriveTrainBase.java) and [here](https://github.com/frc5024/lib5k/tree/master/purepursuit/src/main/java/io/github/frc5024/purepursuit/pathgen). This post is a continuation on my "Notes from FRC" series. If you haven't already, I recommend reading my post on [Converting joystick data to tank-drive outputs](@/blog/2020-08-03-Joystick-to-Voltage.md). Some concepts in this post were introduced there. Like last time, to see the production code behind this post, check [here](https://github.com/frc5024/lib5k/blob/ab90994b2a0c769abfdde9a834133725c3ce3a38/common_drive/src/main/java/io/github/frc5024/common_drive/DriveTrainBase.java) and [here](https://github.com/frc5024/lib5k/tree/master/purepursuit/src/main/java/io/github/frc5024/purepursuit/pathgen).

View File

@ -3,17 +3,7 @@ layout: default
title: A rusty guide to quaternions title: A rusty guide to quaternions
description: Fast and efficient 3D object manipulation description: Fast and efficient 3D object manipulation
date: 2021-12-03 date: 2021-12-03
tags: enable_katex: true
- reference
- math
draft: false
extra:
uses:
- katex
excerpt: This post is an overview of Quaternions for Rust programmers, and anyone
willing to learn.
aliases:
- /blog/quaternions
--- ---
The running joke in the graphics programming world is that nobody understands quaternions. These big scary math-filled types are always <em>someone else's problem</em>. While quaternions <del>are</del> may be scary, they serve an important purpose in the world of computing as they The running joke in the graphics programming world is that nobody understands quaternions. These big scary math-filled types are always <em>someone else's problem</em>. While quaternions <del>are</del> may be scary, they serve an important purpose in the world of computing as they
@ -121,19 +111,19 @@ $$
As you can see, a pure quaternion is a quaternion with a real part of $0$ and a vector part equal to the vector it is being made of. As you can see, a pure quaternion is a quaternion with a real part of $0$ and a vector part equal to the vector it is being made of.
Next, you need the conjugate of the quaternion (which is called $q^\*$). The following are both the expressions for a quaternion, and a conjugate quaternion: Next, you need the conjugate of the quaternion (which is called $q^*$). The following are both the expressions for a quaternion, and a conjugate quaternion:
$$ $$
\begin{aligned} \begin{aligned}
q &= w + x \mathbf{i} + y \mathbf{j} + z \mathbf{k} \\\\ q &= w + x \mathbf{i} + y \mathbf{j} + z \mathbf{k} \\\\
q^\* &= w - x \mathbf{i} - y \mathbf{j} - z \mathbf{k} q^* &= w - x \mathbf{i} - y \mathbf{j} - z \mathbf{k}
\end{aligned} \end{aligned}
$$ $$
With all the required parts, the transformed vector ($p$) is equal to: With all the required parts, the transformed vector ($p$) is equal to:
$$ $$
p = q^\*kq p = q^*kq
$$ $$
<strong>NOTE:</strong> Quaternion multiplicaiton is [noncommutative](https://en.wikipedia.org/wiki/Commutative_property), meaning that the order you multiply things <em>matters</em>. This is not normal multiplication. <strong>NOTE:</strong> Quaternion multiplicaiton is [noncommutative](https://en.wikipedia.org/wiki/Commutative_property), meaning that the order you multiply things <em>matters</em>. This is not normal multiplication.