| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10262,6 +10262,7 @@ public void sphereDetail(int ures, int vres) { | |||
| 10262 | 10262 | * | |
| 10263 | 10263 | * @webref shape:3d_primitives | |
| 10264 | 10264 | * @param r the radius of the sphere | |
| 10265 | + * @see PGraphics#sphereDetail(int) | ||
| 10265 | 10266 | */ | |
| 10266 | 10267 | public void sphere(float r) { | |
| 10267 | 10268 | if (recorder != null) recorder.sphere(r); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2372,6 +2372,7 @@ public void sphereDetail(int ures, int vres) { | |||
| 2372 | 2372 | * | |
| 2373 | 2373 | * @webref shape:3d_primitives | |
| 2374 | 2374 | * @param r the radius of the sphere | |
| 2375 | + * @see PGraphics#sphereDetail(int) | ||
| 2375 | 2376 | */ | |
| 2376 | 2377 | public void sphere(float r) { | |
| 2377 | 2378 | if ((sphereDetailU < 3) || (sphereDetailV < 2)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,28 +5,30 @@ | |||
| 5 | 5 | * Simple rendering of the Mandelbrot set. | |
| 6 | 6 | */ | |
| 7 | 7 | ||
| 8 | + | ||
| 8 | 9 | // Establish a range of values on the complex plane | |
| 9 | 10 | // A different range will allow us to "zoom" in or out on the fractal | |
| 10 | 11 | // float xmin = -1.5; float ymin = -.1; float wh = 0.15; | |
| 11 | - float xmin = -2.5; | ||
| 12 | - float ymin = -2; | ||
| 13 | - float wh = 4; | ||
| 12 | + float xmin = -3; | ||
| 13 | + float ymin = -1.25; | ||
| 14 | + float w = 5; | ||
| 15 | + float h = 2.5; | ||
| 14 | 16 | ||
| 15 | 17 | size(640, 360); | |
| 16 | 18 | noLoop(); | |
| 17 | 19 | background(255); | |
| 18 | 20 | ||
| 19 | - // Make sure we can write to the pixels[] array. | ||
| 21 | + // Make sure we can write to the pixels[] array. | ||
| 20 | 22 | // Only need to do this once since we don't do any other drawing. | |
| 21 | 23 | loadPixels(); | |
| 22 | 24 | ||
| 23 | 25 | // Maximum number of iterations for each point on the complex plane | |
| 24 | 26 | int maxiterations = 100; | |
| 25 | 27 | ||
| 26 | 28 | // x goes from xmin to xmax | |
| 27 | - float xmax = xmin + wh; | ||
| 29 | + float xmax = xmin + w; | ||
| 28 | 30 | // y goes from ymin to ymax | |
| 29 | - float ymax = ymin + wh; | ||
| 31 | + float ymax = ymin + h; | ||
| 30 | 32 | ||
| 31 | 33 | // Calculate amount we increment x,y for each pixel | |
| 32 | 34 | float dx = (xmax - xmin) / (width); | |
@@ -59,8 +61,8 @@ for (int j = 0; j < height; j++) { | |||
| 59 | 61 | // We color each pixel based on how long it takes to get to infinity | |
| 60 | 62 | // If we never got there, let's pick the color black | |
| 61 | 63 | if (n == maxiterations) { | |
| 62 | - pixels[i+j*width] = 0; | ||
| 63 | - } | ||
| 64 | + pixels[i+j*width] = color(0); | ||
| 65 | + } | ||
| 64 | 66 | else { | |
| 65 | 67 | // Gosh, we could make fancy colors here if we wanted | |
| 66 | 68 | pixels[i+j*width] = color(n*16 % 255); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | */ | |
| 6 | 6 | ||
| 7 | 7 | // Spring drawing constants for top bar | |
| 8 | - int springHeight = 16; // Height | ||
| 8 | + int springHeight = 32; // Height | ||
| 9 | 9 | int left; // Left position | |
| 10 | 10 | int right; // Right position | |
| 11 | 11 | int max = 200; // Maximum Y value | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,13 @@ | |||
| 31 | 31 | import java.net.*; | |
| 32 | 32 | ||
| 33 | 33 | /** | |
| 34 | - * @generate Client.xml | ||
| 34 | + * ( begin auto-generated from Client.xml ) | ||
| 35 | + * | ||
| 36 | + * A client connects to a server and sends data back and forth. If anything | ||
| 37 | + * goes wrong with the connection, for example the host is not there or is | ||
| 38 | + * listening on a different port, an exception is thrown. | ||
| 39 | + * | ||
| 40 | + * ( end auto-generated ) | ||
| 35 | 41 | * @webref net | |
| 36 | 42 | * @brief The client class is used to create client Objects which connect to a server to exchange data. | |
| 37 | 43 | * @instanceName client any variable of type Client | |
@@ -57,7 +63,6 @@ public class Client implements Runnable { | |||
| 57 | 63 | int bufferLast; | |
| 58 | 64 | ||
| 59 | 65 | /** | |
| 60 | - * | ||
| 61 | 66 | * @param parent typically use "this" | |
| 62 | 67 | * @param host address of the server | |
| 63 | 68 | * @param port port to read/write from on the server | |
@@ -122,7 +127,12 @@ public Client(PApplet parent, Socket socket) throws IOException { | |||
| 122 | 127 | ||
| 123 | 128 | ||
| 124 | 129 | /** | |
| 125 | - * @generate Client_stop.xml | ||
| 130 | + * ( begin auto-generated from Client_stop.xml ) | ||
| 131 | + * | ||
| 132 | + * Disconnects from the server. Use to shut the connection when you're | ||
| 133 | + * finished with the Client. | ||
| 134 | + * | ||
| 135 | + * ( end auto-generated ) | ||
| 126 | 136 | * @webref client:client | |
| 127 | 137 | * @brief Disconnects from the server | |
| 128 | 138 | * @usage application | |
@@ -219,7 +229,11 @@ public boolean active() { | |||
| 219 | 229 | ||
| 220 | 230 | ||
| 221 | 231 | /** | |
| 222 | - * @generate Client_ip.xml | ||
| 232 | + * ( begin auto-generated from Client_ip.xml ) | ||
| 233 | + * | ||
| 234 | + * Returns the IP address of the computer to which the Client is attached. | ||
| 235 | + * | ||
| 236 | + * ( end auto-generated ) | ||
| 223 | 237 | * @webref client:client | |
| 224 | 238 | * @usage application | |
| 225 | 239 | * @brief Returns the IP address of the machine as a String | |
@@ -230,7 +244,12 @@ public String ip() { | |||
| 230 | 244 | ||
| 231 | 245 | ||
| 232 | 246 | /** | |
| 233 | - * @generate Client_available.xml | ||
| 247 | + * ( begin auto-generated from Client_available.xml ) | ||
| 248 | + * | ||
| 249 | + * Returns the number of bytes available. When any client has bytes | ||
| 250 | + * available from the server, it returns the number of bytes. | ||
| 251 | + * | ||
| 252 | + * ( end auto-generated ) | ||
| 234 | 253 | * @webref client:client | |
| 235 | 254 | * @usage application | |
| 236 | 255 | * @brief Returns the number of bytes in the buffer waiting to be read | |
@@ -241,7 +260,11 @@ public int available() { | |||
| 241 | 260 | ||
| 242 | 261 | ||
| 243 | 262 | /** | |
| 244 | - * @generate Client_clear.xml | ||
| 263 | + * ( begin auto-generated from Client_clear.xml ) | ||
| 264 | + * | ||
| 265 | + * Empty the buffer, removes all the data stored there. | ||
| 266 | + * | ||
| 267 | + * ( end auto-generated ) | ||
| 245 | 268 | * @webref client:client | |
| 246 | 269 | * @usage application | |
| 247 | 270 | * @brief Clears the buffer | |
@@ -253,7 +276,13 @@ public void clear() { | |||
| 253 | 276 | ||
| 254 | 277 | ||
| 255 | 278 | /** | |
| 256 | - * @generate Client_read.xml | ||
| 279 | + * ( begin auto-generated from Client_read.xml ) | ||
| 280 | + * | ||
| 281 | + * Returns a number between 0 and 255 for the next byte that's waiting in | ||
| 282 | + * the buffer. Returns -1 if there is no byte, although this should be | ||
| 283 | + * avoided by first cheacking <b>available()</b> to see if any data is available. | ||
| 284 | + * | ||
| 285 | + * ( end auto-generated ) | ||
| 257 | 286 | * @webref client:client | |
| 258 | 287 | * @usage application | |
| 259 | 288 | * @brief Returns a value from the buffer | |
@@ -273,7 +302,12 @@ public int read() { | |||
| 273 | 302 | ||
| 274 | 303 | ||
| 275 | 304 | /** | |
| 276 | - * @generate Client_readChar.xml | ||
| 305 | + * ( begin auto-generated from Client_readChar.xml ) | ||
| 306 | + * | ||
| 307 | + * Returns the next byte in the buffer as a char. Returns -1 or 0xffff if | ||
| 308 | + * nothing is there. | ||
| 309 | + * | ||
| 310 | + * ( end auto-generated ) | ||
| 277 | 311 | * @webref client:client | |
| 278 | 312 | * @usage application | |
| 279 | 313 | * @brief Returns the next byte in the buffer as a char | |
@@ -285,7 +319,17 @@ public char readChar() { | |||
| 285 | 319 | ||
| 286 | 320 | ||
| 287 | 321 | /** | |
| 288 | - * @generate Client_readBytes.xml | ||
| 322 | + * ( begin auto-generated from Client_readBytes.xml ) | ||
| 323 | + * | ||
| 324 | + * Reads a group of bytes from the buffer. The version with no parameters | ||
| 325 | + * returns a byte array of all data in the buffer. This is not efficient, | ||
| 326 | + * but is easy to use. The version with the <b>byteBuffer</b> parameter is | ||
| 327 | + * more memory and time efficient. It grabs the data in the buffer and puts | ||
| 328 | + * it into the byte array passed in and returns an int value for the number | ||
| 329 | + * of bytes read. If more bytes are available than can fit into the | ||
| 330 | + * <b>byteBuffer</b>, only those that fit are read. | ||
| 331 | + * | ||
| 332 | + * ( end auto-generated ) | ||
| 289 | 333 | * <h3>Advanced</h3> | |
| 290 | 334 | * Return a byte array of anything that's in the serial buffer. | |
| 291 | 335 | * Not particularly memory/speed efficient, because it creates | |
@@ -342,7 +386,20 @@ public int readBytes(byte bytebuffer[]) { | |||
| 342 | 386 | ||
| 343 | 387 | ||
| 344 | 388 | /** | |
| 345 | - * @generate Client_readBytesUntil.xml | ||
| 389 | + * ( begin auto-generated from Client_readBytesUntil.xml ) | ||
| 390 | + * | ||
| 391 | + * Reads from the port into a buffer of bytes up to and including a | ||
| 392 | + * particular character. If the character isn't in the buffer, 'null' is | ||
| 393 | + * returned. The version with no <b>byteBuffer</b> parameter returns a byte | ||
| 394 | + * array of all data up to and including the <b>interesting</b> byte. This | ||
| 395 | + * is not efficient, but is easy to use. The version with the | ||
| 396 | + * <b>byteBuffer</b> parameter is more memory and time efficient. It grabs | ||
| 397 | + * the data in the buffer and puts it into the byte array passed in and | ||
| 398 | + * returns an int value for the number of bytes read. If the byte buffer is | ||
| 399 | + * not large enough, -1 is returned and an error is printed to the message | ||
| 400 | + * area. If nothing is in the buffer, 0 is returned. | ||
| 401 | + * | ||
| 402 | + * ( end auto-generated ) | ||
| 346 | 403 | * @webref client:client | |
| 347 | 404 | * @usage application | |
| 348 | 405 | * @brief Reads from the buffer of bytes up to and including a particular character | |
@@ -424,7 +481,15 @@ public int readBytesUntil(int interesting, byte byteBuffer[]) { | |||
| 424 | 481 | ||
| 425 | 482 | ||
| 426 | 483 | /** | |
| 427 | - * @generate Client_readString.xml | ||
| 484 | + * ( begin auto-generated from Client_readString.xml ) | ||
| 485 | + * | ||
| 486 | + * Returns the all the data from the buffer as a String. This method | ||
| 487 | + * assumes the incoming characters are ASCII. If you want to transfer | ||
| 488 | + * Unicode data, first convert the String to a byte stream in the | ||
| 489 | + * representation of your choice (i.e. UTF8 or two-byte Unicode data), and | ||
| 490 | + * send it as a byte array. | ||
| 491 | + * | ||
| 492 | + * ( end auto-generated ) | ||
| 428 | 493 | * @webref client:client | |
| 429 | 494 | * @usage application | |
| 430 | 495 | * @brief Returns the buffer as a String | |
@@ -436,7 +501,12 @@ public String readString() { | |||
| 436 | 501 | ||
| 437 | 502 | ||
| 438 | 503 | /** | |
| 439 | - * @generate Client_readStringUntil.xml | ||
| 504 | + * ( begin auto-generated from Client_readStringUntil.xml ) | ||
| 505 | + * | ||
| 506 | + * Combination of <b>readBytesUntil()</b> and <b>readString()</b>. Returns | ||
| 507 | + * <b>null</b> if it doesn't find what you're looking for. | ||
| 508 | + * | ||
| 509 | + * ( end auto-generated ) | ||
| 440 | 510 | * <h3>Advanced</h3> | |
| 441 | 511 | * <p/> | |
| 442 | 512 | * If you want to move Unicode data, you can first convert the | |
@@ -456,7 +526,11 @@ public String readStringUntil(int interesting) { | |||
| 456 | 526 | ||
| 457 | 527 | ||
| 458 | 528 | /** | |
| 459 | - * @generate Client_write.xml | ||
| 529 | + * ( begin auto-generated from Client_write.xml ) | ||
| 530 | + * | ||
| 531 | + * Writes data to a server specified when constructing the client. | ||
| 532 | + * | ||
| 533 | + * ( end auto-generated ) | ||
| 460 | 534 | * @webref client:client | |
| 461 | 535 | * @usage application | |
| 462 | 536 | * @brief Writes bytes, chars, ints, bytes[], Strings | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,16 @@ | |||
| 31 | 31 | import java.net.*; | |
| 32 | 32 | ||
| 33 | 33 | /** | |
| 34 | - * @generate Server.xml | ||
| 34 | + * ( begin auto-generated from Server.xml ) | ||
| 35 | + * | ||
| 36 | + * A server sends and receives data to and from its associated clients | ||
| 37 | + * (other programs connected to it). When a server is started, it begins | ||
| 38 | + * listening for connections on the port specified by the <b>port</b> | ||
| 39 | + * parameter. Computers have many ports for transferring data and some are | ||
| 40 | + * commonly used so be sure to not select one of these. For example, web | ||
| 41 | + * servers usually use port 80 and POP mail uses port 110. | ||
| 42 | + * | ||
| 43 | + * ( end auto-generated ) | ||
| 35 | 44 | * @webref net | |
| 36 | 45 | * @usage application | |
| 37 | 46 | * @brief The server class is used to create server objects which send and receives data to and from its associated clients (other programs connected to it). | |
@@ -52,7 +61,6 @@ public class Server implements Runnable { | |||
| 52 | 61 | public Client[] clients; | |
| 53 | 62 | ||
| 54 | 63 | /** | |
| 55 | - * | ||
| 56 | 64 | * @param parent typically use "this" | |
| 57 | 65 | * @param port port used to transfer data | |
| 58 | 66 | */ | |
@@ -91,7 +99,13 @@ public Server(PApplet parent, int port) { | |||
| 91 | 99 | ||
| 92 | 100 | ||
| 93 | 101 | /** | |
| 94 | - * @generate Server_disconnect.xml | ||
| 102 | + * ( begin auto-generated from Server_disconnect.xml ) | ||
| 103 | + * | ||
| 104 | + * Disconnect a particular client. | ||
| 105 | + * | ||
| 106 | + * ( end auto-generated ) | ||
| 107 | + * | ||
| 108 | + * ( end auto-generated ) | ||
| 95 | 109 | * @webref server:server | |
| 96 | 110 | * @param client the client to disconnect | |
| 97 | 111 | */ | |
@@ -140,7 +154,13 @@ protected int clientIndex(Client client) { | |||
| 140 | 154 | int lastAvailable = -1; | |
| 141 | 155 | ||
| 142 | 156 | /** | |
| 143 | - * @generate Server_available.xml | ||
| 157 | + * ( begin auto-generated from Server_available.xml ) | ||
| 158 | + * | ||
| 159 | + * Returns the next client in line with a new message. | ||
| 160 | + * | ||
| 161 | + * ( end auto-generated ) | ||
| 162 | + * | ||
| 163 | + * ( end auto-generated ) | ||
| 144 | 164 | * @webref server | |
| 145 | 165 | * @usage application | |
| 146 | 166 | */ | |
@@ -163,7 +183,12 @@ public Client available() { | |||
| 163 | 183 | ||
| 164 | 184 | ||
| 165 | 185 | /** | |
| 166 | - * @generate Server_stop.xml | ||
| 186 | + * ( begin auto-generated from Server_stop.xml ) | ||
| 187 | + * | ||
| 188 | + * Disconnects all clients and stops the server. | ||
| 189 | + * | ||
| 190 | + * ( end auto-generated ) | ||
| 191 | + * | ||
| 167 | 192 | * <h3>Advanced</h3> | |
| 168 | 193 | * <p/> | |
| 169 | 194 | * Use this to shut down the server if you finish using it while your applet | |
@@ -234,7 +259,13 @@ public void run() { | |||
| 234 | 259 | ||
| 235 | 260 | ||
| 236 | 261 | /** | |
| 237 | - * @generate Server_write.xml | ||
| 262 | + * ( begin auto-generated from Server_write.xml ) | ||
| 263 | + * | ||
| 264 | + * Writes a value to all the connected clients. It sends bytes out from the | ||
| 265 | + * Server object. | ||
| 266 | + * | ||
| 267 | + * ( end auto-generated ) | ||
| 268 | + * | ||
| 238 | 269 | * @webref server | |
| 239 | 270 | * @brief Writes data to all connected clients | |
| 240 | 271 | * @param data data to write | |
| Back | FazBrowse Home | New Git URL |
0 commit comments