Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PVector static vs. instance methods now work as expected. Improved de…
…tection of end-of-sketch.
- Loading branch information
Jonathan Feinberg
committed
Sep 16, 2010
1 parent
bcecffc
commit 60d3bdd
Showing
9 changed files
with
106 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,6 @@ processing-py.jar | |
libraries/peasycam | ||
dist | ||
zamples | ||
libraries/GSVideo | ||
test.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ def __repr__(self): | |
foo = Foo('cosmic') | ||
print foo | ||
print str(12) | ||
print str([12,13]) | ||
print str([12,13]) | ||
noLoop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,4 @@ | |
def setup(): | ||
size(10, 10, P3D) | ||
noLoop(); | ||
|
||
def draw(): | ||
print "OK" | ||
print 'OK' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,43 @@ | ||
a = PVector(5, 7, 11) | ||
b = PVector(13, 17, 23) | ||
assert a - b == PVector(-8.0, -10.0, -12.0) | ||
print b - a | ||
print b + a | ||
print a + b | ||
|
||
print PVector.add(a, b) | ||
print PVector.add(a, b) | ||
assert b - a == PVector(8, 10, 12) | ||
c = PVector(18, 24, 34) | ||
assert b + a == c | ||
assert a + b == c | ||
assert PVector.add(a, b) == c | ||
assert PVector.add(a, b) == c | ||
a.add(b) | ||
print a | ||
assert a == c | ||
a.add(b) | ||
print a | ||
assert a == PVector(31.0, 41.0, 57.0) | ||
|
||
try: | ||
print a * b | ||
raise AssertionError("That shouldn't have happened.") | ||
except TypeError: | ||
pass | ||
|
||
print a * b | ||
print a * 10 | ||
print a * 10 | ||
c = PVector(310.0, 410.0, 570.0) | ||
assert a * 10 == c | ||
assert a * 10 == c | ||
assert PVector.mult(a, 10) == c | ||
assert PVector.mult(a, 10) == c | ||
a.mult(10) | ||
print a | ||
assert a == c | ||
|
||
assert int(1000 * PVector.dist(a, b)) == 736116 | ||
assert PVector.cross(a, b) == PVector(-260.0, 280.0, -60.0) | ||
assert a.cross(b) == PVector(-260.0, 280.0, -60.0) | ||
assert PVector.dot(a, b) == 24110.0 | ||
|
||
import copy | ||
x = [a, b] | ||
y = copy.deepcopy(x) | ||
|
||
assert x == y | ||
x[0].sub(PVector(100, 100, 100)) | ||
assert x != y | ||
|
||
print 'OK' | ||
|
||
print PVector.dist(a, b) | ||
print PVector.cross(a, b) | ||
print PVector.dot(a, b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters