new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, getHeight());
new_coords = lineIntersect(x1, y1, x2, y2, this.getWidth(), 0, this.getHeight());
    private FastVector makePolygon(FastVector v) {      FastVector building = new FastVector(v.size() + 10);      double x1, y1, x2, y2;      int edge1 = 0, edge2 = 0;      for (int noa = 0; noa < v.size() - 2; noa++) {	building.addElement(new Double(((Double)v.elementAt(noa)).				       doubleValue()));      }            //now clip the lines      double[] new_coords;      //note lineIntersect , expects the values to have been converted to       //screen coords      //note the first point passed is the one that gets shifted.      x1 = convertToPanelX(((Double)v.elementAt(1)).doubleValue());      y1 = convertToPanelY(((Double)v.elementAt(2)).doubleValue());      x2 = convertToPanelX(((Double)v.elementAt(3)).doubleValue());      y2 = convertToPanelY(((Double)v.elementAt(4)).doubleValue());      if (x1 < 0) {	//test left	new_coords = lineIntersect(x1, y1, x2, y2, 0, getHeight(), 0);	edge1 = 0;	if (new_coords[0] < 0) {	  //then not left	  if (y1 < 0) {	    //test top	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	    edge1 = 1;	  }	  else {	    //test bottom	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				       getHeight());	    edge1 = 3;	  }	}      }      else if (x1 > getWidth()) {	//test right	new_coords = lineIntersect(x1, y1, x2, y2, 0, getHeight(), 				   getWidth());	edge1 = 2;	if (new_coords[0] < 0) {	  //then not right	  if (y1 < 0) {	    //test top	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	    edge1 = 1;	  }	  else {	    //test bottom	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				       getHeight());	    edge1 = 3;	  }	}      }      else if (y1 < 0) {	//test top	new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	edge1 = 1;      }      else {	//test bottom	new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				   getHeight());	edge1 = 3;      }            building.setElementAt(new Double(convertToAttribX(new_coords[0])), 1);      building.setElementAt(new Double(convertToAttribY(new_coords[1])), 2);      x1 = convertToPanelX(((Double)v.elementAt(v.size() - 4)).doubleValue());      y1 = convertToPanelY(((Double)v.elementAt(v.size() - 3)).doubleValue());      x2 = convertToPanelX(((Double)v.elementAt(v.size() - 6)).doubleValue());      y2 = convertToPanelY(((Double)v.elementAt(v.size() - 5)).doubleValue());            if (x1 < 0) {	//test left	new_coords = lineIntersect(x1, y1, x2, y2, 0, getHeight(), 0);	edge2 = 0;	if (new_coords[0] < 0) {	  //then not left	  if (y1 < 0) {	    //test top	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	    edge2 = 1;	  }	  else {	    //test bottom	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				       getHeight());	    edge2 = 3;	  }	}      }      else if (x1 > getWidth()) {	//test right	new_coords = lineIntersect(x1, y1, x2, y2, 0, getHeight(), 				   getWidth());	edge2 = 2;	if (new_coords[0] < 0) {	  //then not right	  if (y1 < 0) {	    //test top	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	    edge2 = 1;	  }	  else {	    //test bottom	    new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				       getHeight());	    edge2 = 3;	  }	}      }      else if (y1 < 0) {	//test top	new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 0);	edge2 = 1;      }      else {	//test bottom	new_coords = lineIntersect(x1, y1, x2, y2, getWidth(), 0, 				   getHeight());	edge2 = 3;      }            building.setElementAt(new Double(convertToAttribX(new_coords[0])), 			    building.size() - 2);      building.setElementAt(new Double(convertToAttribY(new_coords[1])), 			    building.size() - 1);            //trust me this complicated piece of code will      //determine what points on the boundary of the view to add to the polygon      int xp, yp;      xp = getWidth() * ((edge2 & 1) ^ ((edge2 & 2) / 2));      yp = getHeight() * ((edge2 & 2) / 2);      //System.out.println(((-1 + 4) % 4) + " hoi");            if (inPolyline(v, convertToAttribX(xp), convertToAttribY(yp))) {	//then add points in a clockwise direction	building.addElement(new Double(convertToAttribX(xp)));	building.addElement(new Double(convertToAttribY(yp)));	for (int noa = (edge2 + 1) % 4; noa != edge1; noa = (noa + 1) % 4) {	  xp = getWidth() * ((noa & 1) ^ ((noa & 2) / 2));	  yp = getHeight() * ((noa & 2) / 2);	  building.addElement(new Double(convertToAttribX(xp)));	  building.addElement(new Double(convertToAttribY(yp)));	}      }      else {	xp = getWidth() * ((edge2 & 2) / 2);	yp = getHeight() * (1 & ~((edge2 & 1) ^ ((edge2 & 2) / 2)));	if (inPolyline(v, convertToAttribX(xp), convertToAttribY(yp))) {	  //then add points in anticlockwise direction	  building.addElement(new Double(convertToAttribX(xp)));	  building.addElement(new Double(convertToAttribY(yp)));	  for (int noa = (edge2 + 3) % 4; noa != edge1; noa = (noa + 3) % 4) {	    xp = getWidth() * ((noa & 2) / 2);	    yp = getHeight() * (1 & ~((noa & 1) ^ ((noa & 2) / 2)));	    building.addElement(new Double(convertToAttribX(xp)));	    building.addElement(new Double(convertToAttribY(yp)));	  }	}      }      return building;    }