This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pseudo-hilbert curve generator. Maps ordered items from an array (1D) to a rectangle (2D) | |
# in a way that best retains the distances between indexes of the initial array as euclidean distances in the rectangle | |
# | |
# Hilbert curves are only possible for powers of 2, so the gilbert() function instead tries to fit as many hilbert | |
# "blocks" together as possible. This is through a greedy approach and works well enough for my needs | |
# | |
# Free for any use, but let me know so I know someone found it useful :) | |
# | |
# AUTHOR : James Zingel (2022) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass [tikz,border=10pt]{standalone} | |
\usepackage{circuitikz} | |
\begin{document} | |
\newcommand{\dircoupler}[2]{ % #1 = name of object, #2 = rotation angle | |
\draw[thick,rotate=#2] (#1.nw) -- (#1.ne) -- (#1.se) -- (#1.sw) -- cycle; | |
\draw[thick,rotate=#2] (#1.n) -- ++(.3,0) -- ++(0,-0.3); | |
\draw[thick,rotate=#2] (#1.e) -- (#1.w); | |
} |