-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jgsteplujr
authored and
jgsteplujr
committed
Jun 11, 2017
0 parents
commit 0717754
Showing
8 changed files
with
1,096 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Welcome to the Geometric Constructor | ||
|
||
You can use this program to model compass-and-straightedge geometric constructions | ||
Read more about it here: https://en.wikipedia.org/wiki/Compass-and-straightedge_construction | ||
|
||
The program provides you with two fixed points to start the construction | ||
|
||
You can use the following keyboard commands: | ||
|
||
Select: Select or deselect entities by clicking on them | ||
Delete: Delete selected entities | ||
|
||
0 / H : Hide selected entities or show all | ||
1 / P : Construct a new point on the intersection of two existing geometries | ||
2 / C : Construct a circle on two existing points. First select the center point, then select the radius | ||
3 / L : Construct a line on two existing points by selecting them | ||
|
||
+ / - : Zoom in or out of view | ||
Arrows: Pan the view | ||
|
||
Made for the ICS3U programming course, June 2017 | ||
|
||
Source code at https://github.com/yuliu2016/geometryconstructor |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ca.wtcs.ics3u.gc; | ||
|
||
|
||
/* | ||
* Created by Yu Liu on 2017-06-06 | ||
* ICS3U - Culminating Project - A compass-and-straightedge construction tool | ||
* | ||
* More information at https://github.com/yuliu2016/GeometryConstructor | ||
*/ | ||
|
||
|
||
/** | ||
* Contains all the constants used in this application | ||
* | ||
* @author Yu Liu | ||
*/ | ||
|
||
|
||
class Const { | ||
|
||
static final int DEFAULT_WIDTH = 600; | ||
|
||
static final int DEFAULT_HEIGHT = 450; | ||
|
||
static final int MINIMUM_WIDTH = 300; | ||
|
||
static final int MINIMUM_HEIGHT = 300; | ||
|
||
static final int PAN_RATE = 10; | ||
|
||
static final double ZOOM_RATE = 1.05; | ||
|
||
static final int FRAME_PERIOD = 15; | ||
|
||
static final int POINT_DIAMETER = 10; | ||
|
||
static final int POINT_OUTLINE = 14; | ||
|
||
static final double MIN_ZOOM_RATIO = 0.2; | ||
|
||
static final double MAX_ZOOM_RATIO = 5; | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package ca.wtcs.ics3u.gc; | ||
|
||
|
||
import java.awt.*; | ||
|
||
|
||
/* | ||
* Created by Yu Liu on 2017-06-06 | ||
* ICS3U - Culminating Project - A compass-and-straightedge construction tool | ||
* | ||
* More information at https://github.com/yuliu2016/GeometryConstructor | ||
*/ | ||
|
||
|
||
/** | ||
* <code>Geometry</code> is a top-level interface for | ||
* all geometric entities used in this application. An | ||
* object that implements this interface will be able to | ||
* select/deselect , show/hide, and paint itself, and would | ||
* also be able to add itself into a {@link GraphView} | ||
* | ||
* @author Yu Liu | ||
* @see Geometry1D | ||
*/ | ||
|
||
|
||
public interface Geometry { | ||
|
||
|
||
/** | ||
* Paints the geometry entity | ||
* @param g the graphic context to be drawn on | ||
* @param viewPort the viewport context to determine position | ||
*/ | ||
|
||
void paint (Graphics g, ViewPort viewPort); | ||
|
||
|
||
/** | ||
* Determines if a mouse position is hovering over the geometry | ||
* @param mouseX the X position of the mouse | ||
* @param mouseY the Y position of the mouse | ||
* @param viewPort the viewport context to determine position | ||
* @return if the mouse is over geometry | ||
*/ | ||
|
||
boolean isMouseOver(int mouseX, int mouseY, ViewPort viewPort); | ||
|
||
|
||
/** | ||
* Determines if the geometry is selected | ||
* @return if the geometry is selected | ||
*/ | ||
|
||
boolean isSelected(); | ||
|
||
|
||
/** | ||
* Determines if the geometry is hidden | ||
* @return if the geometry is hidden | ||
*/ | ||
|
||
boolean isHidden(); | ||
|
||
|
||
/** | ||
* Sets the hovered state of geometry | ||
* @param hovered the hovered state of geometry | ||
*/ | ||
|
||
void setHovered(boolean hovered); | ||
|
||
|
||
/** | ||
* Sets the selected state of geometry | ||
* @param selected the selected state of geometry | ||
*/ | ||
|
||
void setSelected(boolean selected); | ||
|
||
|
||
/** | ||
* Sets the hidden state of geometry | ||
* @param hidden the hidden state of geometry | ||
*/ | ||
|
||
void setHidden(boolean hidden); | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ca.wtcs.ics3u.gc; | ||
|
||
|
||
/* | ||
* Created by Yu Liu on 2017-06-06 | ||
* ICS3U - Culminating Project - A compass-and-straightedge construction tool | ||
* | ||
* More information at https://github.com/yuliu2016/GeometryConstructor | ||
*/ | ||
|
||
|
||
/** | ||
* <code>Geometry1D</code> is a currently empty interface that represent | ||
* a 1 dimensional object. Useful later when a geometry can only be a point | ||
* | ||
* @author Yu Liu | ||
* @see Geometry | ||
*/ | ||
|
||
interface Geometry1D | ||
extends Geometry { | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ca.wtcs.ics3u.gc; | ||
|
||
|
||
/* | ||
* Created by Yu Liu on 2017-06-06 | ||
* ICS3U - Culminating Project - A compass-and-straightedge construction tool | ||
* | ||
* More information at https://github.com/yuliu2016/GeometryConstructor | ||
*/ | ||
|
||
|
||
/** | ||
* Contains the wrapper main method to initiate a GraphView | ||
* | ||
* @author Yu Liu | ||
* @see GraphView | ||
*/ | ||
|
||
|
||
public class GeometryConstructor { | ||
|
||
public static void main(String[] args) { | ||
|
||
new GraphView(); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.