Points accumulating at the top
in
Programming Questions
•
7 months ago
I am using Processing core libraries for java to plot points given in a text file. The number of points usually range from 200-300. The issue is the points are plotted at the top of the sketch, instead of getting plotted at the top.
which looks like this
The sketch is
private ArrayList<PointXY> pointsList;//private File pointsFile; BoundingBox box;TraceGroup tg;public void setup(){ size(50, 50);strokeWeight(3);//noSmooth(); background(255);if (frame != null) { frame.setResizable(true); }selectInput("Select a file to Process", "fileSelected");}public void draw(){if(tg != null){for(Trace t : tg.getTraceList())//loop iterates though all the pointsfor(PointXY p : t.getTracePoints()){System.out.println(p.getX() + " " + p.getY());point(p.getX(), getY());}}}//callback- filechooserpublic void fileSelected(File file){ pointsList = PenFileReader.readPointsFromFile(file);System.out.print(pointsList.size());//resizeFrameForCharDisplay() takes care of resizing the sketch window//according to the points read. uses bounding bounding box of the points//to resize the window.tg = resizeFrameForCharDisplay(pointsList);}
The println statement produces the following output:
552.0 221.0552.0 209.0552.0 199.0552.0 187.0552.0 171.0552.0 162.0555.0 156.0555.0 146.0555.0 143.0555.0 137.0555.0 134.0555.0 134.0558.0 134.0558.0 131.0561.0 131.0564.0 131.0570.0 137.0573.0 146.0579.0 168.0582.0 190.0582.0 215.0582.0 249.0582.0 287.0582.0 330.0582.0 371.0582.0 414.0582.0 452.0582.0 489.0585.0 517.0588.0 542.0588.0 561.0588.0 576.0588.0 586.0588.0 595.0
What I know for sure is the resizing of the sketch window takes place correctly and the points are read correctly.
Note: I am using eclipse to write the sketch, not PDE
1
