hi, i'm trying to make polygon using JBox2D library. but it's giving me AssertionError. I have try to google the answer, but didn't find any.
this is the complete log of the error
Exception in thread "Animation Thread" java.lang.AssertionError
at org.jbox2d.collision.PolygonShape.computeCentroid(PolygonShape.java:338)
at org.jbox2d.collision.PolygonShape.<init>(PolygonShape.java:122)
at org.jbox2d.collision.Shape.create(Shape.java:273)
at org.jbox2d.dynamics.Body.createShape(Body.java:345)
at org.jbox2d.p5.Physics.createPolygon(Physics.java:477)
at my_test_jbox2d.bataJ(my_test_jbox2d.java:90)
at my_test_jbox2d.setup(my_test_jbox2d.java:46)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:722)
and this is my code
//BoxWrap2D
import org.jbox2d.p5.*;
//JBox2D
import org.jbox2d.dynamics.contacts.*;
import org.jbox2d.dynamics.*;
import org.jbox2d.common.*;
import org.jbox2d.collision.*;
import org.jbox2d.dynamics.joints.*;
Physics fisika;
World dunia;
void setup(){
size(400, 700, P3D);
smooth();
frameRate(60);
initScene();
bataI(100, 200);
bataJ(250, 400);
}
void draw(){
background(0);
}
void initScene(){
//ukuran layar applet
float screenW = width;
float screenH = height;
//besarnya gravitasi (meter/detik^2) - JBox2D telah menyesuaikannya ke dalam pixel. gravY = -10.0 adalah ukuran yg mirip dengan gravitasi nyata
float gravX = 0.0;
float gravY = -10.0;
//ukuran dari Axis-Aligned Bounding Box (pixel). Objek yang berada di luar area ini akan berhenti/ membeku
float screenAABBWidth = width;
float screenAABBHeight = height;
//ukuran panjang dan lebar dari garis tepi (pixel). Usahakan ukuran border lebih kecil dari ukuran AABB. Untuk menghapus border, gunakan fisika.removeBorder();
float borderBoxWidth = width;
float borderBoxHeight = height;
//defaultnya berisi 10, yang berarti 10 pixel == 1 meter.
float pixelsPerMeter = 10.0;
fisika = new Physics(this, screenW, screenH,
gravX, gravY,
screenAABBWidth, screenAABBHeight,
borderBoxWidth, borderBoxHeight,
pixelsPerMeter);
//fisika.removeBorder();
fisika.setDensity(1.0);
}
void bataI(int x, int y){
fisika.createPolygon(x, y,
x, y+30,
x+10, y+30,
x+10, y);
}
void bataJ(int x, int y){
fisika.createPolygon(x, y,
x+20, y,
x+20, y+30,
x+10, y+30,
x+10, y+10,
x, y+10);
}
thanks for the help..
EDIT : the error is from the clas bataJ(). the class bataI() is working fine
Hello, i'm new to Processing and i'm interested in it because it's easy to access camera and capture picture with processing. also i'm comfortable with processing because i'm familiar with java.
so, back on business.
i'm currently on my final year and i need to do my final project. and after playing around with processing + video capture addon, i have an idea. the idea is to do object detection using color. the object is specifically for traffic sign. and what i notice about traffic sign is the color is different (even though it's the same color, but if i can turn it to pixel and calculate it each of the traffic sign should have unique, isn't it?).
so, basically what i'm trying to do is : traffic sign - capture with webcam (or live if it's possible?) - crop it so minimize the noise - turn it to pixel - calculate the pixel (color) - compare it with database - show the result or if it's new, save it to database.
the problem i'm thinking is :
1. capture using webcam : the lighting and quality
2. the noise : how can i set the threshold so it'll be accurate (still doesn't have the idea)
but, on a second thougth and i'm just remember it now, can the traffic sign detected using Augmented Reality? since AR is basically reading sign...and traffic sign is sign. can it be done? or is it to slow or some drawback?
any help is appreciated
**btw, sorry for my poor english, it's not my first language