{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "using Plots" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "get_rotation_matrix (generic function with 1 method)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "function get_rotation_matrix(rad)\n", " rot = [cos(rad) -sin(rad); sin(rad) cos(rad)]\n", " return rot\n", "end" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "plotting (generic function with 1 method)" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "base_point1 = Float64[1. 0.; 0. 1]\n", "base_point2 = Float64[0.75 0.; 0. 0.75]\n", "base_point3 = Float64[0.5 0.; 0. 0.5]\n", "base_point4 = Float64[0.25 0.; 0. 0.25]\n", "base_point5 = Float64[0. 0.; 0. 0.]\n", "\n", "x_points1 = []\n", "y_points1 = []\n", "x_points2 = []\n", "y_points2 = []\n", "x_points3 = []\n", "y_points3 = []\n", "x_points4 = []\n", "y_points4 = []\n", "x_points5 = []\n", "y_points5 = []\n", "\n", "function plotting()\n", " for i in 1:12\n", " deg = i * 30\n", " rad = deg * π / 180\n", " rot = get_rotation_matrix(rad)\n", " \n", " rotated1 =[rot* base_point1]\n", " rotated2 =[rot* base_point2]\n", " rotated3 =[rot* base_point3]\n", " rotated4 =[rot* base_point4]\n", " rotated5 =[rot* base_point5]\n", " \n", " push!(x_points1, rotated1[1][1])\n", " push!(y_points1, rotated1[1][2])\n", " push!(x_points2, rotated2[1][1])\n", " push!(y_points2, rotated2[1][2])\n", " push!(x_points3, rotated3[1][1])\n", " push!(y_points3, rotated3[1][2])\n", " push!(x_points4, rotated4[1][1])\n", " push!(y_points4, rotated4[1][2])\n", " push!(x_points5, rotated5[1][1])\n", " push!(y_points5, rotated5[1][2])\n", " end\n", "end" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "-1.0\n", "\n", "\n", "-0.5\n", "\n", "\n", "0.0\n", "\n", "\n", "0.5\n", "\n", "\n", "1.0\n", "\n", "\n", "-1.0\n", "\n", "\n", "-0.5\n", "\n", "\n", "0.0\n", "\n", "\n", "0.5\n", "\n", "\n", "1.0\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "y1\n", "\n", "\n", "\n", "\n", "y2\n", "\n", "\n", "\n", "\n", "y3\n", "\n", "\n", "\n", "\n", "y4\n", "\n", "\n", "\n", "\n", "y5\n", "\n", "\n" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "plotting()\n", "plot([x_points1, x_points2, x_points3, x_points4, x_points5], [y_points1, y_points2, y_points3, y_points4, y_points5], st=:scatter, size=(400,400))" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "LoadError", "evalue": "\u001b[91mUndefVarError: plotting not defined\u001b[39m", "output_type": "error", "traceback": [ "\u001b[91mUndefVarError: plotting not defined\u001b[39m", "", "Stacktrace:", " [1] \u001b[1minclude_string\u001b[22m\u001b[22m\u001b[1m(\u001b[22m\u001b[22m::String, ::String\u001b[1m)\u001b[22m\u001b[22m at \u001b[1m./loading.jl:522\u001b[22m\u001b[22m" ] } ], "source": [ "plotting()\n", "plot([x_points1, x_points2, x_points3, x_points4, x_points5], [y_points1, y_points2, y_points3, y_points4, y_points5], st=:scatter, size=(400,400))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 0.6.2", "language": "julia", "name": "julia-0.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "0.6.2" } }, "nbformat": 4, "nbformat_minor": 2 }