001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.graph.old; 005 006 import graphlab.platform.lang.FromStringProvider; 007 import graphlab.platform.StaticUtils; 008 009 import java.awt.*; 010 import java.io.Serializable; 011 012 /** 013 * User: Azin Azadi,Rouzbeh Ebrahimi 014 */ 015 public class GShape implements Serializable, FromStringProvider<GShape> { 016 static { 017 StaticUtils.setFromStringProvider(GShape.class.getName(), new GShape("")); 018 } 019 020 /** 021 * 022 */ 023 private static final long serialVersionUID = -660213117046506019L; 024 025 @Override 026 public String toString() { 027 return name; 028 } 029 030 public GShape(String name) { 031 this.name = name; 032 } 033 034 public void draw(Graphics g, int x, int y, int shapeWidth, int shapeHeight) { 035 // GStroke s = vertexView.model.gets; 036 // ((Graphics2D) g).setStroke(s.stroke); 037 // s.paint(g, null); 038 // s.stroke. 039 // gg.setStroke(s.stroke); 040 ((Graphics2D) g).translate(x, y); 041 drawShape(this, g, shapeWidth, shapeHeight); 042 ((Graphics2D) g).translate(-x, -y); 043 } 044 045 public void fill(Graphics g, int x, int y, int shapeWidth, int shapeHeight) { 046 ((Graphics2D) g).translate(x, y); 047 fillShape(this, g, shapeWidth, shapeHeight); 048 ((Graphics2D) g).translate(-x, -y); 049 } 050 051 public String name; 052 public static GShape editor = new GShape(""); 053 public static GShape renderer = new GShape(""); 054 055 public static final GShape RECTANGLE = new GShape("Rectangle"); 056 public static final GShape OVAL = new GShape("Oval"); 057 public static final GShape ROUNDRECT = new GShape("Round Rectangle"); 058 public static final GShape STAR = new GShape("Star"); 059 public static final GShape SIXPOINTSTAR = new GShape("6 Point Star"); 060 public static final GShape SEVENPOINTSTAR = new GShape("7 Point Star"); 061 public static final GShape EIGHTPOINTSTAR = new GShape("8 Point Star"); 062 public static final GShape NINEPOINTSTAR = new GShape("9 Point Star"); 063 public static final GShape TENPOINTSTAR = new GShape("10 Point Star"); 064 public static final GShape LEFTWARDTTRIANGLE = new GShape("Leftward Triangle"); 065 public static final GShape RIGHTWARDTRIANGLE = new GShape("Rightward Triangle"); 066 public static final GShape UPWARDTRIANGLE = new GShape("Upward Triangle"); 067 public static final GShape DOWNWARDTRIANGLE = new GShape("Downward Triangle"); 068 public static final GShape REGULARHEXAGON = new GShape("Regular Hexagon"); 069 public static final GShape REGULARPENTAGON = new GShape("Regular Pentagon"); 070 public static final GShape DOWNWARDTRAPEZOID = new GShape("Downward Trapezoid"); 071 public static final GShape RIGHTWARDTRAPEZOID = new GShape("Rightward Trapezoid"); 072 public static final GShape UPWARDTRAPEZOID = new GShape("Upward Trapezoid"); 073 public static final GShape LEFTWARDTRAPEZOID = new GShape("Leftward Trapezoid"); 074 public static final GShape DOWNWARDPARALLELOGRAM = new GShape("Downward Parallelogram"); 075 public static final GShape UPWARDPARALLELOGRAM = new GShape("Upward Parallelogram"); 076 public static final GShape NICESTAR = new GShape("Nice Star"); 077 public static final GShape NICESIXPOINTSTAR = new GShape("6 Point Nice Star"); 078 public static final GShape NICESEVENPOINTSTAR = new GShape("7 Point Nice Star"); 079 public static final GShape NICEEIGHTPOINTSTAR = new GShape("8 Point Nice Star"); 080 public static final GShape NICENINEPOINTSTAR = new GShape("9 Point Nice Star"); 081 public static final GShape NICETENPOINTSTAR = new GShape("10 Point Nice Star"); 082 083 084 public static void drawShape(GShape shape, Graphics g, int w, int h) { 085 if (shape.equals(RECTANGLE)) { 086 g.drawRect(0, 0, w - 1, h - 1); 087 } else if (shape.equals(OVAL)) { 088 g.drawOval(0, 0, w - 1, h - 1); 089 } else if (shape.equals(ROUNDRECT)) { 090 g.drawRoundRect(0, 0, w - 1, h - 1, w / 2, h / 2); 091 } else if (shape.equals(LEFTWARDTTRIANGLE)) { 092 int[][] points = provideTrianglePoints(h, w, true); 093 g.drawPolygon(points[0], points[1], 3); 094 } else if (shape.equals(RIGHTWARDTRIANGLE)) { 095 int[][] points = provideTrianglePoints(h, w, false); 096 g.drawPolygon(points[0], points[1], 3); 097 } else if (shape.equals(UPWARDTRIANGLE)) { 098 int[][] points = provideTrianglePoints(h, w, true); 099 g.drawPolygon(points[1], points[0], 3); 100 } else if (shape.equals(DOWNWARDTRIANGLE)) { 101 int[][] points = provideTrianglePoints(h, w, false); 102 g.drawPolygon(points[1], points[0], 3); 103 } else if (shape.equals(DOWNWARDTRAPEZOID)) { 104 int[][] points = provideTrapezoidPoints(h, w, true); 105 g.drawPolygon(points[0], points[1], 4); 106 } else if (shape.equals(RIGHTWARDTRAPEZOID)) { 107 int[][] points = provideTrapezoidPoints(h, w, true); 108 g.drawPolygon(points[1], points[0], 4); 109 } else if (shape.equals(UPWARDTRAPEZOID)) { 110 int[][] points = provideTrapezoidPoints(h, w, false); 111 g.drawPolygon(points[0], points[1], 4); 112 } else if (shape.equals(LEFTWARDTRAPEZOID)) { 113 int[][] points = provideTrapezoidPoints(h, w, false); 114 g.drawPolygon(points[1], points[0], 4); 115 } else if (shape.equals(DOWNWARDPARALLELOGRAM)) { 116 int[][] points = provideParallelogramPoints(h, w, true); 117 g.drawPolygon(points[0], points[1], 4); 118 } else if (shape.equals(UPWARDPARALLELOGRAM)) { 119 int[][] points = provideParallelogramPoints(h, w, false); 120 g.drawPolygon(points[1], points[0], 4); 121 } else if (shape.equals(REGULARHEXAGON)) { 122 int[][] points = provideRegularPolygonPoints(h, w, 6); 123 g.drawPolygon(points[0], points[1], 6); 124 } else if (shape.equals(REGULARPENTAGON)) { 125 int[][] points = provideRegularPolygonPoints(h, w, 5); 126 g.drawPolygon(points[0], points[1], 5); 127 } else if (shape.equals(STAR)) { 128 int[][] points = provideStarPoints(h, w, 5); 129 g.drawPolygon(points[0], points[1], 10); 130 } else if (shape.equals(SIXPOINTSTAR)) { 131 int[][] points = provideStarPoints(h, w, 6); 132 g.drawPolygon(points[0], points[1], 12); 133 } else if (shape.equals(SEVENPOINTSTAR)) { 134 int[][] points = provideStarPoints(h, w, 7); 135 g.drawPolygon(points[0], points[1], 14); 136 } else if (shape.equals(EIGHTPOINTSTAR)) { 137 int[][] points = provideStarPoints(h, w, 8); 138 g.drawPolygon(points[0], points[1], 16); 139 } else if (shape.equals(NINEPOINTSTAR)) { 140 int[][] points = provideStarPoints(h, w, 9); 141 g.drawPolygon(points[0], points[1], 18); 142 } else if (shape.equals(TENPOINTSTAR)) { 143 int[][] points = provideStarPoints(h, w, 10); 144 g.drawPolygon(points[0], points[1], 20); 145 } else if (shape.equals(NICESTAR)) { 146 int[][] points = provideNiceStarPoints(h, w, 5); 147 g.drawPolygon(points[0], points[1], 10); 148 } else if (shape.equals(NICESIXPOINTSTAR)) { 149 int[][] points = provideNiceStarPoints(h, w, 6); 150 g.drawPolygon(points[0], points[1], 12); 151 } else if (shape.equals(NICESEVENPOINTSTAR)) { 152 int[][] points = provideNiceStarPoints(h, w, 7); 153 g.drawPolygon(points[0], points[1], 14); 154 } else if (shape.equals(NICEEIGHTPOINTSTAR)) { 155 int[][] points = provideNiceStarPoints(h, w, 8); 156 g.drawPolygon(points[0], points[1], 16); 157 } else if (shape.equals(NICENINEPOINTSTAR)) { 158 int[][] points = provideNiceStarPoints(h, w, 9); 159 g.drawPolygon(points[0], points[1], 18); 160 } else if (shape.equals(NICETENPOINTSTAR)) { 161 int[][] points = provideNiceStarPoints(h, w, 10); 162 g.drawPolygon(points[0], points[1], 20); 163 } 164 165 166 } 167 168 169 public static void fillShape(GShape shape, Graphics g, int w, int h) { 170 if (shape.equals(RECTANGLE)) { 171 g.fillRect(0, 0, w - 1, h - 1); 172 } 173 if (shape.equals(OVAL)) { 174 g.fillOval(0, 0, w - 1, h - 1); 175 } 176 if (shape.equals(ROUNDRECT)) { 177 g.fillRoundRect(0, 0, w - 1, h - 1, w / 2, h / 2); 178 } 179 if (shape.equals(LEFTWARDTTRIANGLE)) { 180 int[][] points = provideTrianglePoints(h, w, true); 181 g.fillPolygon(points[0], points[1], 3); 182 } 183 if (shape.equals(RIGHTWARDTRIANGLE)) { 184 int[][] points = provideTrianglePoints(h, w, false); 185 g.fillPolygon(points[0], points[1], 3); 186 } 187 if (shape.equals(UPWARDTRIANGLE)) { 188 int[][] points = provideTrianglePoints(h, w, true); 189 g.fillPolygon(points[1], points[0], 3); 190 } 191 if (shape.equals(DOWNWARDTRIANGLE)) { 192 int[][] points = provideTrianglePoints(h, w, false); 193 g.fillPolygon(points[1], points[0], 3); 194 } 195 if (shape.equals(RIGHTWARDTRAPEZOID)) { 196 int[][] points = provideTrapezoidPoints(h, w, true); 197 g.fillPolygon(points[1], points[0], 4); 198 } 199 if (shape.equals(DOWNWARDTRAPEZOID)) { 200 int[][] points = provideTrapezoidPoints(h, w, true); 201 g.fillPolygon(points[0], points[1], 4); 202 } 203 if (shape.equals(LEFTWARDTRAPEZOID)) { 204 int[][] points = provideTrapezoidPoints(h, w, false); 205 g.fillPolygon(points[1], points[0], 4); 206 } 207 if (shape.equals(UPWARDTRAPEZOID)) { 208 int[][] points = provideTrapezoidPoints(h, w, false); 209 g.fillPolygon(points[0], points[1], 4); 210 } 211 if (shape.equals(DOWNWARDPARALLELOGRAM)) { 212 int[][] points = provideParallelogramPoints(h, w, true); 213 g.fillPolygon(points[0], points[1], 4); 214 } 215 216 if (shape.equals(UPWARDPARALLELOGRAM)) { 217 int[][] points = provideParallelogramPoints(h, w, false); 218 g.fillPolygon(points[1], points[0], 4); 219 } 220 if (shape.equals(REGULARHEXAGON)) { 221 int[][] points = provideRegularPolygonPoints(h, w, 6); 222 g.fillPolygon(points[0], points[1], 6); 223 } 224 if (shape.equals(REGULARPENTAGON)) { 225 int[][] points = provideRegularPolygonPoints(h, w, 5); 226 g.fillPolygon(points[0], points[1], 5); 227 } 228 if (shape.equals(STAR)) { 229 int[][] points = provideStarPoints(h, w, 5); 230 g.fillPolygon(points[0], points[1], 10); 231 } 232 if (shape.equals(SIXPOINTSTAR)) { 233 int[][] points = provideStarPoints(h, w, 6); 234 g.fillPolygon(points[0], points[1], 12); 235 } 236 if (shape.equals(SEVENPOINTSTAR)) { 237 int[][] points = provideStarPoints(h, w, 7); 238 g.fillPolygon(points[0], points[1], 14); 239 } 240 if (shape.equals(EIGHTPOINTSTAR)) { 241 int[][] points = provideStarPoints(h, w, 8); 242 g.fillPolygon(points[0], points[1], 16); 243 } 244 if (shape.equals(NINEPOINTSTAR)) { 245 int[][] points = provideStarPoints(h, w, 9); 246 g.fillPolygon(points[0], points[1], 18); 247 } 248 if (shape.equals(TENPOINTSTAR)) { 249 int[][] points = provideStarPoints(h, w, 10); 250 g.fillPolygon(points[0], points[1], 20); 251 } 252 if (shape.equals(NICESTAR)) { 253 int[][] points = provideNiceStarPoints(h, w, 5); 254 g.fillPolygon(points[0], points[1], 10); 255 } 256 if (shape.equals(NICESIXPOINTSTAR)) { 257 int[][] points = provideNiceStarPoints(h, w, 6); 258 g.fillPolygon(points[0], points[1], 12); 259 } 260 if (shape.equals(NICESEVENPOINTSTAR)) { 261 int[][] points = provideNiceStarPoints(h, w, 7); 262 g.fillPolygon(points[0], points[1], 14); 263 } 264 if (shape.equals(NICEEIGHTPOINTSTAR)) { 265 int[][] points = provideNiceStarPoints(h, w, 8); 266 g.fillPolygon(points[0], points[1], 16); 267 } 268 if (shape.equals(NICENINEPOINTSTAR)) { 269 int[][] points = provideNiceStarPoints(h, w, 9); 270 g.fillPolygon(points[0], points[1], 18); 271 } 272 if (shape.equals(NICETENPOINTSTAR)) { 273 int[][] points = provideNiceStarPoints(h, w, 10); 274 g.fillPolygon(points[0], points[1], 20); 275 } 276 277 278 } 279 280 public GShape fromString(String data) { 281 if (data.equals(RECTANGLE.name)) 282 return RECTANGLE; 283 if (data.equals(OVAL.name)) 284 return OVAL; 285 if (data.equals(ROUNDRECT.name)) 286 return ROUNDRECT; 287 if (data.equals(LEFTWARDTTRIANGLE.name)) 288 return LEFTWARDTTRIANGLE; 289 if (data.equals(UPWARDTRIANGLE.name)) 290 return UPWARDTRIANGLE; 291 if (data.equals(DOWNWARDTRAPEZOID.name)) 292 return DOWNWARDTRAPEZOID; 293 if (data.equals(RIGHTWARDTRAPEZOID.name)) 294 return RIGHTWARDTRAPEZOID; 295 if (data.equals(REGULARHEXAGON.name)) 296 return REGULARHEXAGON; 297 if (data.equals(REGULARPENTAGON.name)) 298 return REGULARPENTAGON; 299 if (data.equals(STAR.name)) 300 return STAR; 301 if (data.equals(NICESTAR.name)) 302 return NICESTAR; 303 if (data.equals(RIGHTWARDTRIANGLE.name)) 304 return RIGHTWARDTRIANGLE; 305 if (data.equals(DOWNWARDTRIANGLE.name)) 306 return DOWNWARDTRIANGLE; 307 if (data.equals(DOWNWARDPARALLELOGRAM.name)) 308 return DOWNWARDPARALLELOGRAM; 309 if (data.equals(UPWARDPARALLELOGRAM.name)) 310 return UPWARDPARALLELOGRAM; 311 if (data.equals(SIXPOINTSTAR.name)) 312 return SIXPOINTSTAR; 313 if (data.equals(SEVENPOINTSTAR.name)) 314 return SEVENPOINTSTAR; 315 if (data.equals(EIGHTPOINTSTAR.name)) 316 return EIGHTPOINTSTAR; 317 if (data.equals(NINEPOINTSTAR.name)) 318 return NINEPOINTSTAR; 319 if (data.equals(TENPOINTSTAR.name)) 320 return TENPOINTSTAR; 321 if (data.equals(NICESIXPOINTSTAR.name)) 322 return NICESIXPOINTSTAR; 323 if (data.equals(NICESEVENPOINTSTAR.name)) 324 return NICESEVENPOINTSTAR; 325 if (data.equals(NICEEIGHTPOINTSTAR.name)) 326 return NICEEIGHTPOINTSTAR; 327 if (data.equals(NICENINEPOINTSTAR.name)) 328 return NICENINEPOINTSTAR; 329 if (data.equals(NICETENPOINTSTAR.name)) 330 return NICETENPOINTSTAR; 331 332 333 System.out.println("this shape isn't a member of default shapes :" + data); 334 return ROUNDRECT; 335 } 336 337 private static int[][] provideTrapezoidPoints(int h, int w, boolean t) { 338 // h = h < w ? h : w; 339 if (t) { 340 int[] xPoints = new int[]{(w - 1) * 2 / 3, (w - 1) * 1 / 3, 0, (w - 1)}; 341 int[] yPoints = new int[]{h - 1, h - 1, 0, 0}; 342 int[][] points = new int[][]{xPoints, yPoints}; 343 return points; 344 } else { 345 int[] xPoints = new int[]{(w - 1) * 2 / 3, (w - 1) * 1 / 3, 0, (w - 1)}; 346 int[] yPoints = new int[]{0, 0, h - 1, h - 1}; 347 int[][] points = new int[][]{xPoints, yPoints}; 348 return points; 349 } 350 } 351 352 private static int[][] provideParallelogramPoints(int h, int w, boolean t) { 353 // h = h < w ? h : w; 354 if (t) { 355 int[] xPoints = new int[]{(w - 1), (w - 1) * 1 / 2, 0, (w - 1) / 2}; 356 int[] yPoints = new int[]{(h - 1) * 3 / 4, (h - 1) * 3 / 4, (h - 1) * 1 / 4, (h - 1) * 1 / 4}; 357 int[][] points = new int[][]{xPoints, yPoints}; 358 return points; 359 } else { 360 int[] xPoints = new int[]{(w - 1), (w - 1) * 1 / 2, 0, (w - 1) / 2}; 361 int[] yPoints = new int[]{(h - 1) * 1 / 4, (h - 1) * 1 / 4, (h - 1) * 3 / 4, (h - 1) * 3 / 4}; 362 int[][] points = new int[][]{xPoints, yPoints}; 363 return points; 364 } 365 } 366 367 private static int[][] provideRegularPolygonPoints(int h, int w, int n) { 368 int[] xPoints = new int[n]; 369 int[] yPoints = new int[n]; 370 h = h < w ? h : w; 371 for (int i = 0; i != n; i++) { 372 if (n % 2 == 0) { 373 374 xPoints[i] = (int) (((h - 1) / 2) * Math.cos((i) * Math.PI * 2 / n) + (h - 1) / 2); 375 yPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * Math.PI * 2 / n) + (h - 1) / 2); 376 377 } else { 378 379 xPoints[i] = (int) (((h - 1) / 2) * Math.cos((i) * (Math.PI * 2) / n + Math.PI / 2) + (h - 1) / 2); 380 yPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * (Math.PI * 2) / n + Math.PI / 2) + (h - 1) / 2); 381 382 } 383 } 384 return new int[][]{xPoints, yPoints}; 385 } 386 387 private static int[][] provideStarPoints(int h, int w, int n) { 388 int[] xOuterPoints = new int[n]; 389 int[] xInnerPoints = new int[n]; 390 int[] yOuterPoints = new int[n]; 391 int[] yInnerPoints = new int[n]; 392 int[] xPoints = new int[2 * n]; 393 int[] yPoints = new int[2 * n]; 394 // h = h < w ? h : w; 395 for (int i = 0; i != n; i++) { 396 if (n % 2 == 0) { 397 xInnerPoints[i] = (int) (((w - 1) / 5) * Math.cos((i) * (Math.PI * 2) / n + (n - 1) * Math.PI / n) + (w - 1) / 2); 398 xOuterPoints[i] = (int) (((w - 1) / 2) * Math.cos((i) * (Math.PI * 2) / n) + (w - 1) / 2); 399 yInnerPoints[i] = (int) (((h - 1) / 5) * Math.sin((i) * (Math.PI * 2) / n + (n - 1) * Math.PI / n) + (h - 1) / 2); 400 yOuterPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * (Math.PI * 2) / n) + (h - 1) / 2); 401 } else { 402 xInnerPoints[i] = (int) (((w - 1) / 5) * Math.cos((i) * (Math.PI * 2) / n + Math.PI / 2) + (w - 1) / 2); 403 xOuterPoints[i] = (int) (((w - 1) / 2) * Math.cos((i) * (Math.PI * 2) / n - Math.PI / 2) + (w - 1) / 2); 404 yInnerPoints[i] = (int) (((h - 1) / 5) * Math.sin((i) * (Math.PI * 2) / n + Math.PI / 2) + (h - 1) / 2); 405 yOuterPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * (Math.PI * 2) / n - Math.PI / 2) + (h - 1) / 2); 406 } 407 408 } 409 dc(n, xOuterPoints, xPoints, xInnerPoints, yOuterPoints, yPoints, yInnerPoints); 410 return new int[][]{xPoints, yPoints}; 411 } 412 413 private static void dc(int n, int[] xOuterPoints, int[] xPoints, int[] xInnerPoints, int[] yOuterPoints, int[] yPoints, int[] yInnerPoints) { 414 for (int i = 0; i != n; i++) { 415 int y = i + n / 2 + 1; 416 y = y >= n ? y - n : y; 417 xPoints[2 * i] = xOuterPoints[i]; 418 xPoints[2 * i + 1] = xInnerPoints[y]; 419 yPoints[2 * i] = yOuterPoints[i]; 420 yPoints[2 * i + 1] = yInnerPoints[y]; 421 } 422 } 423 424 private static int[][] provideNiceStarPoints(int h, int w, int n) { 425 int[] xOuterPoints = new int[n]; 426 int[] xInnerPoints = new int[n]; 427 int[] yOuterPoints = new int[n]; 428 int[] yInnerPoints = new int[n]; 429 int[] xPoints = new int[2 * n]; 430 int[] yPoints = new int[2 * n]; 431 // h = h < w ? h : w; 432 for (int i = 0; i != n; i++) { 433 // if (n % 2 == 0) { 434 xInnerPoints[i] = (int) (((w - 1) / 5) * Math.cos((i) * (Math.PI * 2) / n) + (w - 1) / 2); 435 xOuterPoints[i] = (int) (((w - 1) / 2) * Math.cos((i) * (Math.PI * 2) / n) + (w - 1) / 2); 436 yInnerPoints[i] = (int) (((h - 1) / 5) * Math.sin((i) * (Math.PI * 2) / n) + (h - 1) / 2); 437 yOuterPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * (Math.PI * 2) / n) + (h - 1) / 2); 438 // } else { 439 // xInnerPoints[i] = (int) (((h - 1) / 5) * Math.cos((i) * (Math.PI * 2) / n ) + (h - 1) / 2); 440 // xOuterPoints[i] = (int) (((h - 1) / 2) * Math.cos((i) * (Math.PI * 2) / n ) + (h - 1) / 2); 441 // yInnerPoints[i] = (int) (((h - 1) / 5) * Math.sin((i) * (Math.PI * 2) / n) + (h - 1) / 2); 442 // yOuterPoints[i] = (int) (((h - 1) / 2) * Math.sin((i) * (Math.PI * 2) / n ) + (h - 1) / 2); 443 // } 444 445 } 446 dc(n, xOuterPoints, xPoints, xInnerPoints, yOuterPoints, yPoints, yInnerPoints); 447 return new int[][]{xPoints, yPoints}; 448 } 449 450 private static int[][] provideTrianglePoints(int h, int w, boolean t) { 451 // h = h < w ? h : w; 452 if (t) { 453 int[] xPoints = new int[]{0, w - 1, w - 1}; 454 int[] yPoints = new int[]{(h - 1) / 2, 0, h - 1}; 455 int[][] points = new int[][]{xPoints, yPoints}; 456 return points; 457 } else { 458 int[] xPoints = new int[]{w - 1, 0, 0}; 459 int[] yPoints = new int[]{(h - 1) / 2, 0, h - 1}; 460 int[][] points = new int[][]{xPoints, yPoints}; 461 return points; 462 } 463 464 } 465 }