FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 952 : NullPointerException on curveVertex() when using more than 128 vertices in revision 0150
Last modified: 2008-10-15 13:58
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
RESOLVED
Resolution:
FIXED -
Pr
i
ority:
P1
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
tanepierre
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2008-10-15 13:02
The code enclosed below throws a NullPointerException on BETA0150 which was
not occuring on BETA0148.
System: MacOSX 10.5.5, MacBookPro, 4GB RAM
Java: "Java Update 2 for MacOSX 10.5", aka java version "1.5.0_16"
Exception in thread "Animation Thread" java.lang.NullPointerException
at processing.core.PGraphics.curveVertex(PGraphics.java:1243)
at processing.core.PApplet.curveVertex(PApplet.java:6832)
at sketch_081015a.rhodonea(sketch_081015a.java:47)
at sketch_081015a.draw(sketch_081015a.java:35)
at processing.core.PApplet.handleDraw(PApplet.java:1395)
at processing.core.PApplet.run(PApplet.java:1300)
at java.lang.Thread.run(Thread.java:613)
[quote]
[color=#996600]float[/color] theta;
[color=#996600]int[/color] STEPS= 360;
[color=#996600]float[/color] x=0,y=0;
[color=#CC6600]void[/color] [color=#993300][b]setup[/b][/color](){
[color=#996600]size[/color](800,800);
[color=#996600]background[/color](255);
[color=#996600]smooth[/color]();
[color=#996600]noCursor[/color]();
[color=#996600]noFill[/color]();
theta = 0;
}
[color=#CC6600]void[/color] [color=#993300][b]draw[/b][/color](){
[color=#CC6600]if[/color] ([color=#CC0000]frameCount[/color] == STEPS)
[color=#996600]noLoop[/color]();
[color=#996600]translate[/color]([color=#CC0000]width[/color]/2,[color=#CC0000]height[/color]/2);
rhodonea([color=#996600]sqrt[/color](19),0,10*[color=#CC0000]TWO_PI[/color]);
drawLinesTo(x,y);
}
[color=#CC6600]void[/color] rhodonea([color=#996600]float[/color] k,
[color=#996600]float[/color] theta_start, [color=#996600]float[/color]
theta_end) {
[color=#996600]float[/color] r;
[color=#996600]beginShape[/color]();
[color=#CC6600]for[/color] ([color=#996600]int[/color] i = 0; i <=
[color=#CC0000]frameCount[/color]; i++) {
theta = theta_start + i * (theta_end - theta_start) / STEPS;
r = [color=#996600]cos[/color](k*theta);
x = [color=#CC0000]width[/color]/2 * r * [color=#996600]cos[/color](theta);
y = [color=#CC0000]height[/color]/2 * r *
[color=#996600]sin[/color](theta);
[color=#996600]curveVertex[/color](x,y);
}
[color=#996600]endShape[/color]();
}
[color=#CC6600]void[/color] drawLinesTo([color=#996600]float[/color] x,
[color=#996600]float[/color] y){
[color=#996600]stroke[/color](#983900,20);
[color=#996600]line[/color](x,y,-[color=#CC0000]width[/color]/2,-[color=#CC0000]height[/color]/2);
[color=#996600]line[/color](x,y,-[color=#CC0000]width[/color]/2,[color=#CC0000]height[/color]/2);
[color=#996600]line[/color](x,y,[color=#CC0000]width[/color]/2,-[color=#CC0000]height[/color]/2);
[color=#996600]line[/color](x,y,[color=#CC0000]width[/color]/2,[color=#CC0000]height[/color]/2);
}
[/quote]
Additional Comment
#1 From fry 2008-10-15 13:58
Bummer, found and fixed for 0151. Thanks for the report.