Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.*;
- import canvasML.*;
- public class test1 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- // targil 1
- Line l1 = new Line (90, 90 ,310, 90, "orange");
- Line l2 = new Line (50, 30,280 ,270 , "blue");
- l2.erase();
- l2.setPoints(l2.getXs(),l2.getYs() , l1.getXe(), l1.getYe());
- //targil 3
- Line l3 = new Line (l2.getXs(), l2.getYs(),l1.getXs(), l1.getYs(), "red");
- // targil 4
- double l1length = Math.pow (l1.getYe() - l1.getYs(), 2) + Math.pow(l1.getXe() - l1.getXs(), 2);
- double l2length = Math.pow (l2.getYe() - l2.getYs(), 2) + Math.pow(l2.getXe() - l2.getXs(), 2);
- double l3length = Math.pow (l3.getYe() - l3.getYs(), 2) + Math.pow(l3.getXe() - l3.getXs(), 2);
- System.out.println (l1length);
- System.out.println (l2length);
- System.out.print(l3length);
- if (l1length > l2length && l1length > l3length)
- {
- l1.changeColor("black");
- l1.erase();
- l1.draw();
- }
- if (l2length > l1length && l2length > l3length)
- {
- l2.changeColor("black");
- l2.erase();
- l2.draw();
- }
- if (l3length > l1length && l3length > l2length)
- {
- l3.changeColor("black");
- l3.erase();
- l3.draw();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment