Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package geometry;
- /**
- * Created by fabian on 04.12.2016.
- */
- public class Triangle {
- private Point P1;
- private Point P2;
- private Point P3;
- public Triangle(Point P1,Point P2,Point P3){
- this.P1 = P1;
- this.P2 = P2;
- this.P3 = P3;
- }
- public Point getP1(){
- return P1;
- }
- public Point getP2(){
- return P2;
- }
- public Point getP3(){
- return P3;
- }
- public Line [] getLines(){
- Line [] Lines = new Line[3];
- Lines[0] = new Line(this.getP1(),this.getP2());
- Lines[1] = new Line(this.getP2(),this.getP3());
- Lines[2] = new Line(this.getP3(),this.getP1());
- return Lines;
- }
- @Override
- public boolean equals (Object o,Object o2,Object o3){
- Point P1 = (Point) o;
- Point P2 = (Point) o2;
- Point P3 = (Point) o3;
- if (this.P1 == o && this.P2 == o2&&this.P3==o3)
- {
- return true;
- }else{
- return false;
- }
- }
- @Override
- public String toString(){
- String str1 = this.P1.toString();
- String str2 = this.P2.toString();
- String str3 = this.P3.toString();
- String ausgabe= str1+","+str2+","+str3;
- return ausgabe;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement