Java Plotter
Using the skills I learned in my AP Computer Science A class, I coded a 2d and 3d point, line, and circle plotter in java with the ability to print the object on an x/y graph.
5/17/20242 min read
Features
Plot, graph, and calculate aspects (length, width, circumference, angle, distance, etc.) points, lines, circles, rectangles, and vectors.
Plot and do calculations within a 3D environment. Ability to plot 3D points, lines, spheres, and vectors.
All options are in an easy to use user interface with simple navigation methods.
The goal of this project was to maximize the use of object oriented programming, or in other words, it uses data and classes rather than just solely functions and logic.
Object Oriented Programming
Classes
The goal of this project was to maximize the use of object oriented programming, or in other words, it uses data and classes rather than just solely functions and logic.
I created 8 classes, including the main class. Each of these have parameters and attributes of the shape it represents. For example, the Point class has x and y ints, representing its coordinates on the x-y plane. The classes also have classes within them. The Line class uses two Points and the Circle class uses a Point and a Line. I also went into the 3rd dimension by making the class Point3d have 3 int parameters (x,y,z). With this I was able to make Line3d (2 3d points) and Sphere (a 3d point and a 3d line).
Graph Plotter
I decided to code a way to visually see the shapes a user was making. I decided I would have to make a 2d String array, plot the points on it by changing values in the specified coordinate, and print it. I began doing some research on various algorithms, such as Bresenham's line algorithm, that could allow me to plot lines and circles on the graph.
I soon realized, though, that this was going to be more complicated than I thought, so i got help... from ChatGPT.
I worked with the AI to create a class with methods for each shape class. The void methods automatically print the 2d array.
Summary
In this project, I had the opportunity to use my coding skills to create a simple graphing application. 600 lines of code later, I had something I was proud of and genuinely helped me (especially in physics). creating the methods, formulas, and functions for each shape's calculable component gave me a chance to brush up on my geometry and trigonometry skills. Overall, this was a great final project to conclude my AP Compsci class. I look forward to continue using coding in future projects.