i have a PVector array and i want to find collinear points by using the Comparator interface. In detail, i want to find their slopes and then sort the array by their slopes
i can sort the array by its x or y values but i cannot sort it by a relationship between point A and Point B. I have a class that uses a PVector internally
public class P {
private PVector point;
public final Comparator <P>BY_SLOPE_ORDER=new BySlope();
hi
i am trying to reproduce the map from this
thread in 2D. I got just the boundary points (not the landmass) from the dataset that is mentioned at the end of the post. i draw the map and then i choose countries to see how the polygon is drawn. So polygons with no holes are correctly drawn,
i have read the thread 100 times i have also tried the code that toxi posted(with voronoi & delaunay triang.) but with similar results. (i am not posting them now so an not to make this post huge, of course i will if someone comes in)
obviously i am missing something, but how do we fix this?
anyone can help me understand? where do i go from here?
i get the names correctly by removing duplicates due to Set`s functionality, but (obviously) it assigns *all* the points to each country and i end up with a file of 20.000(lines)x20(countries)..
how can i assign the coordinates correctly to each country? i.e to take an ArrayList of PVectors for each country that it`s size is equal to the number of times this country appears in the first column?
i tried a couple of ifs by matching Strings but had no luck and i cannot figure out something else to try
hi i have written a function to get the arraylist`s index values that contain the number occurrences of each state.The csv file is 24499 rows and 3 columns
the strange thing is that i get the number of occurrences correct for all states but the index values are correct *only* for two states (i get no values (a blank [] ) for the rest of the states)...anyone has an idea why this might be happening?
its the first time i use collections etc, is this the correct way to do something like this?...what i want to do (if it helps) is get the index values,store them in an array and then for these values draw some points with csv[indexValues][1] and csv[indexValues][2]
last thing: is it possible to write functions like
Arraylist something(){
//blabla
} return somethingElse;
hi, (newbie here and first attempt on maps)
i have a data set (36900x2) with a country`s coordinates (floats) that i produced in R with some shapefiles. I then took the coordinates and imported them (as csv) in processing to draw the map. When i draw the map with points(x,y) i get a
fairly good result but when i try to use vertex i get
this.
i tried to use the java polygon class but it is only for integers, is there a way to draw the map with polygon class and float coordinates?
or can you suggest an another way to do this
thanks
hi, newbie here so i guess it is a simple question.
i loaded a tab delimited csv file (panel) in a 2d array and i want to find the max value of the second column (actually of columns but that is step 2). As i have understood, max() takes only the name of the array so i create an float array (toFind) in order to find it but it does not work...
here is what i have done
String [] data;
String [][] csv;
float c;
void setup(){
size(100,100);
data=loadStrings("crime.txt");
csv=new String [data.length][9];
for (int i=0; i<data.length; i++){
String [] temp=new String [data.length];
temp=split(data[i], "\t");
for (int j=0; j<9; j++){
csv[i][j]=temp[j];
}
}
for (int i=1; i<data.length; i++){
float [] toFind=new float [data.length];
toFind[i]=Float.parseFloat(csv[i][1]);
c=max(toFind);
print(c);
}
}
the strange thing is when i use max() it prints the values of the column 1, whereas when i use min() i prints only zeros...