{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "6cffa842-f8d2-4ec2-801a-1937f99b91b9", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 1, "id": "bf3c5e50-1a68-40b9-8a51-578861df3e4b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "createCanvasViaRotation (generic function with 1 method)" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "function createCanvasViaRotation(numCells, newShape, bField)\n", " cellCanvas2 = zeros(newShape)\n", " for ii in 1:numCells\n", " for jj in 1:numCells\n", " for kk in 1:numCells\n", " d = sqrt((ii - 1)^2 + (jj - 1)^2) # Adjust indices for 1-based indexing\n", " if Int(floor(d)) >= numCells\n", " break\n", " end\n", " if d == floor(d)\n", " cellCanvas2[ii, jj, kk] = bField[kk, Int(floor(d)) + 1] # Adjust index for 1 based indexing\n", " else\n", " xp = [jj - 1, jj] # Adjust index for 1 based indexing\n", " if d < size(bField, 2) - 1\n", " yps0 = bField[kk, Int(floor(d)) + 1:Int(floor(d)) + 2] # Adjust index for 1 based indexing\n", " yps1 = [[x, y] for (x, y) in zip(yps0[1:end], yps0[2:end])]\n", " cellCanvas2[ii, jj, kk] = [LinearInterpolations.interpolate((Int(floor(d)), Int(floor(d)) + 1), vs, d) for vs in yps1]\n", " end\n", " end\n", " end\n", " end\n", " end\n", " return cellCanvas2\n", "end" ] }, { "cell_type": "code", "execution_count": null, "id": "88d07c3c-caab-4a08-8fd6-e5b9c5548e88", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.11.3", "language": "julia", "name": "julia-1.11" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.11.3" } }, "nbformat": 4, "nbformat_minor": 5 }