Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cz.muni.fi.pb162.project.geometry;
- /**
- * Write a description of class Vertex2D here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Vertex2D
- {
- private double x;
- private double y;
- /**
- * An example of a method - replace this comment with your own
- *
- * @param y a sample parameter for a method
- * @return the sum of x and y
- */
- public double getX(){
- return x;
- }
- public double getY(){
- return y;
- }
- public void setX(double x){
- this.x=x;
- }
- public void setY(double y){
- this.y=y;
- }
- public String toString(){
- return "["+x+", "+y+"]";
- }
- public double distance(Vertex2D point){
- double d;
- point.getX
- d = Math.sqrt((x - y) * (x - y) + (y2 - y1) * (y2 - y1));
- return d;
- }
- }
- package cz.muni.fi.pb162.project.geometry;
- /**
- * Write a description of class Triangle here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Triangle
- {
- private Vertex2D a;
- private Vertex2D b;
- private Vertex2D c;
- /**
- * An example of a method - replace this comment with your own
- *
- * @param y a sample parameter for a method
- * @return the sum of x and y
- */
- public void setVertexA(double x, double y){
- a = vert;
- a.setX(x);
- a.setY(y);
- }
- public void setVertexB(double x, double y){
- b.setX(x);
- b.setX(x);
- }
- public void setVertexC(double x, double y){
- c.setX(x);
- c.setX(x);
- }
- public Vertex2D getVertexA(){
- return a;
- }
- public Vertex2D getVertexB(){
- return b;
- }
- public Vertex2D getVertexC(){
- return c;
- }
- public boolean isEquilateral(Vertex2D aa, Vertex2D bn){
- //if (Math.abs(b.distance(aa) - c.distance(bb) < 0.001))
- return true;
- }
- public String toString(){
- return "Triangle: vertices=["+a.getX()+","+a.getY()+"] ["+b.getX()+", "+b.getY()+"] ["+c.getX()+", "+c.getY()+"].";
- }
- }
Add Comment
Please, Sign In to add comment