This commit is contained in:
codeanticode
2014-06-05 17:13:14 -04:00
4 changed files with 125 additions and 49 deletions

View File

@@ -151,7 +151,7 @@
</condition>
<!-- Set the version of Java that must be present to build. -->
<property name="jdk.update.macosx" value="55" />
<property name="jdk.update.macosx" value="60" />
<property name="jdk.path.macosx" value="/Library/Java/JavaVirtualMachines/jdk1.7.0_${jdk.update.macosx}.jdk" />
<available file="${jdk.path.macosx}" property="macosx_jdk_found" />
@@ -679,7 +679,7 @@
<delete dir="linux/jre1.7.0_40" />
<!-- Remove unused JRE bloat. -->
<delete>
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-linux-${sun.arch.data.model}" />
<fileset refid="jre-optional-linux" />
@@ -832,7 +832,7 @@
<move file="windows/work/jre1.7.0_40" tofile="windows/work/java" />
<!-- Remove space-wasting JavaFX garbage. -->
<delete>
<delete failonerror="true">
<fileset refid="javafx-basics" />
<fileset refid="javafx-windows" />
<fileset refid="jre-optional-windows" />

View File

@@ -119,6 +119,7 @@ public class PVector implements Serializable {
/** Array so that this can be temporarily used in an array context */
transient protected float[] array;
/**
* Constructor for an empty vector: x, y, and z are set to 0.
*/
@@ -149,6 +150,7 @@ public class PVector implements Serializable {
this.z = 0;
}
/**
* ( begin auto-generated from PVector_set.xml )
*
@@ -163,28 +165,33 @@ public class PVector implements Serializable {
* @param z the z component of the vector
* @brief Set the components of the vector
*/
public void set(float x, float y, float z) {
public PVector set(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
/**
* @param x the x component of the vector
* @param y the y component of the vector
*/
public void set(float x, float y) {
public PVector set(float x, float y) {
this.x = x;
this.y = y;
return this;
}
/**
* @param v any variable of type PVector
*/
public void set(PVector v) {
public PVector set(PVector v) {
x = v.x;
y = v.y;
z = v.z;
return this;
}
@@ -192,7 +199,7 @@ public class PVector implements Serializable {
* Set the x, y (and maybe z) coordinates using a float[] array as the source.
* @param source array to copy from
*/
public void set(float[] source) {
public PVector set(float[] source) {
if (source.length >= 2) {
x = source[0];
y = source[1];
@@ -200,6 +207,7 @@ public class PVector implements Serializable {
if (source.length >= 3) {
z = source[2];
}
return this;
}
@@ -217,9 +225,10 @@ public class PVector implements Serializable {
* @see PVector#random3D()
*/
static public PVector random2D() {
return random2D(null,null);
return random2D(null, null);
}
/**
* Make a new 2D unit vector with a random direction
* using Processing's current random number generator
@@ -227,7 +236,7 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random2D(PApplet parent) {
return random2D(null,parent);
return random2D(null, parent);
}
/**
@@ -236,18 +245,23 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random2D(PVector target) {
return random2D(target,null);
return random2D(target, null);
}
/**
* Make a new 2D unit vector with a random direction
* Make a new 2D unit vector with a random direction. Pass in the parent
* PApplet if you want randomSeed() to work (and be predictable). Or leave
* it null and be... random.
* @return the random PVector
*/
static public PVector random2D(PVector target, PApplet parent) {
if (parent == null) return fromAngle((float)(Math.random()*Math.PI*2),target);
else return fromAngle(parent.random(PConstants.TWO_PI),target);
return (parent == null) ?
fromAngle((float) (Math.random() * Math.PI*2), target) :
fromAngle(parent.random(PConstants.TAU), target);
}
/**
* ( begin auto-generated from PVector_random3D.xml )
*
@@ -262,9 +276,10 @@ public class PVector implements Serializable {
* @see PVector#random2D()
*/
static public PVector random3D() {
return random3D(null,null);
return random3D(null, null);
}
/**
* Make a new 3D unit vector with a random direction
* using Processing's current random number generator
@@ -272,18 +287,20 @@ public class PVector implements Serializable {
* @return the random PVector
*/
static public PVector random3D(PApplet parent) {
return random3D(null,parent);
return random3D(null, parent);
}
/**
* Set a 3D vector to a random unit vector with a random direction
* @param target the target vector (if null, a new vector will be created)
* @return the random PVector
*/
static public PVector random3D(PVector target) {
return random3D(target,null);
return random3D(target, null);
}
/**
* Make a new 3D unit vector with a random direction
* @return the random PVector
@@ -309,6 +326,7 @@ public class PVector implements Serializable {
return target;
}
/**
* ( begin auto-generated from PVector_sub.xml )
*
@@ -342,6 +360,12 @@ public class PVector implements Serializable {
return target;
}
public PVector copy() {
return new PVector(x, y, z);
}
/**
* ( begin auto-generated from PVector_get.xml )
*
@@ -353,10 +377,12 @@ public class PVector implements Serializable {
* @usage web_application
* @brief Get a copy of the vector
*/
@Deprecated
public PVector get() {
return new PVector(x, y, z);
return copy();
}
/**
* @param target
*/
@@ -393,6 +419,7 @@ public class PVector implements Serializable {
return (float) Math.sqrt(x*x + y*y + z*z);
}
/**
* ( begin auto-generated from PVector_mag.xml )
*
@@ -413,6 +440,7 @@ public class PVector implements Serializable {
return (x*x + y*y + z*z);
}
/**
* ( begin auto-generated from PVector_add.xml )
*
@@ -429,21 +457,24 @@ public class PVector implements Serializable {
* @param v the vector to be added
* @brief Adds x, y, and z components to a vector, one vector to another, or two independent vectors
*/
public void add(PVector v) {
public PVector add(PVector v) {
x += v.x;
y += v.y;
z += v.z;
return this;
}
/**
* @param x x component of the vector
* @param y y component of the vector
* @param z z component of the vector
*/
public void add(float x, float y, float z) {
public PVector add(float x, float y, float z) {
this.x += x;
this.y += y;
this.z += z;
return this;
}
@@ -487,21 +518,24 @@ public class PVector implements Serializable {
* @param v any variable of type PVector
* @brief Subtract x, y, and z components from a vector, one vector from another, or two independent vectors
*/
public void sub(PVector v) {
public PVector sub(PVector v) {
x -= v.x;
y -= v.y;
z -= v.z;
return this;
}
/**
* @param x the x component of the vector
* @param y the y component of the vector
* @param z the z component of the vector
*/
public void sub(float x, float y, float z) {
public PVector sub(float x, float y, float z) {
this.x -= x;
this.y -= y;
this.z -= z;
return this;
}
@@ -542,10 +576,11 @@ public class PVector implements Serializable {
* @brief Multiply a vector by a scalar
* @param n the number to multiply with the vector
*/
public void mult(float n) {
public PVector mult(float n) {
x *= n;
y *= n;
z *= n;
return this;
}
@@ -571,7 +606,6 @@ public class PVector implements Serializable {
}
/**
* ( begin auto-generated from PVector_div.xml )
*
@@ -584,10 +618,11 @@ public class PVector implements Serializable {
* @brief Divide a vector by a scalar
* @param n the number by which to divide the vector
*/
public void div(float n) {
public PVector div(float n) {
x /= n;
y /= n;
z /= n;
return this;
}
@@ -600,6 +635,7 @@ public class PVector implements Serializable {
return div(v, n, null);
}
/**
* Divide a vector by a scalar and store the result in another vector.
* @param target PVector in which to store the result
@@ -665,6 +701,7 @@ public class PVector implements Serializable {
return x*v.x + y*v.y + z*v.z;
}
/**
* @param x x component of the vector
* @param y y component of the vector
@@ -674,6 +711,7 @@ public class PVector implements Serializable {
return this.x*x + this.y*y + this.z*z;
}
/**
* @param v1 any variable of type PVector
* @param v2 any variable of type PVector
@@ -717,6 +755,7 @@ public class PVector implements Serializable {
return target;
}
/**
* @param v1 any variable of type PVector
* @param v2 any variable of type PVector
@@ -747,11 +786,12 @@ public class PVector implements Serializable {
* @usage web_application
* @brief Normalize the vector to a length of 1
*/
public void normalize() {
public PVector normalize() {
float m = mag();
if (m != 0 && m != 1) {
div(m);
}
return this;
}
@@ -785,13 +825,15 @@ public class PVector implements Serializable {
* @param max the maximum magnitude for the vector
* @brief Limit the magnitude of the vector
*/
public void limit(float max) {
public PVector limit(float max) {
if (magSq() > max*max) {
normalize();
mult(max);
}
return this;
}
/**
* ( begin auto-generated from PVector_setMag.xml )
*
@@ -804,11 +846,13 @@ public class PVector implements Serializable {
* @param len the new length for this vector
* @brief Set the magnitude of the vector
*/
public void setMag(float len) {
public PVector setMag(float len) {
normalize();
mult(len);
return this;
}
/**
* Sets the magnitude of this vector, storing the result in another vector.
* @param target Set to null to create a new vector
@@ -821,6 +865,7 @@ public class PVector implements Serializable {
return target;
}
/**
* ( begin auto-generated from PVector_setMag.xml )
*
@@ -857,11 +902,12 @@ public class PVector implements Serializable {
* @brief Rotate the vector by an angle (2D only)
* @param theta the angle of rotation
*/
public void rotate(float theta) {
float xTemp = x;
public PVector rotate(float theta) {
float temp = x;
// Might need to check for rounding errors like with angleBetween function?
x = x*PApplet.cos(theta) - y*PApplet.sin(theta);
y = xTemp*PApplet.sin(theta) + y*PApplet.cos(theta);
y = temp*PApplet.sin(theta) + y*PApplet.cos(theta);
return this;
}
@@ -879,35 +925,40 @@ public class PVector implements Serializable {
* @param amt The amount of interpolation; some value between 0.0 (old vector) and 1.0 (new vector). 0.1 is very near the new vector. 0.5 is halfway in between.
* @see PApplet#lerp(float, float, float)
*/
public void lerp(PVector v, float amt) {
x = PApplet.lerp(x,v.x,amt);
y = PApplet.lerp(y,v.y,amt);
z = PApplet.lerp(z,v.z,amt);
public PVector lerp(PVector v, float amt) {
x = PApplet.lerp(x, v.x, amt);
y = PApplet.lerp(y, v.y, amt);
z = PApplet.lerp(z, v.z, amt);
return this;
}
/**
* Linear interpolate between two vectors (returns a new PVector object)
* @param v1 the vector to start from
* @param v2 the vector to lerp to
*/
public static PVector lerp(PVector v1, PVector v2, float amt) {
PVector v = v1.get();
PVector v = v1.copy();
v.lerp(v2, amt);
return v;
}
/**
* Linear interpolate the vector to x,y,z values
* @param x the x component to lerp to
* @param y the y component to lerp to
* @param z the z component to lerp to
*/
public void lerp(float x, float y, float z, float amt) {
this.x = PApplet.lerp(this.x,x,amt);
this.y = PApplet.lerp(this.y,y,amt);
this.z = PApplet.lerp(this.z,z,amt);
public PVector lerp(float x, float y, float z, float amt) {
this.x = PApplet.lerp(this.x, x, amt);
this.y = PApplet.lerp(this.y, y, amt);
this.z = PApplet.lerp(this.z, z, amt);
return this;
}
/**
* ( begin auto-generated from PVector_angleBetween.xml )
*
@@ -976,14 +1027,17 @@ public class PVector implements Serializable {
return array;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof PVector))
if (!(obj instanceof PVector)) {
return false;
}
final PVector p = (PVector) obj;
return x == p.x && y == p.y && z == p.z;
}
@Override
public int hashCode() {
int result = 1;

View File

@@ -1,7 +1,19 @@
0228 core
X add copy() method to PVector
X modify PVector to include better methods for chaining operations
X http://code.google.com/p/processing/issues/detail?id=218
X https://github.com/processing/processing/issues/257
X PVector discussion with Dan
o Jer and Dan will look at their code, plus toxiclibs
_ bring back chaining in JSON (and add to XML)
high
_ Closing opengl sketch from the PDE doesn't stop java process on windows
_ https://github.com/processing/processing/issues/2335
_ StingList.insert() error (should be an easy fix)
_ https://github.com/processing/processing/issues/2548
_ pull for image resize and alpha issues
_ https://github.com/processing/processing/pull/2324
_ dataPath() not working when app is not run from app dir on Linux
@@ -430,13 +442,8 @@ _ https://github.com/processing/processing/issues/1596
CORE / PVector
_ PVector discussion with Dan
_ Jer and Dan will look at their code, plus toxiclibs
_ modify PVector to include better methods for chaining operations
_ http://code.google.com/p/processing/issues/detail?id=218
_ add screen(PVector), model(PVector) and world(PVector)?
_ maybe screenVec()? or screenXYZ()?
_ PVector chaining -> Dan looking into this
CORE / OpenGL (Andres)

View File

@@ -1,5 +1,22 @@
0228 pde
_ shouldn't write sketch.properties unless it's a non-default mode
_ https://github.com/processing/processing/issues/2531
_ huge i18n patch
_ https://github.com/processing/processing/pull/2084
_ make ant fail when trying to delete JRE files that don't exist
_ some aren't being removed properly
earlier
X for() loop with nothing inside parens crashes Auto Format
X https://github.com/processing/processing/issues/2141
gsoc
_ `return` keyword not treated as such when followed by a bracket
_ https://github.com/processing/processing/issues/2099
_ IllegalArgumentException when clicking between editor windows
_ https://github.com/processing/processing/issues/2530
_ "String index out of range" error
_ https://github.com/processing/processing/issues/1940
medium
_ possible to open a sketch multiple times
@@ -42,8 +59,6 @@ _ the Find window (also the save windows) also have the same problem
_ move old Google Code SVN back to processing.org
_ then cull out the old branches/tags from the Github repo
_ and/or start bundling separate source downloads
_ "String index out of range" error
_ https://github.com/processing/processing/issues/1940
_ look through all isPopupTrigger() code
_ make sure both press/release are implemented
_ emacs style errors in commander aren't quite right
@@ -692,8 +707,6 @@ _ update will update classes from shared in the current folder
TOOLS / Auto Format
_ for() loop with nothing inside parens crashes Auto Format
_ https://github.com/processing/processing/issues/2141
_ extra indent found
_ https://github.com/processing/processing/issues/1041
_ Switch block cases not indented
@@ -861,6 +874,8 @@ find YOUR_APP/Contents/ -type f \
DIST / Linux
_ Processing is named processing-app-Base in Gnome 3
_ https://github.com/processing/processing/issues/2534
_ how to run "headless" from user Batuff
_ sudo apt-get install xvfb
_ Xvfb :2 -screen 0 1024x768x24 &