Skip to content

Conversation

@Tarun2605
Copy link
Contributor

Description

This pull request enhances the plotting functionality in src/core/Core/Application.cpp by adding support for polar coordinate plots.
Functions containing the variable theta are now automatically interpreted and plotted in polar form, expanding the application's graphing capabilities.

ISSUE ADDRESSED: #2

Plotting Improvements

  • Added detection for functions using the variable theta to identify polar equations and plot them using polar coordinates (r = f(theta)), converting results to (x, y) for rendering.
  • Implemented a loop to evaluate and plot polar functions over a range of theta values, drawing the corresponding polyline on the canvas.

Codebase Updates

  • Included the <cmath> header to support trigonometric operations required for polar plotting.

These changes enable the application to visualize both standard and polar equations seamlessly.


Semver Changes

  • Minor (new features, no breaking changes)

Issues

None


Checklist

ATTACHING OUTPUT SCREENSHOTS

CARTESIAN:
image

POLAR:
image

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

Actually after a bit of thinking, this implementation is actually quite bad at recognising whether the user actually wants to plot a polar function or not.

Say I type 1 in the expression. Do I mean y = 1 or r = 1? y = 1 is a line while r = 1 is a circle, which is a drastically different graph.

I would request you to implement the "starts with r =" approach instead of "checking for theta" for this reason.

@Tarun2605
Copy link
Contributor Author

Yeah I just noticed that right now, you are absolutely right on that. I was just thinking of keeping functionalities same across cartesian and polar coords.

@Tarun2605
Copy link
Contributor Author

I am attaching the screenshot of the new implementation
image

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

Looks great. I'll review the code by this evening and merge it. Thanks!

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

Really liked this PR. No obtrusive code changes, just the feature cleanly integrated into the pre-existing code. Thanks for contributing!

@nsh07 nsh07 merged commit fe08571 into OPCODE-Open-Spring-Fest:main Oct 23, 2025
6 checks passed
@Tarun2605
Copy link
Contributor Author

Thank you !!! :)

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

Please feel free to make any further feature requests or bug reports in this repo if you'd like

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

Important

@Tarun2605 It seems you haven't registered on the OPCODE Discord server (at https://discord.gg/F63kqjsJ). Please join it and register your GitHub account in the #register channel for your score to show up on the leaderboard

@Tarun2605
Copy link
Contributor Author

I am sorry but what leaderboard are you talking about?

@Tarun2605
Copy link
Contributor Author

Ohh didnt knew this was a competition. I just do open source for fun nowadays and to kill time. Sorry if I intervened. Thank you for taking my PR though.

@nsh07
Copy link
Member

nsh07 commented Oct 23, 2025

No problem lol, you can register on the Discord anyway. We have prizes for participants, and students from outside of IIIT Bhagalpur are also allowed to participate. Now don't tell me you're not a student 😅

@Tarun2605
Copy link
Contributor Author

Yeah yeah I am student. Final year at NSUT, Delhi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants