Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add circle points function #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions curves/sim.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import pandas as pd
import math

def circle(radius: float, n_points: int) -> pd.DataFrame:
# Returns a dataframe with columns `x` and `y`
# These are the co-ordinates of points on a circle of
# specified radius, with n_points evenly spaced
pass
"""
Generate a circle of points.

Returns a dataframe with columns 'x' and 'y' corresponding to
points uniformly spaced in a circular formation.

Parameters
----------
radius : float
The radius of the circle
n_ponts : int
The number of points that the circle should be
comprised of.

Returns
----------
out : pandas.DataFrame
Dataframe containing columns 'x' and 'y' as coordinates
for points on the circle.

"""

points = [(math.cos(2*math.pi/n_points*x)*radius,math.sin(2*math.pi/n_points*x)*radius) for x in range(0,n_points+1)]
df = pd.DataFrame(data=points, columns=['x','y'])
return df