// Solve for time float time = (float)(intersectionDistance / lineLength); // If time is outside the boundaries, return null. This algorithm can // return a negative time which indicates the previous intersection. if (time > 1.0f || time < 0.0f) { return null; } // Solve the intersection and normal float ix = time * dx + start.x; float iy = time * dy + start.y; float nx = (float)((ix - cornerX) * inverseRadius); float ny = (float)((iy - cornerY) * inverseRadius); return new Intersection( ix, iy, time, nx, ny );
List<RoadElement> RoadMap = new LinkedList<RoadElement>(); Road r1 = new Road(); Intersection i1 = new Intersection(); r1.setPrevious(i1); i1.setNorthernConnection(r1); ....
@Override public TupleExpr visit(ASTGraphIntersect node, Object data) throws VisitorException { TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null); TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null); return new Intersection(leftArg, rightArg); }
@Override public TupleExpr visit(ASTTupleIntersect node, Object data) throws VisitorException { TupleExpr leftArg = (TupleExpr)node.getLeftArg().jjtAccept(this, null); TupleExpr rightArg = (TupleExpr)node.getRightArg().jjtAccept(this, null); return new Intersection(leftArg, rightArg); }