Compare commits
1 Commits
e78f399c0f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bd767ea16 |
@@ -283,8 +283,8 @@ public class GeomUtils {
|
|||||||
* Funkcja bada zawieranie się punktu w ramach wielokąta.
|
* Funkcja bada zawieranie się punktu w ramach wielokąta.
|
||||||
*
|
*
|
||||||
* @param polygon współrzędne wierzchołków wielokąta
|
* @param polygon współrzędne wierzchołków wielokąta
|
||||||
* @param x współrzedna x badanego punktu
|
* @param x współrzedna x badanego punktu
|
||||||
* @param y współrzedna y badanego punktu
|
* @param y współrzedna y badanego punktu
|
||||||
* @return true, jeśli testowany punkt należy do wielokąta
|
* @return true, jeśli testowany punkt należy do wielokąta
|
||||||
*/
|
*/
|
||||||
public static boolean insidePolygon(Coord.Grid[] polygon, int x, int y) {
|
public static boolean insidePolygon(Coord.Grid[] polygon, int x, int y) {
|
||||||
@@ -859,7 +859,9 @@ public class GeomUtils {
|
|||||||
int mid = vertices.length / 2;
|
int mid = vertices.length / 2;
|
||||||
int last = vertices.length - 1;
|
int last = vertices.length - 1;
|
||||||
for (int i = 0; i < mid; i++) {
|
for (int i = 0; i < mid; i++) {
|
||||||
|
Coord.Grid swap = vertices[i];
|
||||||
vertices[i] = vertices[last - i];
|
vertices[i] = vertices[last - i];
|
||||||
|
vertices[last - i] = swap;
|
||||||
}
|
}
|
||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
@@ -871,8 +873,7 @@ public class GeomUtils {
|
|||||||
public static Coord.Grid srodekOdcinka(int x1, int y1, int x2, int y2) {
|
public static Coord.Grid srodekOdcinka(int x1, int y1, int x2, int y2) {
|
||||||
int xsr = (x1 + x2) / 2;
|
int xsr = (x1 + x2) / 2;
|
||||||
int ysr = (y1 + y2) / 2;
|
int ysr = (y1 + y2) / 2;
|
||||||
Coord.Grid srodek = new Coord.Grid(xsr, ysr);
|
return new Coord.Grid(xsr, ysr);
|
||||||
return srodek;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -916,6 +917,9 @@ public class GeomUtils {
|
|||||||
// =====================================================================
|
// =====================================================================
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Coord.Grid[] tab = {new Coord.Grid(0, 0), new Coord.Grid(1, 1), new Coord.Grid(2, 2), new Coord.Grid(4, 4), new Coord.Grid(5, 5)};
|
||||||
|
|
||||||
|
tab = reverse(tab);
|
||||||
int se = sector(0, 0);
|
int se = sector(0, 0);
|
||||||
int sek = sector(0, 9);
|
int sek = sector(0, 9);
|
||||||
sek = sector(2, 6);
|
sek = sector(2, 6);
|
||||||
|
|||||||
Reference in New Issue
Block a user