gt: 		smallY = smallY.add(y);
context: import java.math.BigDecimal;
  import java.math.MathContext;
  
  
  /**
   *
   * @author  Stiaan Uyttersprot
   */
  public class Edge {
  	private Coordinate startPoint;
  	private Coordinate endPoint;
  	private int edgeNumber;
  	private double edgeAngle;
  	private double deltaAngle;
  	
  	// values to be used for bounding box intersection
  	private BigDecimal smallX;
  	private BigDecimal bigX;
  	private BigDecimal smallY;
  	private BigDecimal bigY;
  		
  	private int edgeLabel; //wordt momenteel niet gebruikt
  	private boolean polygonA;
  	private boolean turningPoint;
  	private boolean additional = false; //this edge is additional and is not used for track line trips
  	
  	private int tripSequenceNumber;
  	
  	public static BigDecimal round = new BigDecimal(0);
  	private static MathContext mc = MathContext.DECIMAL128;
  	//values for boundarySearch
  	private boolean positive;
  	private boolean negative;
  	private Coordinate startIntersect;
  	private Coordinate endIntersect;
  	
  	Edge(Coordinate s, Coordinate e, int eN) {
  		startPoint = s;
  		endPoint = e;
  		edgeNumber = eN;
  		calculateRanges();
  	}
  
  	public Edge(Edge edge) {
  		startPoint = new Coordinate(edge.getStartPoint());
  		endPoint = new Coordinate(edge.getEndPoint());
  		edgeNumber = edge.getEdgeNumber();
  		edgeAngle =edge.getEdgeAngle();
  		deltaAngle = edge.getDeltaAngle();
  		turningPoint = edge.isTurningPoint();
  		polygonA = edge.isPolygonA();
  		calculateRanges();
  	}
  	
  	public Edge(Edge edge, boolean add) {
  		startPoint = new Coordinate(edge.getStartPoint());
  		endPoint = new Coordinate(edge.getEndPoint());
  		edgeNumber = edge.getEdgeNumber();
  		edgeAngle =edge.getEdgeAngle();
  		deltaAngle = edge.getDeltaAngle();
  		turningPoint = edge.isTurningPoint();
  		polygonA = edge.isPolygonA();
  		additional = add;
  		calculateRanges();
  	}
  
  	public Edge(Coordinate s, Coordinate e) {
  		startPoint = s;
  		endPoint = e;
  		edgeNumber = -1;
  		calculateRanges();
  	}
  
  	public Coordinate getStartPoint() {
  		return startPoint;
  	}
  
  	public void setStartPoint(Coordinate startPoint) {
  		this.startPoint = startPoint;
  	}
  
  	public Coordinate getEndPoint() {
  		return endPoint;
  	}
  
  	public void setEndPoint(Coordinate endPoint) {
  		this.endPoint = endPoint;
  	}
  
  	public int getEdgeNumber() {
  		return edgeNumber;
  	}
  
  	public void setEdgeNumber(int edgeNumber) {
  		this.edgeNumber = edgeNumber;
  	}
  
  	public void print() {
  		System.out.println(startPoint.toString() + ";" + endPoint.toString());
  	}
  
  public double getEdgeAngle() {
  		
  		return edgeAngle;
  	}
  
  	public BigDecimal getSmallX() {
  		return smallX;
  	}
  
  	public void setSmallX(BigDecimal smallX) {
  		this.smallX = smallX;
  	}
  
  	public BigDecimal getBigX() {
  		return bigX;
  	}
  
  	public void setBigX(BigDecimal bigX) {
  		this.bigX = bigX;
  	}
  
  	public BigDecimal getSmallY() {
  		return smallY;
  	}
  
  	public void setSmallY(BigDecimal smallY) {
  		this.smallY = smallY;
  	}
  
  	public BigDecimal getBigY() {
  		return bigY;
  	}
  
  	public void setBigY(BigDecimal bigY) {
  		this.bigY = bigY;
  	}
  	
  	public boolean isPositive() {
  		return positive;
  	}
  
  	public void setPositive(boolean positive) {
  		this.positive = positive;
  	}
  
  	public boolean isNegative() {
  		return negative;
  	}
  
  	public void setNegative(boolean negative) {
  		this.negative = negative;
  	}
  
  	public Coordinate getStartIntersect() {
  		return startIntersect;
  	}
  
  	public void setStartIntersect(Coordinate startIntersect) {
  		this.startIntersect = startIntersect;
  	}
  
  	public Coordinate getEndIntersect() {
  		return endIntersect;
  	}
  
  	public void setEndIntersect(Coordinate endIntersect) {
  		this.endIntersect = endIntersect;
  	}
  
  	public void calcEdgeAngle(){
  		double numerator = endPoint.getyCoord().doubleValue()- startPoint.getyCoord().doubleValue();
  		
  		double denominator = endPoint.getxCoord().doubleValue()- startPoint.getxCoord().doubleValue();
  
  		edgeAngle = Math.atan2(numerator, denominator);
  	}
  	
  	public void calcInverseEdgeAngle() {
  		double numerator = startPoint.getyCoord().doubleValue() - endPoint.getyCoord().doubleValue();
  		double denominator = startPoint.getxCoord().doubleValue() - endPoint.getxCoord().doubleValue();
  		edgeAngle = Math.atan2(numerator,denominator);
  	}
  	public Coordinate calcIntersection(Edge testEdge) {
  		/*
  		 * the used formula is
  		 * x=((x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-
  		 * y2)*(x3-x4));
  		 * y=((x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4))/((x1-x2)*(y3-y4)-(y1-
  		 * y2)*(x3-x4));
  		 */
  
  		BigDecimal x1 = startPoint.getxCoord();
  		BigDecimal x2 = endPoint.getxCoord();
  		BigDecimal y1 = startPoint.getyCoord();
  		BigDecimal y2 = endPoint.getyCoord();
  
  		BigDecimal x3 = testEdge.getStartPoint().getxCoord();
  		BigDecimal x4 = testEdge.getEndPoint().getxCoord();
  		BigDecimal y3 = testEdge.getStartPoint().getyCoord();
  		BigDecimal y4 = testEdge.getEndPoint().getyCoord();
  
  		// x1 - x2
  		BigDecimal dx1 = x1.subtract(x2);
  		// x3 - x4
  		BigDecimal dx2 = x3.subtract(x4);
  		// y1 - y2
  		BigDecimal dy1 = y1.subtract(y2);
  		// y3 - y4
  		BigDecimal dy2 = y3.subtract(y4);
  
  		// (x1*y2-y1*x2)
  		BigDecimal pd1 = x1.multiply(y2).subtract(y1.multiply(x2));
  		// (x3*y4-y3*x4)
  		BigDecimal pd2 = x3.multiply(y4).subtract(y3.multiply(x4));
  
  		// (x1*y2-y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4)
  		BigDecimal xNumerator = pd1.multiply(dx2).subtract(dx1.multiply(pd2));
  		// (x1*y2-y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4)
  		BigDecimal yNumerator = pd1.multiply(dy2).subtract(dy1.multiply(pd2));
  
  		// (x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)
  		BigDecimal denominator = dx1.multiply(dy2).subtract(dy1.multiply(dx2));
  
  		BigDecimal xCoord = xNumerator.divide(denominator, MathContext.DECIMAL128);
  		BigDecimal yCoord = yNumerator.divide(denominator, MathContext.DECIMAL128);
  
  		return new Coordinate(xCoord, yCoord);
  	}
  
  	//when a translation is taking place, the values of min and max have to be adjusted
  	public void changeRangeValues(BigDecimal x, BigDecimal y) {
  		smallX = smallX.add(x);
  		bigX = bigX.add(x);
  