Created
April 18, 2022 11:15
-
-
Save pedrofracassi/cd6ea56248207b3a019bcbd2164cd181 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import numpy as np | |
import math | |
import matplotlib.pyplot as plt | |
min = 0 | |
max = 2*math.pi | |
precision = 3 | |
def x(t): | |
return round(12*math.cos(t) - 6*math.cos(6*t), precision) | |
def y(t): | |
return round(12*math.sin(t) - 6*math.sin(6*t), precision) | |
pontos = [] | |
autointerseccao = [] | |
for t in np.arange(min, max, 1/10**precision): | |
ponto = (x(t), y(t), t) | |
for p in pontos[:-5]: | |
if math.isclose(p[0], ponto[0], abs_tol=(1/10**precision)*20) and math.isclose(p[1], ponto[1], abs_tol=(1/10**precision)*20): | |
autointerseccao.append((p[2], t)) | |
pontos.append(ponto) |
Author
pedrofracassi
commented
Apr 18, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment